Skip to content

Commit e4a7025

Browse files
committed
Avoid explicit use of subject
1 parent ca4c4f5 commit e4a7025

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

spec/lib/rex/encoder/alpha2/alpha_mixed_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
end
2626

2727
describe ".gen_decoder_prefix" do
28-
subject { described_class.gen_decoder_prefix(reg, offset) }
28+
subject(:decoder_prefix) { described_class.gen_decoder_prefix(reg, offset) }
2929
let(:reg) { 'ECX' }
3030
let(:offset) { 5 }
3131

@@ -38,7 +38,7 @@
3838
let(:offset) { 0 }
3939

4040
it "raises an error" do
41-
expect { subject }.to raise_error(ArgumentError)
41+
expect { decoder_prefix }.to raise_error(ArgumentError)
4242
end
4343
end
4444

@@ -47,14 +47,14 @@
4747
let(:offset) { 33 }
4848

4949
it "raises an error" do
50-
expect { subject }.to raise_error
50+
expect { decoder_prefix }.to raise_error
5151
end
5252
end
5353
end
5454

5555

5656
describe ".gen_decoder" do
57-
subject { described_class.gen_decoder(reg, offset) }
57+
subject(:decoder) { described_class.gen_decoder(reg, offset) }
5858
let(:reg) { 'ECX' }
5959
let(:offset) { 5 }
6060

@@ -71,7 +71,7 @@
7171
let(:offset) { 0 }
7272

7373
it "raises an error" do
74-
expect { subject }.to raise_error(ArgumentError)
74+
expect { decoder }.to raise_error(ArgumentError)
7575
end
7676
end
7777

@@ -80,7 +80,7 @@
8080
let(:offset) { 33 }
8181

8282
it "raises an error" do
83-
expect { subject }.to raise_error
83+
expect { decoder }.to raise_error
8484
end
8585
end
8686
end

spec/lib/rex/encoder/alpha2/alpha_upper_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
end
3232

3333
describe ".gen_decoder_prefix" do
34-
subject { described_class.gen_decoder_prefix(reg, offset) }
34+
subject(:decoder_prefix) { described_class.gen_decoder_prefix(reg, offset) }
3535
let(:reg) { 'ECX' }
3636
let(:offset) { 5 }
3737

@@ -44,7 +44,7 @@
4444
let(:offset) { 0 }
4545

4646
it "raises an error" do
47-
expect { subject }.to raise_error(ArgumentError)
47+
expect { decoder_prefix }.to raise_error(ArgumentError)
4848
end
4949
end
5050

@@ -53,14 +53,14 @@
5353
let(:offset) { 25 }
5454

5555
it "raises an error" do
56-
expect { subject }.to raise_error
56+
expect { decoder_prefix }.to raise_error
5757
end
5858
end
5959
end
6060

6161

6262
describe ".gen_decoder" do
63-
subject { described_class.gen_decoder(reg, offset) }
63+
subject(:decoder) { described_class.gen_decoder(reg, offset) }
6464
let(:reg) { 'ECX' }
6565
let(:offset) { 5 }
6666

@@ -77,7 +77,7 @@
7777
let(:offset) { 0 }
7878

7979
it "raises an error" do
80-
expect { subject }.to raise_error(ArgumentError)
80+
expect { decoder }.to raise_error(ArgumentError)
8181
end
8282
end
8383

@@ -86,7 +86,7 @@
8686
let(:offset) { 25 }
8787

8888
it "raises an error" do
89-
expect { subject }.to raise_error
89+
expect { decoder }.to raise_error
9090
end
9191
end
9292
end

spec/lib/rex/encoder/alpha2/generic_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@
88
it_behaves_like 'Rex::Encoder::Alpha2::Generic'
99

1010
describe ".default_accepted_chars" do
11-
subject { described_class.default_accepted_chars }
11+
subject(:accepted_chars) { described_class.default_accepted_chars }
1212

1313
it { is_expected.to eq(('a' .. 'z').to_a + ('B' .. 'Z').to_a + ('0' .. '9').to_a) }
1414
end
1515

1616
describe ".gen_decoder_prefix" do
17-
subject { described_class.gen_decoder_prefix(reg, offset) }
17+
subject(:decoder_prefix) { described_class.gen_decoder_prefix(reg, offset) }
1818
let(:reg) { 'ECX' }
1919
let(:offset) { 0 }
2020

2121
it { is_expected.to eq('') }
2222
end
2323

2424
describe ".gen_decoder" do
25-
subject { described_class.gen_decoder(reg, offset) }
25+
subject(:decoder) { described_class.gen_decoder(reg, offset) }
2626
let(:reg) { 'ECX' }
2727
let(:offset) { 0 }
2828

2929
it { is_expected.to eq('') }
3030
end
3131

3232
describe ".gen_second" do
33-
subject { described_class.gen_second(block, base) }
33+
subject(:second) { described_class.gen_second(block, base) }
3434
let(:block) { 0xaf }
3535
let(:base) { 0xfa }
3636

3737
it "returns block ^ base" do
38-
expect(subject ^ base).to eq(block)
38+
expect(second ^ base).to eq(block)
3939
end
4040
end
4141

spec/lib/rex/encoder/alpha2/unicode_mixed_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
end
2626

2727
describe ".gen_decoder_prefix" do
28-
subject { described_class.gen_decoder_prefix(reg, offset) }
28+
subject(:decoder_prefix) { described_class.gen_decoder_prefix(reg, offset) }
2929
let(:reg) { 'ECX' }
3030
let(:offset) { 5 }
3131

@@ -38,7 +38,7 @@
3838
let(:offset) { 0 }
3939

4040
it "raises an error" do
41-
expect { subject }.to raise_error(RuntimeError)
41+
expect { decoder_prefix }.to raise_error(RuntimeError)
4242
end
4343
end
4444

@@ -47,14 +47,14 @@
4747
let(:offset) { 22 }
4848

4949
it "raises an error" do
50-
expect { subject }.to raise_error
50+
expect { decoder_prefix }.to raise_error
5151
end
5252
end
5353
end
5454

5555

5656
describe ".gen_decoder" do
57-
subject { described_class.gen_decoder(reg, offset) }
57+
subject(:decoder) { described_class.gen_decoder(reg, offset) }
5858
let(:reg) { 'ECX' }
5959
let(:offset) { 5 }
6060

@@ -71,7 +71,7 @@
7171
let(:offset) { 0 }
7272

7373
it "raises an error" do
74-
expect { subject }.to raise_error(RuntimeError)
74+
expect { decoder }.to raise_error(RuntimeError)
7575
end
7676
end
7777

@@ -80,7 +80,7 @@
8080
let(:offset) { 22 }
8181

8282
it "raises an error" do
83-
expect { subject }.to raise_error
83+
expect { decoder }.to raise_error
8484
end
8585
end
8686
end

spec/lib/rex/encoder/alpha2/unicode_upper_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
end
2626

2727
describe ".default_accepted_chars" do
28-
subject { described_class.default_accepted_chars }
28+
subject(:accepted_chars) { described_class.default_accepted_chars }
2929

3030
it { is_expected.to eq(('B' .. 'Z').to_a + ('0' .. '9').to_a) }
3131
end
3232

3333
describe ".gen_decoder_prefix" do
34-
subject { described_class.gen_decoder_prefix(reg, offset) }
34+
subject(:decoder_prefix) { described_class.gen_decoder_prefix(reg, offset) }
3535
let(:reg) { 'ECX' }
3636
let(:offset) { 5 }
3737

@@ -44,7 +44,7 @@
4444
let(:offset) { 0 }
4545

4646
it "raises an error" do
47-
expect(subject).to be_nil
47+
expect(decoder_prefix).to be_nil
4848
end
4949
end
5050

@@ -53,14 +53,14 @@
5353
let(:offset) { 7 }
5454

5555
it "raises an error" do
56-
expect { subject }.to raise_error(RuntimeError)
56+
expect { decoder_prefix }.to raise_error(RuntimeError)
5757
end
5858
end
5959
end
6060

6161

6262
describe ".gen_decoder" do
63-
subject { described_class.gen_decoder(reg, offset) }
63+
subject(:decoder) { described_class.gen_decoder(reg, offset) }
6464
let(:reg) { 'ECX' }
6565
let(:offset) { 5 }
6666

@@ -77,7 +77,7 @@
7777
let(:offset) { 0 }
7878

7979
it "raises an error" do
80-
expect { subject }.to raise_error(NoMethodError)
80+
expect { decoder }.to raise_error(NoMethodError)
8181
end
8282
end
8383

@@ -86,7 +86,7 @@
8686
let(:offset) { 7 }
8787

8888
it "raises an error" do
89-
expect { subject }.to raise_error(RuntimeError)
89+
expect { decoder }.to raise_error(RuntimeError)
9090
end
9191
end
9292
end

0 commit comments

Comments
 (0)