Avoid explicit use of subject on shared examples

bug/bundler_fix
jvazquez-r7 2014-10-13 10:43:53 -05:00
parent e4a7025157
commit eb190a5a78
1 changed files with 6 additions and 6 deletions

View File

@ -1,14 +1,14 @@
shared_examples_for 'Rex::Encoder::Alpha2::Generic' do shared_examples_for 'Rex::Encoder::Alpha2::Generic' do
describe ".encode_byte" do describe ".encode_byte" do
subject { described_class.encode_byte(block, badchars) } subject(:encoded_byte) { described_class.encode_byte(block, badchars) }
context "when too many badchars" do context "when too many badchars" do
let(:block) { 0x41 } let(:block) { 0x41 }
let(:badchars) { (0x00..0xff).to_a.pack("C*") } let(:badchars) { (0x00..0xff).to_a.pack("C*") }
it "raises an error" do it "raises an error" do
expect { subject }.to raise_error(RuntimeError) expect { encoded_byte }.to raise_error(RuntimeError)
end end
end end
@ -17,7 +17,7 @@ shared_examples_for 'Rex::Encoder::Alpha2::Generic' do
let(:badchars) { 'B' } let(:badchars) { 'B' }
it "returns two-bytes encoding" do it "returns two-bytes encoding" do
expect(subject.length).to eq(2) expect(encoded_byte.length).to eq(2)
end end
it "returns encoding without badchars" do it "returns encoding without badchars" do
@ -30,7 +30,7 @@ shared_examples_for 'Rex::Encoder::Alpha2::Generic' do
end end
describe ".encode" do describe ".encode" do
subject { described_class.encode(buf, reg, offset, badchars) } subject(:encoded_result) { described_class.encode(buf, reg, offset, badchars) }
let(:buf) { 'ABCD' } let(:buf) { 'ABCD' }
let(:reg) { 'ECX' } let(:reg) { 'ECX' }
let(:offset) { 0 } let(:offset) { 0 }
@ -39,7 +39,7 @@ shared_examples_for 'Rex::Encoder::Alpha2::Generic' do
let(:badchars) { (0x00..0xff).to_a.pack("C*") } let(:badchars) { (0x00..0xff).to_a.pack("C*") }
it "raises an error" do it "raises an error" do
expect { subject }.to raise_error(RuntimeError) expect { encoded_result }.to raise_error(RuntimeError)
end end
end end
@ -57,7 +57,7 @@ shared_examples_for 'Rex::Encoder::Alpha2::Generic' do
end end
describe ".add_terminator" do describe ".add_terminator" do
subject { described_class.add_terminator } subject(:terminator) { described_class.add_terminator }
it { is_expected.to eq('AA') } it { is_expected.to eq('AA') }
end end