Skip to content

Commit ac55c35

Browse files
committed
Include (and appease) rubocop-rspec.
1 parent b0967a1 commit ac55c35

File tree

5 files changed

+40
-6
lines changed

5 files changed

+40
-6
lines changed

.rubocop.yml

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
inherit_from: .rubocop_rspec_base.yml
2+
require: rubocop-rspec
23

4+
AllCops:
5+
Exclude:
6+
- "Support/syntax/syntax_highlight_test_spec.rb"
7+
RSpec/ExampleWording:
8+
Exclude:
9+
- "Support/fixtures/*_spec.rb"
10+
311
# Relax some metric cops for now. All of these should be removed eventually.
412

513
AbcSize:
@@ -21,4 +29,27 @@ ModuleLength:
2129
Max: 160
2230

2331
PerceivedComplexity:
24-
Max: 12
32+
Max: 12
33+
34+
# Customize rubocop-rspec
35+
36+
RSpec/DescribeClass:
37+
Enabled: false
38+
39+
RSpec/ExampleLength:
40+
Enabled: false
41+
42+
RSpec/ExpectActual:
43+
Enabled: false
44+
45+
RSpec/InstanceVariable:
46+
Enabled: false
47+
48+
RSpec/MessageSpies:
49+
Enabled: false
50+
51+
RSpec/MultipleExpectations:
52+
Enabled: false
53+
54+
RSpec/NotToNot:
55+
EnforcedStyle: to_not

Support/spec/rspec/mate/gutter_marks_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def example_with_location(path, line, &block)
1616
example_with_location('./foo/failures.rb', 12) { raise "a failed example" }
1717
example_with_location('./foo/failures.rb', 24) { raise "another failure" }
1818
example_group.run
19-
gm = RSpec::Mate::GutterMarks.new(example_group.examples)
19+
gm = described_class.new(example_group.examples)
2020
expect(gm).to receive(:run_mate).with("--clear-mark=warning", "./foo/successes.rb")
2121
expect(gm).to receive(:run_mate).with("--clear-mark=warning", "./foo/failures.rb")
2222
expect(gm).to receive(:run_mate).with("--set-mark=warning:a failed example", "--line=12", "./foo/failures.rb")

Support/spec/rspec/mate/runner_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def capture
1414
$stdout = original_stdout
1515
end
1616

17-
before(:each) do
17+
before do
1818
# TODO: long path
1919
@first_failing_spec = %r{fixtures/example_failing_spec\.rb:3}n
2020
@second_failing_spec = %r{fixtures/example_failing_spec\.rb:7}n
@@ -31,10 +31,10 @@ def capture
3131
stub_const("RSpec::Mate::Runner::LAST_RUN_CACHE", "/tmp/textmate_rspec_last_run.test.yml")
3232
stub_const("RSpec::Mate::Runner::LAST_REMEMBERED_FILE_CACHE", "/tmp/textmate_rspec_last_remembered_file_cache.test.txt")
3333

34-
@spec_mate = RSpec::Mate::Runner.new
34+
@spec_mate = described_class.new
3535
end
3636

37-
after(:each) do
37+
after do
3838
ENV.replace(@original_env)
3939

4040
$".delete_if do |path|

Support/spec/rspec/mate/switch_command_spec.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ def expect_webapp_twins(pair)
3232
end
3333
end
3434

35+
subject(:command) { described_class.new }
36+
3537
describe "in a regular app" do
3638
expect_twins [
3739
"/Users/aslakhellesoy/scm/rspec/trunk/RSpec.tmbundle/Support/spec/rspec/mate/switch_command_spec.rb",
@@ -193,7 +195,7 @@ def expect_webapp_twins(pair)
193195
# '/Users/foo/Code/bar/spec/other/my/own/file.rb' => 'My::Own::File',
194196
}.each_pair do |path, class_name|
195197
it "extracts the full class name from the path (#{class_name})" do
196-
expect(subject.described_class_for(path, base)).to eq(class_name)
198+
expect(command.described_class_for(path, base)).to eq(class_name)
197199
end
198200
end
199201
end

Support/spec/spec_helper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
require 'rspec/core'
66
require 'rspec/core/sandbox'
77

8+
# rubocop:disable RSpec/BeforeAfterAll
89
RSpec.configure do |config|
910
# See https://github.com/rspec/rspec-core/blob/5bee47543e78cf769ee4812c3bf7c00a91765b3a/spec/support/sandboxing.rb
1011
config.around(:example, :sandboxed) do |ex|

0 commit comments

Comments
 (0)