Add specs for .encode
parent
11ca383d4f
commit
9a74e60db3
|
@ -140,4 +140,49 @@ describe Rex::Encoder::NonAlpha do
|
|||
end
|
||||
end
|
||||
|
||||
describe ".encode" do
|
||||
subject { described_class.encode(buf) }
|
||||
|
||||
context "when buf includes a badchar" do
|
||||
let(:buf) { "ABCDEF{" }
|
||||
|
||||
it "raises an error" do
|
||||
expect { subject }.to raise_error(RuntimeError)
|
||||
end
|
||||
end
|
||||
|
||||
context "when buf includes Alpha chars" do
|
||||
let(:buf) { "@#()" }
|
||||
|
||||
it "returns an String" do
|
||||
is_expected.to be_an(String)
|
||||
end
|
||||
|
||||
it "includes the decoder stub" do
|
||||
is_expected.to match(decoder)
|
||||
end
|
||||
|
||||
it "doesn't include the original buf" do
|
||||
is_expected.to_not include(buf)
|
||||
end
|
||||
end
|
||||
|
||||
context "when buf doesn't include Alpha chars" do
|
||||
let(:buf) { "ABCD" }
|
||||
|
||||
it "returns an String" do
|
||||
is_expected.to be_an(String)
|
||||
end
|
||||
|
||||
it "includes the decoder stub" do
|
||||
is_expected.to match(decoder)
|
||||
end
|
||||
|
||||
it "includes the original buf" do
|
||||
is_expected.to include(buf)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue