Skip to content

Commit eb190a5

Browse files
committed
Avoid explicit use of subject on shared examples
1 parent e4a7025 commit eb190a5

File tree

1 file changed

+6
-6
lines changed
  • spec/support/shared/examples/rex/encoder/alpha2

1 file changed

+6
-6
lines changed

spec/support/shared/examples/rex/encoder/alpha2/generic.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
shared_examples_for 'Rex::Encoder::Alpha2::Generic' do
22

33
describe ".encode_byte" do
4-
subject { described_class.encode_byte(block, badchars) }
4+
subject(:encoded_byte) { described_class.encode_byte(block, badchars) }
55

66
context "when too many badchars" do
77
let(:block) { 0x41 }
88
let(:badchars) { (0x00..0xff).to_a.pack("C*") }
99

1010
it "raises an error" do
11-
expect { subject }.to raise_error(RuntimeError)
11+
expect { encoded_byte }.to raise_error(RuntimeError)
1212
end
1313
end
1414

@@ -17,7 +17,7 @@
1717
let(:badchars) { 'B' }
1818

1919
it "returns two-bytes encoding" do
20-
expect(subject.length).to eq(2)
20+
expect(encoded_byte.length).to eq(2)
2121
end
2222

2323
it "returns encoding without badchars" do
@@ -30,7 +30,7 @@
3030
end
3131

3232
describe ".encode" do
33-
subject { described_class.encode(buf, reg, offset, badchars) }
33+
subject(:encoded_result) { described_class.encode(buf, reg, offset, badchars) }
3434
let(:buf) { 'ABCD' }
3535
let(:reg) { 'ECX' }
3636
let(:offset) { 0 }
@@ -39,7 +39,7 @@
3939
let(:badchars) { (0x00..0xff).to_a.pack("C*") }
4040

4141
it "raises an error" do
42-
expect { subject }.to raise_error(RuntimeError)
42+
expect { encoded_result }.to raise_error(RuntimeError)
4343
end
4444
end
4545

@@ -57,7 +57,7 @@
5757
end
5858

5959
describe ".add_terminator" do
60-
subject { described_class.add_terminator }
60+
subject(:terminator) { described_class.add_terminator }
6161

6262
it { is_expected.to eq('AA') }
6363
end

0 commit comments

Comments
 (0)