CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/lib/rex/proto/rmi/model/ping_spec.rb
Views: 11791
1
# -*- coding:binary -*-
2
require 'spec_helper'
3
4
require 'stringio'
5
6
RSpec.describe Rex::Proto::Rmi::Model::Ping do
7
8
subject(:ping) do
9
described_class.new
10
end
11
12
let(:sample) do
13
"\x52"
14
end
15
16
let(:sample_io) { StringIO.new(sample) }
17
18
describe "#decode" do
19
it "returns the Rex::Proto::Rmi::Model::Ping decoded" do
20
expect(ping.decode(sample_io)).to eq(ping)
21
end
22
23
it "decodes stream_id correctly" do
24
ping.decode(sample_io)
25
expect(ping.stream_id).to eq(Rex::Proto::Rmi::Model::PING_MESSAGE)
26
end
27
end
28
29
describe "#encode" do
30
it "encodes the Ping correctly" do
31
ping.stream_id = Rex::Proto::Rmi::Model::PING_MESSAGE
32
expect(ping.encode).to eq(sample)
33
end
34
end
35
end
36
37