Add specs for .encode

bug/bundler_fix
jvazquez-r7 2014-09-08 14:32:23 -05:00
parent 11ca383d4f
commit 9a74e60db3
1 changed files with 45 additions and 0 deletions

View File

@ -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