rubocop-rspec 1.15.1 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -1
  3. data/Gemfile +0 -1
  4. data/config/default.yml +105 -0
  5. data/lib/rubocop-rspec.rb +27 -0
  6. data/lib/rubocop/cop/rspec/align_left_let_brace.rb +51 -0
  7. data/lib/rubocop/cop/rspec/align_right_let_brace.rb +51 -0
  8. data/lib/rubocop/cop/rspec/any_instance.rb +1 -1
  9. data/lib/rubocop/cop/rspec/cop.rb +4 -2
  10. data/lib/rubocop/cop/rspec/expect_in_hook.rb +61 -0
  11. data/lib/rubocop/cop/rspec/factory_girl/dynamic_attribute_defined_statically.rb +84 -0
  12. data/lib/rubocop/cop/rspec/hook_argument.rb +11 -5
  13. data/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb +42 -0
  14. data/lib/rubocop/cop/rspec/let_before_examples.rb +66 -0
  15. data/lib/rubocop/cop/rspec/multiple_expectations.rb +3 -5
  16. data/lib/rubocop/cop/rspec/multiple_subjects.rb +80 -0
  17. data/lib/rubocop/cop/rspec/named_subject.rb +5 -6
  18. data/lib/rubocop/cop/rspec/overwriting_setup.rb +1 -1
  19. data/lib/rubocop/cop/rspec/predicate_matcher.rb +337 -0
  20. data/lib/rubocop/cop/rspec/return_from_stub.rb +83 -0
  21. data/lib/rubocop/cop/rspec/void_expect.rb +52 -0
  22. data/lib/rubocop/rspec/align_let_brace.rb +64 -0
  23. data/lib/rubocop/rspec/config_formatter.rb +7 -4
  24. data/lib/rubocop/rspec/description_extractor.rb +2 -2
  25. data/lib/rubocop/rspec/example_group.rb +25 -2
  26. data/lib/rubocop/rspec/factory_girl.rb +7 -0
  27. data/lib/rubocop/rspec/language.rb +6 -1
  28. data/lib/rubocop/rspec/version.rb +1 -1
  29. data/rubocop-rspec.gemspec +1 -4
  30. data/spec/project/default_config_spec.rb +8 -4
  31. data/spec/rubocop/cop/rspec/align_left_let_brace_spec.rb +62 -0
  32. data/spec/rubocop/cop/rspec/align_right_let_brace_spec.rb +62 -0
  33. data/spec/rubocop/cop/rspec/any_instance_spec.rb +3 -3
  34. data/spec/rubocop/cop/rspec/around_block_spec.rb +11 -11
  35. data/spec/rubocop/cop/rspec/be_eql_spec.rb +7 -7
  36. data/spec/rubocop/cop/rspec/before_after_all_spec.rb +4 -4
  37. data/spec/rubocop/cop/rspec/cop_spec.rb +7 -7
  38. data/spec/rubocop/cop/rspec/describe_class_spec.rb +18 -18
  39. data/spec/rubocop/cop/rspec/describe_method_spec.rb +4 -4
  40. data/spec/rubocop/cop/rspec/describe_symbol_spec.rb +6 -6
  41. data/spec/rubocop/cop/rspec/described_class_spec.rb +18 -18
  42. data/spec/rubocop/cop/rspec/empty_example_group_spec.rb +5 -5
  43. data/spec/rubocop/cop/rspec/empty_line_after_final_let_spec.rb +9 -9
  44. data/spec/rubocop/cop/rspec/empty_line_after_subject_spec.rb +5 -5
  45. data/spec/rubocop/cop/rspec/example_length_spec.rb +6 -6
  46. data/spec/rubocop/cop/rspec/example_wording_spec.rb +10 -10
  47. data/spec/rubocop/cop/rspec/expect_actual_spec.rb +10 -10
  48. data/spec/rubocop/cop/rspec/expect_in_hook_spec.rb +79 -0
  49. data/spec/rubocop/cop/rspec/expect_output_spec.rb +7 -7
  50. data/spec/rubocop/cop/rspec/factory_girl/dynamic_attribute_defined_statically_spec.rb +87 -0
  51. data/spec/rubocop/cop/rspec/file_path_spec.rb +29 -29
  52. data/spec/rubocop/cop/rspec/focus_spec.rb +6 -6
  53. data/spec/rubocop/cop/rspec/hook_argument_spec.rb +35 -23
  54. data/spec/rubocop/cop/rspec/implicit_expect_spec.rb +10 -10
  55. data/spec/rubocop/cop/rspec/instance_spy_spec.rb +4 -4
  56. data/spec/rubocop/cop/rspec/instance_variable_spec.rb +7 -7
  57. data/spec/rubocop/cop/rspec/invalid_predicate_matcher_spec.rb +37 -0
  58. data/spec/rubocop/cop/rspec/it_behaves_like_spec.rb +4 -4
  59. data/spec/rubocop/cop/rspec/iterated_expectation_spec.rb +8 -8
  60. data/spec/rubocop/cop/rspec/leading_subject_spec.rb +5 -5
  61. data/spec/rubocop/cop/rspec/let_before_examples_spec.rb +83 -0
  62. data/spec/rubocop/cop/rspec/let_setup_spec.rb +4 -4
  63. data/spec/rubocop/cop/rspec/message_chain_spec.rb +2 -2
  64. data/spec/rubocop/cop/rspec/message_expectation_spec.rb +4 -4
  65. data/spec/rubocop/cop/rspec/message_spies_spec.rb +18 -18
  66. data/spec/rubocop/cop/rspec/multiple_describes_spec.rb +3 -3
  67. data/spec/rubocop/cop/rspec/multiple_expectations_spec.rb +45 -9
  68. data/spec/rubocop/cop/rspec/multiple_subjects_spec.rb +96 -0
  69. data/spec/rubocop/cop/rspec/named_subject_spec.rb +4 -4
  70. data/spec/rubocop/cop/rspec/nested_groups_spec.rb +3 -3
  71. data/spec/rubocop/cop/rspec/not_to_not_spec.rb +4 -4
  72. data/spec/rubocop/cop/rspec/overwriting_setup_spec.rb +4 -4
  73. data/spec/rubocop/cop/rspec/predicate_matcher_spec.rb +335 -0
  74. data/spec/rubocop/cop/rspec/repeated_description_spec.rb +5 -5
  75. data/spec/rubocop/cop/rspec/repeated_example_spec.rb +5 -5
  76. data/spec/rubocop/cop/rspec/return_from_stub_spec.rb +85 -0
  77. data/spec/rubocop/cop/rspec/scattered_let_spec.rb +2 -2
  78. data/spec/rubocop/cop/rspec/scattered_setup_spec.rb +8 -8
  79. data/spec/rubocop/cop/rspec/shared_context_spec.rb +10 -10
  80. data/spec/rubocop/cop/rspec/single_argument_message_chain_spec.rb +10 -10
  81. data/spec/rubocop/cop/rspec/subject_stub_spec.rb +9 -9
  82. data/spec/rubocop/cop/rspec/verified_doubles_spec.rb +7 -7
  83. data/spec/rubocop/cop/rspec/void_expect_spec.rb +47 -0
  84. data/spec/rubocop/rspec/config_formatter_spec.rb +2 -0
  85. data/spec/spec_helper.rb +1 -1
  86. data/spec/support/expect_offense.rb +17 -0
  87. metadata +39 -51
  88. data/spec/expect_violation/expectation_spec.rb +0 -85
  89. data/spec/support/expect_violation.rb +0 -170
@@ -7,7 +7,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
7
7
 
8
8
  shared_examples 'SkipBlocks enabled' do
9
9
  it 'does not flag violations within non-rspec blocks' do
10
- expect_violation(<<-RUBY)
10
+ expect_offense(<<-RUBY)
11
11
  describe MyClass do
12
12
  controller(ApplicationController) do
13
13
  bar = MyClass
@@ -28,7 +28,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
28
28
 
29
29
  shared_examples 'SkipBlocks disabled' do
30
30
  it 'flags violations within all blocks' do
31
- expect_violation(<<-RUBY)
31
+ expect_offense(<<-RUBY)
32
32
  describe MyClass do
33
33
  controller(ApplicationController) do
34
34
  bar = MyClass
@@ -77,7 +77,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
77
77
  let(:enforced_style) { :described_class }
78
78
 
79
79
  it 'checks for the use of the described class' do
80
- expect_violation(<<-RUBY)
80
+ expect_offense(<<-RUBY)
81
81
  describe MyClass do
82
82
  include MyClass
83
83
  ^^^^^^^ Use `described_class` instead of `MyClass`.
@@ -92,7 +92,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
92
92
  end
93
93
 
94
94
  it 'ignores described class as string' do
95
- expect_no_violations(<<-RUBY)
95
+ expect_no_offenses(<<-RUBY)
96
96
  describe MyClass do
97
97
  subject { "MyClass" }
98
98
  end
@@ -100,7 +100,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
100
100
  end
101
101
 
102
102
  it 'ignores describe that do not reference to a class' do
103
- expect_no_violations(<<-RUBY)
103
+ expect_no_offenses(<<-RUBY)
104
104
  describe "MyClass" do
105
105
  subject { "MyClass" }
106
106
  end
@@ -108,7 +108,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
108
108
  end
109
109
 
110
110
  it 'ignores class if the scope is changing' do
111
- expect_no_violations(<<-RUBY)
111
+ expect_no_offenses(<<-RUBY)
112
112
  describe MyClass do
113
113
  Class.new { foo = MyClass }
114
114
  Module.new { bar = MyClass }
@@ -129,7 +129,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
129
129
  end
130
130
 
131
131
  it 'only takes class from top level describes' do
132
- expect_violation(<<-RUBY)
132
+ expect_offense(<<-RUBY)
133
133
  describe MyClass do
134
134
  describe MyClass::Foo do
135
135
  subject { MyClass::Foo }
@@ -142,7 +142,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
142
142
  end
143
143
 
144
144
  it 'ignores subclasses' do
145
- expect_no_violations(<<-RUBY)
145
+ expect_no_offenses(<<-RUBY)
146
146
  describe MyClass do
147
147
  subject { MyClass::SubClass }
148
148
  end
@@ -150,7 +150,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
150
150
  end
151
151
 
152
152
  it 'ignores if namespace is not matching' do
153
- expect_no_violations(<<-RUBY)
153
+ expect_no_offenses(<<-RUBY)
154
154
  describe MyNamespace::MyClass do
155
155
  subject { ::MyClass }
156
156
  let(:foo) { MyClass }
@@ -159,7 +159,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
159
159
  end
160
160
 
161
161
  it 'checks for the use of described class with namespace' do
162
- expect_violation(<<-RUBY)
162
+ expect_offense(<<-RUBY)
163
163
  describe MyNamespace::MyClass do
164
164
  subject { MyNamespace::MyClass }
165
165
  ^^^^^^^^^^^^^^^^^^^^ Use `described_class` instead of `MyNamespace::MyClass`.
@@ -168,7 +168,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
168
168
  end
169
169
 
170
170
  it 'does not flag violations within a class scope change' do
171
- expect_no_violations(<<-RUBY)
171
+ expect_no_offenses(<<-RUBY)
172
172
  describe MyNamespace::MyClass do
173
173
  before do
174
174
  class Foo
@@ -180,7 +180,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
180
180
  end
181
181
 
182
182
  it 'does not flag violations within a hook scope change' do
183
- expect_no_violations(<<-RUBY)
183
+ expect_no_offenses(<<-RUBY)
184
184
  describe do
185
185
  before do
186
186
  MyNamespace::MyClass.new
@@ -192,7 +192,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
192
192
  it 'checks for the use of described class with module' do
193
193
  skip
194
194
 
195
- expect_violation(<<-RUBY)
195
+ expect_offense(<<-RUBY)
196
196
  module MyNamespace
197
197
  describe MyClass do
198
198
  subject { MyNamespace::MyClass }
@@ -219,7 +219,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
219
219
  let(:enforced_style) { :explicit }
220
220
 
221
221
  it 'checks for the use of the described_class' do
222
- expect_violation(<<-RUBY)
222
+ expect_offense(<<-RUBY)
223
223
  describe MyClass do
224
224
  include described_class
225
225
  ^^^^^^^^^^^^^^^ Use `MyClass` instead of `described_class`.
@@ -234,7 +234,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
234
234
  end
235
235
 
236
236
  it 'ignores described_class as string' do
237
- expect_no_violations(<<-RUBY)
237
+ expect_no_offenses(<<-RUBY)
238
238
  describe MyClass do
239
239
  subject { "described_class" }
240
240
  end
@@ -242,7 +242,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
242
242
  end
243
243
 
244
244
  it 'ignores describe that do not reference to a class' do
245
- expect_no_violations(<<-RUBY)
245
+ expect_no_offenses(<<-RUBY)
246
246
  describe "MyClass" do
247
247
  subject { described_class }
248
248
  end
@@ -250,7 +250,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
250
250
  end
251
251
 
252
252
  it 'does not flag violations within a class scope change' do
253
- expect_no_violations(<<-RUBY)
253
+ expect_no_offenses(<<-RUBY)
254
254
  describe MyNamespace::MyClass do
255
255
  before do
256
256
  class Foo
@@ -262,7 +262,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
262
262
  end
263
263
 
264
264
  it 'does not flag violations within a hook scope change' do
265
- expect_no_violations(<<-RUBY)
265
+ expect_no_offenses(<<-RUBY)
266
266
  describe do
267
267
  before do
268
268
  described_class.new
@@ -4,7 +4,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyExampleGroup, :config do
4
4
  subject(:cop) { described_class.new(config) }
5
5
 
6
6
  it 'flags an empty context' do
7
- expect_violation(<<-RUBY)
7
+ expect_offense(<<-RUBY)
8
8
  describe Foo do
9
9
  context 'when bar' do
10
10
  ^^^^^^^^^^^^^^^^^^ Empty example group detected.
@@ -24,7 +24,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyExampleGroup, :config do
24
24
  end
25
25
 
26
26
  it 'flags an empty top level describe' do
27
- expect_violation(<<-RUBY)
27
+ expect_offense(<<-RUBY)
28
28
  describe Foo do
29
29
  ^^^^^^^^^^^^ Empty example group detected.
30
30
  end
@@ -32,7 +32,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyExampleGroup, :config do
32
32
  end
33
33
 
34
34
  it 'does not flag include_examples' do
35
- expect_no_violations(<<-RUBY)
35
+ expect_no_offenses(<<-RUBY)
36
36
  describe Foo do
37
37
  context "when something is true" do
38
38
  include_examples "some expectations"
@@ -50,7 +50,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyExampleGroup, :config do
50
50
  end
51
51
 
52
52
  it 'does not recognize custom include methods by default' do
53
- expect_violation(<<-RUBY)
53
+ expect_offense(<<-RUBY)
54
54
  describe Foo do
55
55
  ^^^^^^^^^^^^ Empty example group detected.
56
56
  context "when I do something clever" do
@@ -67,7 +67,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyExampleGroup, :config do
67
67
  end
68
68
 
69
69
  it 'does not flag an otherwise empty example group' do
70
- expect_no_violations(<<-RUBY)
70
+ expect_no_offenses(<<-RUBY)
71
71
  describe Foo do
72
72
  context "when I do something clever" do
73
73
  it_has_special_behavior
@@ -4,7 +4,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterFinalLet do
4
4
  subject(:cop) { described_class.new }
5
5
 
6
6
  it 'checks for empty line after last let' do
7
- expect_violation(<<-RUBY)
7
+ expect_offense(<<-RUBY)
8
8
  RSpec.describe User do
9
9
  let(:a) { a }
10
10
  let(:b) { b }
@@ -15,7 +15,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterFinalLet do
15
15
  end
16
16
 
17
17
  it 'check for empty line after the last `let!`' do
18
- expect_violation(<<-RUBY)
18
+ expect_offense(<<-RUBY)
19
19
  RSpec.describe User do
20
20
  let(:a) { a }
21
21
  let!(:b) do
@@ -28,7 +28,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterFinalLet do
28
28
  end
29
29
 
30
30
  it 'approves empty line after let' do
31
- expect_no_violations(<<-RUBY)
31
+ expect_no_offenses(<<-RUBY)
32
32
  RSpec.describe User do
33
33
  let(:a) { a }
34
34
  let(:b) { b }
@@ -39,7 +39,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterFinalLet do
39
39
  end
40
40
 
41
41
  it 'ignores empty lines between the lets' do
42
- expect_violation(<<-RUBY)
42
+ expect_offense(<<-RUBY)
43
43
  RSpec.describe User do
44
44
  let(:a) { a }
45
45
 
@@ -53,7 +53,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterFinalLet do
53
53
  end
54
54
 
55
55
  it 'handles let in tests' do
56
- expect_no_violations(<<-RUBY)
56
+ expect_no_offenses(<<-RUBY)
57
57
  RSpec.describe User do
58
58
  # This shouldn't really ever happen in a sane codebase but I still
59
59
  # want to avoid false positives
@@ -66,7 +66,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterFinalLet do
66
66
  end
67
67
 
68
68
  it 'handles multiline let block' do
69
- expect_no_violations(<<-RUBY)
69
+ expect_no_offenses(<<-RUBY)
70
70
  RSpec.describe User do
71
71
  let(:a) { a }
72
72
  let(:b) do
@@ -79,7 +79,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterFinalLet do
79
79
  end
80
80
 
81
81
  it 'handles let being the latest node' do
82
- expect_no_violations(<<-RUBY)
82
+ expect_no_offenses(<<-RUBY)
83
83
  RSpec.describe User do
84
84
  let(:a) { a }
85
85
  let(:b) { b }
@@ -88,7 +88,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterFinalLet do
88
88
  end
89
89
 
90
90
  it 'handles HEREDOC for let' do
91
- expect_no_violations(<<-RUBY)
91
+ expect_no_offenses(<<-RUBY)
92
92
  RSpec.describe User do
93
93
  let(:foo) do
94
94
  <<-BAR
@@ -105,7 +105,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterFinalLet do
105
105
  end
106
106
 
107
107
  it 'handles silly HEREDOC syntax for let' do
108
- expect_no_violations(<<-RUBY)
108
+ expect_no_offenses(<<-RUBY)
109
109
  RSpec.describe 'silly heredoc syntax' do
110
110
  let(:foo) { <<-BAR }
111
111
  hello
@@ -4,7 +4,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterSubject do
4
4
  subject(:cop) { described_class.new }
5
5
 
6
6
  it 'checks for empty line after subject' do
7
- expect_violation(<<-RUBY)
7
+ expect_offense(<<-RUBY)
8
8
  RSpec.describe User do
9
9
  subject { described_class.new }
10
10
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add empty line after `subject`.
@@ -14,7 +14,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterSubject do
14
14
  end
15
15
 
16
16
  it 'approves empty line after subject' do
17
- expect_no_violations(<<-RUBY)
17
+ expect_no_offenses(<<-RUBY)
18
18
  RSpec.describe User do
19
19
  subject { described_class.new }
20
20
 
@@ -24,7 +24,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterSubject do
24
24
  end
25
25
 
26
26
  it 'handles subjects in tests' do
27
- expect_no_violations(<<-RUBY)
27
+ expect_no_offenses(<<-RUBY)
28
28
  RSpec.describe User do
29
29
  # This shouldn't really ever happen in a sane codebase but I still
30
30
  # want to avoid false positives
@@ -37,7 +37,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterSubject do
37
37
  end
38
38
 
39
39
  it 'handles multiline subject block' do
40
- expect_no_violations(<<-RUBY)
40
+ expect_no_offenses(<<-RUBY)
41
41
  RSpec.describe User do
42
42
  subject do
43
43
  described_class.new
@@ -49,7 +49,7 @@ RSpec.describe RuboCop::Cop::RSpec::EmptyLineAfterSubject do
49
49
  end
50
50
 
51
51
  it 'handles let being the latest node' do
52
- expect_no_violations(<<-RUBY)
52
+ expect_no_offenses(<<-RUBY)
53
53
  RSpec.describe User do
54
54
  subject { described_user }
55
55
  end
@@ -4,7 +4,7 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleLength, :config do
4
4
  let(:cop_config) { { 'Max' => 3 } }
5
5
 
6
6
  it 'ignores non-spec blocks' do
7
- expect_no_violations(<<-RUBY)
7
+ expect_no_offenses(<<-RUBY)
8
8
  foo do
9
9
  line 1
10
10
  line 2
@@ -15,14 +15,14 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleLength, :config do
15
15
  end
16
16
 
17
17
  it 'allows an empty example' do
18
- expect_no_violations(<<-RUBY)
18
+ expect_no_offenses(<<-RUBY)
19
19
  it do
20
20
  end
21
21
  RUBY
22
22
  end
23
23
 
24
24
  it 'allows a short example' do
25
- expect_no_violations(<<-RUBY)
25
+ expect_no_offenses(<<-RUBY)
26
26
  it do
27
27
  line 1
28
28
  line 2
@@ -32,7 +32,7 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleLength, :config do
32
32
  end
33
33
 
34
34
  it 'ignores comments' do
35
- expect_no_violations(<<-RUBY)
35
+ expect_no_offenses(<<-RUBY)
36
36
  it do
37
37
  line 1
38
38
  line 2
@@ -44,7 +44,7 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleLength, :config do
44
44
 
45
45
  context 'when inspecting large examples' do
46
46
  it 'flags the example' do
47
- expect_violation(<<-RUBY)
47
+ expect_offense(<<-RUBY)
48
48
  it do
49
49
  ^^^^^ Example has too many lines [4/3].
50
50
  line 1
@@ -62,7 +62,7 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleLength, :config do
62
62
  end
63
63
 
64
64
  it 'flags the example' do
65
- expect_violation(<<-RUBY)
65
+ expect_offense(<<-RUBY)
66
66
  it do
67
67
  ^^^^^ Example has too many lines [4/3].
68
68
  line 1
@@ -10,11 +10,11 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleWording, :config do
10
10
  end
11
11
 
12
12
  it 'ignores non-example blocks' do
13
- expect_no_violations('foo "should do something" do; end')
13
+ expect_no_offenses('foo "should do something" do; end')
14
14
  end
15
15
 
16
16
  it 'finds description with `should` at the beginning' do
17
- expect_violation(<<-RUBY)
17
+ expect_offense(<<-RUBY)
18
18
  it 'should do something' do
19
19
  ^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests.
20
20
  end
@@ -22,7 +22,7 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleWording, :config do
22
22
  end
23
23
 
24
24
  it 'finds description with `Should` at the beginning' do
25
- expect_violation(<<-RUBY)
25
+ expect_offense(<<-RUBY)
26
26
  it 'Should do something' do
27
27
  ^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests.
28
28
  end
@@ -30,7 +30,7 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleWording, :config do
30
30
  end
31
31
 
32
32
  it 'finds description with `shouldn\'t` at the beginning' do
33
- expect_violation(<<-RUBY)
33
+ expect_offense(<<-RUBY)
34
34
  it "shouldn't do something" do
35
35
  ^^^^^^^^^^^^^^^^^^^^^^ Do not use should when describing your tests.
36
36
  end
@@ -38,7 +38,7 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleWording, :config do
38
38
  end
39
39
 
40
40
  it 'flags a lone should' do
41
- expect_violation(<<-RUBY)
41
+ expect_offense(<<-RUBY)
42
42
  it 'should' do
43
43
  ^^^^^^ Do not use should when describing your tests.
44
44
  end
@@ -46,7 +46,7 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleWording, :config do
46
46
  end
47
47
 
48
48
  it 'flags a lone should not' do
49
- expect_violation(<<-RUBY)
49
+ expect_offense(<<-RUBY)
50
50
  it 'should not' do
51
51
  ^^^^^^^^^^ Do not use should when describing your tests.
52
52
  end
@@ -54,7 +54,7 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleWording, :config do
54
54
  end
55
55
 
56
56
  it 'finds leading its' do
57
- expect_violation(<<-RUBY)
57
+ expect_offense(<<-RUBY)
58
58
  it "it does something" do
59
59
  ^^^^^^^^^^^^^^^^^ Do not repeat 'it' when describing your tests.
60
60
  end
@@ -62,21 +62,21 @@ RSpec.describe RuboCop::Cop::RSpec::ExampleWording, :config do
62
62
  end
63
63
 
64
64
  it "skips words beginning with 'it'" do
65
- expect_no_violations(<<-RUBY)
65
+ expect_no_offenses(<<-RUBY)
66
66
  it 'itemizes items' do
67
67
  end
68
68
  RUBY
69
69
  end
70
70
 
71
71
  it 'skips descriptions without `should` at the beginning' do
72
- expect_no_violations(<<-RUBY)
72
+ expect_no_offenses(<<-RUBY)
73
73
  it 'finds no should here' do
74
74
  end
75
75
  RUBY
76
76
  end
77
77
 
78
78
  it 'skips descriptions starting with words that begin with `should`' do
79
- expect_no_violations(<<-RUBY)
79
+ expect_no_offenses(<<-RUBY)
80
80
  it 'shoulders the burden' do
81
81
  end
82
82
  RUBY