Skip to content

Commit 10bed2f

Browse files
n-rodriguezthde
authored andcommitted
Fix Rubocop offenses in spec
1 parent 34df8ae commit 10bed2f

69 files changed

Lines changed: 947 additions & 879 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.rubocop.yml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ AllCops:
1212
Exclude:
1313
- bin/*
1414
- gemfiles/*
15-
- spec/**/*
1615
- lib/netbox-client-ruby.rb
1716

1817
Gemspec/RequireMFA:
@@ -36,3 +35,50 @@ Style/TrailingCommaInArguments:
3635

3736
Style/AccessModifierDeclarations:
3837
Enabled: false
38+
39+
#########
40+
# RSPEC #
41+
#########
42+
43+
RSpec/NotToNot:
44+
EnforcedStyle: to_not
45+
46+
RSpec/MultipleMemoizedHelpers:
47+
Max: 10
48+
49+
RSpec/MultipleExpectations:
50+
Max: 10
51+
52+
RSpec/NestedGroups:
53+
Max: 5
54+
55+
RSpec/ExampleLength:
56+
Max: 7
57+
58+
RSpec/MetadataStyle:
59+
EnforcedStyle: hash
60+
61+
RSpec/MessageSpies:
62+
EnforcedStyle: receive
63+
64+
# Configure me :)
65+
RSpec/NamedSubject:
66+
Enabled: false
67+
68+
RSpec/ContextWording:
69+
Enabled: false
70+
71+
RSpec/SubjectDeclaration:
72+
Enabled: false
73+
74+
Style/OpenStructUse:
75+
Enabled: false
76+
77+
RSpec/VerifiedDoubles:
78+
Enabled: false
79+
80+
RSpec/SpecFilePathFormat:
81+
Enabled: false
82+
83+
RSpec/IteratedExpectation:
84+
Enabled: false

spec/netbox_client_ruby/api/circuits/circuit_spec.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
require 'spec_helper'
44

55
RSpec.describe NetboxClientRuby::Circuits::Circuit, faraday_stub: true do
6+
subject { described_class.new id }
7+
68
let(:id) { 1 }
79
let(:base_url) { '/api/circuits/circuits/' }
810
let(:request_url) { "#{base_url}#{id}/" }
911
let(:response) { File.read("spec/fixtures/circuits/circuit_#{id}.json") }
1012

11-
subject { described_class.new id }
12-
1313
describe '#id' do
1414
it 'shall be the expected id' do
1515
expect(subject.id).to eq(id)
1616
end
1717
end
1818

1919
describe '#description' do
20-
it 'should fetch the data' do
20+
it 'fetches the data' do
2121
expect(faraday).to receive(:get).and_call_original
2222

2323
subject.description
@@ -29,23 +29,23 @@
2929
end
3030

3131
describe '.tenant' do
32-
it 'should be a Tenant object' do
32+
it 'is a Tenant object' do
3333
tenant = subject.tenant
3434
expect(tenant).to be_a NetboxClientRuby::Tenancy::Tenant
3535
expect(tenant.id).to eq(1)
3636
end
3737
end
3838

3939
describe '.provider' do
40-
it 'should be a Provider object' do
40+
it 'is a Provider object' do
4141
provider = subject.provider
4242
expect(provider).to be_a NetboxClientRuby::Circuits::Provider
4343
expect(provider.id).to eq(1)
4444
end
4545
end
4646

4747
describe '.type' do
48-
it 'should be a Type object' do
48+
it 'is a Type object' do
4949
provider = subject.type
5050
expect(provider).to be_a NetboxClientRuby::Circuits::CircuitType
5151
expect(provider.id).to eq(1)
@@ -57,7 +57,7 @@
5757
let(:response_status) { 204 }
5858
let(:response) { nil }
5959

60-
it 'should delete the object' do
60+
it 'deletes the object' do
6161
expect(faraday).to receive(request_method).and_call_original
6262
subject.delete
6363
end
@@ -67,14 +67,14 @@
6767
let(:request_method) { :patch }
6868
let(:request_params) { { 'description' => 'noob' } }
6969

70-
it 'should update the object' do
70+
it 'updates the object' do
7171
expect(faraday).to receive(request_method).and_call_original
7272
expect(subject.update(description: 'noob').description).to eq('Desc of Circuit 0')
7373
end
7474
end
7575

7676
describe '.reload' do
77-
it 'should reload the object' do
77+
it 'reloads the object' do
7878
expect(faraday).to receive(request_method).twice.and_call_original
7979

8080
subject.reload
@@ -87,14 +87,14 @@
8787
let(:request_params) { { 'description' => description } }
8888

8989
context 'update' do
90-
let(:request_method) { :patch }
91-
9290
subject do
9391
entity = described_class.new id
9492
entity.description = description
9593
entity
9694
end
9795

96+
let(:request_method) { :patch }
97+
9898
it 'does not call PATCH until save is called' do
9999
expect(faraday).to_not receive(request_method)
100100
expect(faraday).to_not receive(:get)
@@ -117,15 +117,15 @@
117117
end
118118

119119
context 'create' do
120-
let(:request_method) { :post }
121-
let(:request_url) { base_url }
122-
123120
subject do
124121
entity = described_class.new
125122
entity.description = description
126123
entity
127124
end
128125

126+
let(:request_method) { :post }
127+
let(:request_url) { base_url }
128+
129129
it 'does not POST until save is called' do
130130
expect(faraday).to_not receive(request_method)
131131
expect(faraday).to_not receive(:get)

spec/netbox_client_ruby/api/circuits/circuit_termination_spec.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
require 'spec_helper'
44

55
RSpec.describe NetboxClientRuby::Circuits::CircuitTermination, faraday_stub: true do
6+
subject { described_class.new id }
7+
68
let(:id) { 1 }
79
let(:base_url) { '/api/circuits/circuit-terminations/' }
810
let(:request_url) { "#{base_url}#{id}/" }
911
let(:response) { File.read("spec/fixtures/circuits/circuit-termination_#{id}.json") }
1012

11-
subject { described_class.new id }
12-
1313
describe '#id' do
1414
it 'shall be the expected id' do
1515
expect(subject.id).to eq(id)
1616
end
1717
end
1818

1919
describe '#term_side' do
20-
it 'should fetch the data' do
20+
it 'fetches the data' do
2121
expect(faraday).to receive(:get).and_call_original
2222

2323
subject.term_side
@@ -29,7 +29,7 @@
2929
end
3030

3131
describe '.site' do
32-
it 'should be a Site object' do
32+
it 'is a Site object' do
3333
site = subject.site
3434
expect(site).to be_a NetboxClientRuby::DCIM::Site
3535
expect(site.id).to eq(1)
@@ -41,7 +41,7 @@
4141
let(:response_status) { 204 }
4242
let(:response) { nil }
4343

44-
it 'should delete the object' do
44+
it 'deletes the object' do
4545
expect(faraday).to receive(request_method).and_call_original
4646
subject.delete
4747
end
@@ -51,14 +51,14 @@
5151
let(:request_method) { :patch }
5252
let(:request_params) { { 'term_side' => 'noob' } }
5353

54-
it 'should update the object' do
54+
it 'updates the object' do
5555
expect(faraday).to receive(request_method).and_call_original
5656
expect(subject.update(term_side: 'noob').term_side).to eq('A')
5757
end
5858
end
5959

6060
describe '.reload' do
61-
it 'should reload the object' do
61+
it 'reloads the object' do
6262
expect(faraday).to receive(request_method).twice.and_call_original
6363

6464
subject.reload
@@ -71,14 +71,14 @@
7171
let(:request_params) { { 'term_side' => term_side } }
7272

7373
context 'update' do
74-
let(:request_method) { :patch }
75-
7674
subject do
7775
entity = described_class.new id
7876
entity.term_side = term_side
7977
entity
8078
end
8179

80+
let(:request_method) { :patch }
81+
8282
it 'does not call PATCH until save is called' do
8383
expect(faraday).to_not receive(request_method)
8484
expect(faraday).to_not receive(:get)
@@ -101,15 +101,15 @@
101101
end
102102

103103
context 'create' do
104-
let(:request_method) { :post }
105-
let(:request_url) { base_url }
106-
107104
subject do
108105
entity = described_class.new
109106
entity.term_side = term_side
110107
entity
111108
end
112109

110+
let(:request_method) { :post }
111+
let(:request_url) { base_url }
112+
113113
it 'does not POST until save is called' do
114114
expect(faraday).to_not receive(request_method)
115115
expect(faraday).to_not receive(:get)

spec/netbox_client_ruby/api/circuits/circuit_type_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
require 'spec_helper'
44

55
RSpec.describe NetboxClientRuby::Circuits::CircuitType, faraday_stub: true do
6+
subject { described_class.new id }
7+
68
let(:id) { 1 }
79
let(:base_url) { '/api/circuits/circuit-types/' }
810
let(:request_url) { "#{base_url}#{id}/" }
911
let(:response) { File.read("spec/fixtures/circuits/circuit-type_#{id}.json") }
1012

11-
subject { described_class.new id }
12-
1313
describe '#id' do
1414
it 'shall be the expected id' do
1515
expect(subject.id).to eq(id)
1616
end
1717
end
1818

1919
describe '#name' do
20-
it 'should fetch the data' do
20+
it 'fetches the data' do
2121
expect(faraday).to receive(:get).and_call_original
2222

2323
subject.name
@@ -33,7 +33,7 @@
3333
let(:response_status) { 204 }
3434
let(:response) { nil }
3535

36-
it 'should delete the object' do
36+
it 'deletes the object' do
3737
expect(faraday).to receive(request_method).and_call_original
3838
subject.delete
3939
end
@@ -43,14 +43,14 @@
4343
let(:request_method) { :patch }
4444
let(:request_params) { { 'name' => 'noob' } }
4545

46-
it 'should update the object' do
46+
it 'updates the object' do
4747
expect(faraday).to receive(request_method).and_call_original
4848
expect(subject.update(name: 'noob').name).to eq('Circuit Type 0')
4949
end
5050
end
5151

5252
describe '.reload' do
53-
it 'should reload the object' do
53+
it 'reloads the object' do
5454
expect(faraday).to receive(request_method).twice.and_call_original
5555

5656
subject.reload
@@ -63,14 +63,14 @@
6363
let(:request_params) { { 'name' => name } }
6464

6565
context 'update' do
66-
let(:request_method) { :patch }
67-
6866
subject do
6967
entity = described_class.new id
7068
entity.name = name
7169
entity
7270
end
7371

72+
let(:request_method) { :patch }
73+
7474
it 'does not call PATCH until save is called' do
7575
expect(faraday).to_not receive(request_method)
7676
expect(faraday).to_not receive(:get)
@@ -93,15 +93,15 @@
9393
end
9494

9595
context 'create' do
96-
let(:request_method) { :post }
97-
let(:request_url) { base_url }
98-
9996
subject do
10097
entity = described_class.new
10198
entity.name = name
10299
entity
103100
end
104101

102+
let(:request_method) { :post }
103+
let(:request_url) { base_url }
104+
105105
it 'does not POST until save is called' do
106106
expect(faraday).to_not receive(request_method)
107107
expect(faraday).to_not receive(:get)

0 commit comments

Comments
 (0)