Skip to content

Commit 4dab585

Browse files
committed
Enable rubocop-rspec and rubocop-rake
1 parent dd0f398 commit 4dab585

File tree

9 files changed

+106
-11
lines changed

9 files changed

+106
-11
lines changed

rakelib/.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
inherit_from: ../.rubocop.yml
2+
3+
require:
4+
- rubocop-rake

spec/.rubocop.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
inherit_from: ../.rubocop.yml
22

3+
require:
4+
- rubocop-rspec
5+
36
AllCops:
47
# Exclude generated files
58
Exclude:
@@ -35,3 +38,89 @@ Metrics/MethodLength:
3538
# Sometimes we're testing the operator
3639
Lint/BinaryOperatorWithIdenticalOperands:
3740
Enabled: false
41+
42+
############################################################
43+
# rubocop-rspec
44+
45+
# believe me, it wasn't by choice
46+
RSpec/AnyInstance:
47+
Enabled: false
48+
49+
# we meant to do that
50+
RSpec/BeforeAfterAll:
51+
Enabled: false
52+
53+
# more words != more readable
54+
RSpec/ContextWording:
55+
Enabled: false
56+
57+
# explicit >>> implicit
58+
RSpec/DescribedClass:
59+
Enabled: false
60+
61+
# more punctuation != more readable
62+
RSpec/DescribeSymbol:
63+
Enabled: false
64+
65+
# setup cost / time >>> failure granularity
66+
RSpec/ExampleLength:
67+
Max: 15
68+
CountAsOne:
69+
- array
70+
- hash
71+
- heredoc
72+
73+
# we meant to do that
74+
RSpec/ExpectInHook:
75+
Enabled: false
76+
77+
# your naming scheme is not in possession of all the facts
78+
RSpec/FilePath:
79+
Enabled: false
80+
81+
# explicit >>> implicit
82+
RSpec/InstanceVariable:
83+
Enabled: false
84+
85+
# maybe when 'all' has a corresponding 'none' matcher
86+
RSpec/IteratedExpectation:
87+
Enabled: false
88+
89+
# we meant to do that
90+
RSpec/MessageSpies:
91+
Enabled: false
92+
93+
# too late now
94+
RSpec/MultipleMemoizedHelpers:
95+
Enabled: false
96+
97+
# setup cost / time >>> failure granularity
98+
RSpec/MultipleExpectations:
99+
Enabled: false
100+
101+
# cure is worse than the disease
102+
RSpec/NestedGroups:
103+
Enabled: false
104+
105+
# more quotation marks != more readable
106+
RSpec/SharedExamples:
107+
Enabled: false
108+
109+
# we meant to do that
110+
RSpec/StubbedMock:
111+
Enabled: false
112+
113+
# we meant to do that
114+
RSpec/VerifiedDoubles:
115+
Enabled: false
116+
117+
############################################################
118+
# rubocop-rspec
119+
120+
# enable newer rubocop-rspec cops
121+
122+
RSpec/IdenticalEqualityAssertion: # new in 2.4
123+
Enabled: true
124+
125+
RSpec/Rails/AvoidSetupHook: # new in 2.4
126+
Enabled: true

spec/lib/berkeley_library/alma/barcode_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module BerkeleyLibrary
44
module Alma
55
describe BarCode do
6-
before(:each) do
6+
before do
77
BerkeleyLibrary::Alma.configure do
88
Config.alma_sru_host = 'berkeley.alma.exlibrisgroup.com'
99
Config.alma_institution_code = '01UCS_BER'
@@ -12,7 +12,7 @@ module Alma
1212
end
1313
end
1414

15-
after(:each) do
15+
after do
1616
BerkeleyLibrary::Alma::Config.send(:clear!)
1717
end
1818

spec/lib/berkeley_library/alma/bib_number_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module BerkeleyLibrary
44
module Alma
55
describe BibNumber do
6-
before(:each) do
6+
before do
77
BerkeleyLibrary::Alma.configure do
88
Config.alma_sru_host = 'berkeley.alma.exlibrisgroup.com'
99
Config.alma_institution_code = '01UCS_BER'
@@ -12,7 +12,7 @@ module Alma
1212
end
1313
end
1414

15-
after(:each) do
15+
after do
1616
BerkeleyLibrary::Alma::Config.send(:clear!)
1717
end
1818

spec/lib/berkeley_library/alma/config_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module BerkeleyLibrary
66
module Alma
77
describe Config do
88

9-
after(:each) do
9+
after do
1010
Config.send(:clear!)
1111
end
1212

@@ -52,7 +52,7 @@ module Alma
5252
describe 'with Rails config' do
5353
attr_reader :rails_config
5454

55-
before(:each) do
55+
before do
5656
@rails_config = Class.new do
5757
attr_accessor :alma_sru_host, :alma_institution_code
5858
end.new
@@ -66,7 +66,7 @@ module Alma
6666
Object.const_set(:Rails, rails)
6767
end
6868

69-
after(:each) do
69+
after do
7070
Object.send(:remove_const, :Rails)
7171
end
7272

spec/lib/berkeley_library/alma/mms_id_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module BerkeleyLibrary
44
module Alma
55
describe MMSID do
6-
before(:each) do
6+
before do
77
BerkeleyLibrary::Alma.configure do
88
Config.alma_sru_host = 'berkeley.alma.exlibrisgroup.com'
99
Config.alma_institution_code = '01UCS_BER'
@@ -12,7 +12,7 @@ module Alma
1212
end
1313
end
1414

15-
after(:each) do
15+
after do
1616
BerkeleyLibrary::Alma::Config.send(:clear!)
1717
end
1818

spec/lib/berkeley_library/alma/record_id_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ module Alma
3939

4040
describe 'SRU methods' do
4141
before { Config.default! }
42+
4243
after { Config.send(:clear!) }
4344

4445
describe :get_marc_xml do

spec/lib/berkeley_library/alma/sru/sru_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module BerkeleyLibrary
44
module Alma
55
describe SRU do
66
before { Config.default! }
7+
78
after { Config.send(:clear!) }
89

910
describe :get_marc_records do

spec/spec_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
config.color = true
1616
config.tty = true
1717
config.formatter = :documentation
18-
config.before(:each) { WebMock.disable_net_connect!(allow_localhost: true) }
19-
config.after(:each) { WebMock.allow_net_connect! }
18+
config.before { WebMock.disable_net_connect!(allow_localhost: true) }
19+
config.after { WebMock.allow_net_connect! }
2020
config.mock_with :rspec do |mocks|
2121
mocks.verify_partial_doubles = true
2222
end

0 commit comments

Comments
 (0)