rubocop-rspec 1.15.1 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -3,7 +3,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
3
3
 
4
4
  context 'when no value is yielded' do
5
5
  it 'registers an offense' do
6
- expect_violation(<<-RUBY)
6
+ expect_offense(<<-RUBY)
7
7
  around do
8
8
  ^^^^^^^^^ Test object should be passed to around block.
9
9
  do_something
@@ -14,7 +14,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
14
14
 
15
15
  context 'when the hook is scoped with a symbol' do
16
16
  it 'registers an offense' do
17
- expect_violation(<<-RUBY)
17
+ expect_offense(<<-RUBY)
18
18
  around(:each) do
19
19
  ^^^^^^^^^^^^^^^^ Test object should be passed to around block.
20
20
  do_something
@@ -25,7 +25,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
25
25
 
26
26
  context 'when the yielded value is unused' do
27
27
  it 'registers an offense' do
28
- expect_violation(<<-RUBY)
28
+ expect_offense(<<-RUBY)
29
29
  around do |test|
30
30
  ^^^^ You should call `test.call` or `test.run`.
31
31
  do_something
@@ -36,7 +36,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
36
36
 
37
37
  context 'when two values are yielded and the first is unused' do
38
38
  it 'registers an offense for the first argument' do
39
- expect_violation(<<-RUBY)
39
+ expect_offense(<<-RUBY)
40
40
  around do |test, unused|
41
41
  ^^^^ You should call `test.call` or `test.run`.
42
42
  unused.run
@@ -47,7 +47,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
47
47
 
48
48
  context 'when the yielded value is referenced but not used' do
49
49
  it 'registers an offense' do
50
- expect_violation(<<-RUBY)
50
+ expect_offense(<<-RUBY)
51
51
  around do |test|
52
52
  ^^^^ You should call `test.call` or `test.run`.
53
53
  test
@@ -58,7 +58,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
58
58
 
59
59
  context 'when a method other than #run or #call is called' do
60
60
  it 'registers an offense' do
61
- expect_violation(<<-RUBY)
61
+ expect_offense(<<-RUBY)
62
62
  around do |test|
63
63
  ^^^^ You should call `test.call` or `test.run`.
64
64
  test.inspect
@@ -69,7 +69,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
69
69
 
70
70
  context 'when #run is called' do
71
71
  it 'does not register an offense' do
72
- expect_no_violations(<<-RUBY)
72
+ expect_no_offenses(<<-RUBY)
73
73
  around do |test|
74
74
  test.run
75
75
  end
@@ -79,7 +79,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
79
79
 
80
80
  context 'when #call is called' do
81
81
  it 'does not register an offense' do
82
- expect_no_violations(<<-RUBY)
82
+ expect_no_offenses(<<-RUBY)
83
83
  around do |test|
84
84
  test.call
85
85
  end
@@ -89,7 +89,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
89
89
 
90
90
  context 'when used as a block arg' do
91
91
  it 'does not register an offense' do
92
- expect_no_violations(<<-RUBY)
92
+ expect_no_offenses(<<-RUBY)
93
93
  around do |test|
94
94
  1.times(&test)
95
95
  end
@@ -99,7 +99,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
99
99
 
100
100
  context 'when passed to another method' do
101
101
  it 'does not register an offense' do
102
- expect_no_violations(<<-RUBY)
102
+ expect_no_offenses(<<-RUBY)
103
103
  around do |test|
104
104
  something_that_might_run_test(test, another_arg)
105
105
  end
@@ -109,7 +109,7 @@ RSpec.describe RuboCop::Cop::RSpec::AroundBlock do
109
109
 
110
110
  context 'when yielded to another block' do
111
111
  it 'does not register an offense' do
112
- expect_no_violations(<<-RUBY)
112
+ expect_no_offenses(<<-RUBY)
113
113
  around do |test|
114
114
  foo { yield(some_arg, test) }
115
115
  end
@@ -2,7 +2,7 @@ RSpec.describe RuboCop::Cop::RSpec::BeEql do
2
2
  subject(:cop) { described_class.new }
3
3
 
4
4
  it 'registers an offense for `eql` when argument is a boolean' do
5
- expect_violation(<<-RUBY)
5
+ expect_offense(<<-RUBY)
6
6
  it { expect(foo).to eql(true) }
7
7
  ^^^ Prefer `be` over `eql`.
8
8
  it { expect(foo).to eql(false) }
@@ -11,7 +11,7 @@ RSpec.describe RuboCop::Cop::RSpec::BeEql do
11
11
  end
12
12
 
13
13
  it 'registers an offense for `eql` when argument is an integer' do
14
- expect_violation(<<-RUBY)
14
+ expect_offense(<<-RUBY)
15
15
  it { expect(foo).to eql(0) }
16
16
  ^^^ Prefer `be` over `eql`.
17
17
  it { expect(foo).to eql(123) }
@@ -20,7 +20,7 @@ RSpec.describe RuboCop::Cop::RSpec::BeEql do
20
20
  end
21
21
 
22
22
  it 'registers an offense for `eql` when argument is a float' do
23
- expect_violation(<<-RUBY)
23
+ expect_offense(<<-RUBY)
24
24
  it { expect(foo).to eql(1.0) }
25
25
  ^^^ Prefer `be` over `eql`.
26
26
  it { expect(foo).to eql(1.23) }
@@ -29,27 +29,27 @@ RSpec.describe RuboCop::Cop::RSpec::BeEql do
29
29
  end
30
30
 
31
31
  it 'registers an offense for `eql` when argument is a symbol' do
32
- expect_violation(<<-RUBY)
32
+ expect_offense(<<-RUBY)
33
33
  it { expect(foo).to eql(:foo) }
34
34
  ^^^ Prefer `be` over `eql`.
35
35
  RUBY
36
36
  end
37
37
 
38
38
  it 'registers an offense for `eql` when argument is nil' do
39
- expect_violation(<<-RUBY)
39
+ expect_offense(<<-RUBY)
40
40
  it { expect(foo).to eql(nil) }
41
41
  ^^^ Prefer `be` over `eql`.
42
42
  RUBY
43
43
  end
44
44
 
45
45
  it 'does not register an offense for `eql` when argument is a string' do
46
- expect_no_violations(<<-RUBY)
46
+ expect_no_offenses(<<-RUBY)
47
47
  it { expect(foo).to eql('foo') }
48
48
  RUBY
49
49
  end
50
50
 
51
51
  it 'does not register an offense for `eql` when expectation is negated' do
52
- expect_no_violations(<<-RUBY)
52
+ expect_no_offenses(<<-RUBY)
53
53
  it { expect(foo).to_not eql(1) }
54
54
  RUBY
55
55
  end
@@ -10,7 +10,7 @@ RSpec.describe RuboCop::Cop::RSpec::BeforeAfterAll, :config do
10
10
 
11
11
  context 'when using before all' do
12
12
  it 'registers an offense' do
13
- expect_violation(<<-RUBY)
13
+ expect_offense(<<-RUBY)
14
14
  before(:all) { do_something }
15
15
  ^^^^^^^^^^^^ #{message('before(:all)')}
16
16
  before(:context) { do_something }
@@ -21,7 +21,7 @@ RSpec.describe RuboCop::Cop::RSpec::BeforeAfterAll, :config do
21
21
 
22
22
  context 'when using after all' do
23
23
  it 'registers an offense' do
24
- expect_violation(<<-RUBY)
24
+ expect_offense(<<-RUBY)
25
25
  after(:all) { do_something }
26
26
  ^^^^^^^^^^^ #{message('after(:all)')}
27
27
  after(:context) { do_something }
@@ -32,7 +32,7 @@ RSpec.describe RuboCop::Cop::RSpec::BeforeAfterAll, :config do
32
32
 
33
33
  context 'when using before each' do
34
34
  it 'does not register an offense' do
35
- expect_no_violations(<<-RUBY)
35
+ expect_no_offenses(<<-RUBY)
36
36
  before(:each) { do_something }
37
37
  before(:example) { do_something }
38
38
  RUBY
@@ -41,7 +41,7 @@ RSpec.describe RuboCop::Cop::RSpec::BeforeAfterAll, :config do
41
41
 
42
42
  context 'when using after each' do
43
43
  it 'does not register an offense' do
44
- expect_no_violations(<<-RUBY)
44
+ expect_no_offenses(<<-RUBY)
45
45
  after(:each) { do_something }
46
46
  after(:example) { do_something }
47
47
  RUBY
@@ -38,14 +38,14 @@ RSpec.describe RuboCop::Cop::RSpec::Cop do
38
38
 
39
39
  context 'when the source path ends with `_spec.rb`' do
40
40
  it 'registers an offense' do
41
- expect_violation(<<-RUBY, filename: 'foo_spec.rb')
41
+ expect_offense(<<-RUBY, 'foo_spec.rb')
42
42
  foo(1)
43
43
  ^^^^^^ I flag everything
44
44
  RUBY
45
45
  end
46
46
 
47
47
  it 'ignores the file if it is ignored' do
48
- expect_no_violations(<<-RUBY, filename: 'bar_spec.rb')
48
+ expect_no_offenses(<<-RUBY, 'bar_spec.rb')
49
49
  foo(1)
50
50
  RUBY
51
51
  end
@@ -53,7 +53,7 @@ RSpec.describe RuboCop::Cop::RSpec::Cop do
53
53
 
54
54
  context 'when the source path contains `/spec/`' do
55
55
  it 'registers an offense' do
56
- expect_violation(<<-RUBY, filename: '/spec/support/thing.rb')
56
+ expect_offense(<<-RUBY, '/spec/support/thing.rb')
57
57
  foo(1)
58
58
  ^^^^^^ I flag everything
59
59
  RUBY
@@ -62,7 +62,7 @@ RSpec.describe RuboCop::Cop::RSpec::Cop do
62
62
 
63
63
  context 'when the source path starts with `spec/`' do
64
64
  it 'registers an offense' do
65
- expect_violation(<<-RUBY, filename: 'spec/support/thing.rb')
65
+ expect_offense(<<-RUBY, 'spec/support/thing.rb')
66
66
  foo(1)
67
67
  ^^^^^^ I flag everything
68
68
  RUBY
@@ -71,13 +71,13 @@ RSpec.describe RuboCop::Cop::RSpec::Cop do
71
71
 
72
72
  context 'when the file is a source file without "spec" in the name' do
73
73
  it 'ignores the source when the path is not a spec file' do
74
- expect_no_violations(<<-RUBY, filename: 'foo.rb')
74
+ expect_no_offenses(<<-RUBY, 'foo.rb')
75
75
  foo(1)
76
76
  RUBY
77
77
  end
78
78
 
79
79
  it 'ignores the source when the path is not a specified pattern' do
80
- expect_no_violations(<<-RUBY, filename: 'foo_test.rb')
80
+ expect_no_offenses(<<-RUBY, 'foo_test.rb')
81
81
  foo(1)
82
82
  RUBY
83
83
  end
@@ -89,7 +89,7 @@ RSpec.describe RuboCop::Cop::RSpec::Cop do
89
89
  end
90
90
 
91
91
  it 'registers offenses when the path matches a custom specified pattern' do
92
- expect_violation(<<-RUBY, filename: 'foo_test.rb')
92
+ expect_offense(<<-RUBY, 'foo_test.rb')
93
93
  foo(1)
94
94
  ^^^^^^ I flag everything
95
95
  RUBY
@@ -2,7 +2,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeClass do
2
2
  subject(:cop) { described_class.new }
3
3
 
4
4
  it 'checks first-line describe statements' do
5
- expect_violation(<<-RUBY)
5
+ expect_offense(<<-RUBY)
6
6
  describe "bad describe" do
7
7
  ^^^^^^^^^^^^^^ The first argument to describe should be the class or module being tested.
8
8
  end
@@ -10,14 +10,14 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeClass do
10
10
  end
11
11
 
12
12
  it 'supports RSpec.describe' do
13
- expect_no_violations(<<-RUBY)
13
+ expect_no_offenses(<<-RUBY)
14
14
  RSpec.describe Foo do
15
15
  end
16
16
  RUBY
17
17
  end
18
18
 
19
19
  it 'checks describe statements after a require' do
20
- expect_violation(<<-RUBY)
20
+ expect_offense(<<-RUBY)
21
21
  require 'spec_helper'
22
22
  describe "bad describe" do
23
23
  ^^^^^^^^^^^^^^ The first argument to describe should be the class or module being tested.
@@ -26,7 +26,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeClass do
26
26
  end
27
27
 
28
28
  it 'checks highlights the first argument of a describe' do
29
- expect_violation(<<-RUBY)
29
+ expect_offense(<<-RUBY)
30
30
  describe "bad describe", "blah blah" do
31
31
  ^^^^^^^^^^^^^^ The first argument to describe should be the class or module being tested.
32
32
  end
@@ -34,7 +34,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeClass do
34
34
  end
35
35
 
36
36
  it 'ignores nested describe statements' do
37
- expect_no_violations(<<-RUBY)
37
+ expect_no_offenses(<<-RUBY)
38
38
  describe Some::Class do
39
39
  describe "bad describe" do
40
40
  end
@@ -43,28 +43,28 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeClass do
43
43
  end
44
44
 
45
45
  it 'ignores request specs' do
46
- expect_no_violations(<<-RUBY)
46
+ expect_no_offenses(<<-RUBY)
47
47
  describe 'my new feature', type: :request do
48
48
  end
49
49
  RUBY
50
50
  end
51
51
 
52
52
  it 'ignores feature specs' do
53
- expect_no_violations(<<-RUBY)
53
+ expect_no_offenses(<<-RUBY)
54
54
  describe 'my new feature', type: :feature do
55
55
  end
56
56
  RUBY
57
57
  end
58
58
 
59
59
  it 'ignores feature specs when RSpec.describe is used' do
60
- expect_no_violations(<<-RUBY)
60
+ expect_no_offenses(<<-RUBY)
61
61
  RSpec.describe 'my new feature', type: :feature do
62
62
  end
63
63
  RUBY
64
64
  end
65
65
 
66
66
  it 'flags specs with non :type metadata' do
67
- expect_violation(<<-RUBY)
67
+ expect_offense(<<-RUBY)
68
68
  describe 'my new feature', foo: :feature do
69
69
  ^^^^^^^^^^^^^^^^ The first argument to describe should be the class or module being tested.
70
70
  end
@@ -72,7 +72,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeClass do
72
72
  end
73
73
 
74
74
  it 'flags normal metadata in describe' do
75
- expect_violation(<<-RUBY)
75
+ expect_offense(<<-RUBY)
76
76
  describe 'my new feature', blah, type: :wow do
77
77
  ^^^^^^^^^^^^^^^^ The first argument to describe should be the class or module being tested.
78
78
  end
@@ -80,39 +80,39 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeClass do
80
80
  end
81
81
 
82
82
  it 'ignores feature specs - also with complex options' do
83
- expect_no_violations(<<-RUBY)
83
+ expect_no_offenses(<<-RUBY)
84
84
  describe 'my new feature', :test, :type => :feature, :foo => :bar do
85
85
  end
86
86
  RUBY
87
87
  end
88
88
 
89
89
  it 'ignores an empty describe' do
90
- expect_no_violations(<<-RUBY)
90
+ expect_no_offenses(<<-RUBY)
91
91
  describe do
92
92
  end
93
93
  RUBY
94
94
  end
95
95
 
96
96
  it 'ignores routing specs' do
97
- expect_no_violations(<<-RUBY)
97
+ expect_no_offenses(<<-RUBY)
98
98
  describe 'my new route', type: :routing do
99
99
  end
100
100
  RUBY
101
101
  end
102
102
 
103
103
  it 'ignores view specs' do
104
- expect_no_violations(<<-RUBY)
104
+ expect_no_offenses(<<-RUBY)
105
105
  describe 'widgets/index', type: :view do
106
106
  end
107
107
  RUBY
108
108
  end
109
109
 
110
110
  it "doesn't blow up on single-line describes" do
111
- expect_no_violations('describe Some::Class')
111
+ expect_no_offenses('describe Some::Class')
112
112
  end
113
113
 
114
114
  it "doesn't flag top level describe in a shared example" do
115
- expect_no_violations(<<-RUBY)
115
+ expect_no_offenses(<<-RUBY)
116
116
  shared_examples 'Common::Interface' do
117
117
  describe '#public_interface' do
118
118
  it 'conforms to interface' do
@@ -124,7 +124,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeClass do
124
124
  end
125
125
 
126
126
  it "doesn't flag top level describe in a shared context" do
127
- expect_no_violations(<<-RUBY)
127
+ expect_no_offenses(<<-RUBY)
128
128
  RSpec.shared_context 'Common::Interface' do
129
129
  describe '#public_interface' do
130
130
  it 'conforms to interface' do
@@ -136,7 +136,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeClass do
136
136
  end
137
137
 
138
138
  it "doesn't flag top level describe in an unnamed shared context" do
139
- expect_no_violations(<<-RUBY)
139
+ expect_no_offenses(<<-RUBY)
140
140
  shared_context do
141
141
  describe '#public_interface' do
142
142
  it 'conforms to interface' do
@@ -2,11 +2,11 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeMethod do
2
2
  subject(:cop) { described_class.new }
3
3
 
4
4
  it 'ignores describes with only a class' do
5
- expect_no_violations('describe Some::Class do; end')
5
+ expect_no_offenses('describe Some::Class do; end')
6
6
  end
7
7
 
8
8
  it 'enforces non-method names' do
9
- expect_violation(<<-RUBY)
9
+ expect_offense(<<-RUBY)
10
10
  describe Some::Class, 'nope', '.incorrect_usage' do
11
11
  ^^^^^^ The second argument to describe should be the method being tested. '#instance' or '.class'.
12
12
  end
@@ -14,7 +14,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeMethod do
14
14
  end
15
15
 
16
16
  it 'skips methods starting with a . or #' do
17
- expect_no_violations(<<-RUBY)
17
+ expect_no_offenses(<<-RUBY)
18
18
  describe Some::Class, '.asdf' do
19
19
  end
20
20
 
@@ -24,7 +24,7 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeMethod do
24
24
  end
25
25
 
26
26
  it 'skips specs not having a string second argument' do
27
- expect_no_violations(<<-RUBY)
27
+ expect_no_offenses(<<-RUBY)
28
28
  describe Some::Class, :config do
29
29
  end
30
30
  RUBY
@@ -2,28 +2,28 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeSymbol do
2
2
  subject(:cop) { described_class.new }
3
3
 
4
4
  it 'flags violations for `describe :symbol`' do
5
- expect_violation(<<-RUBY)
5
+ expect_offense(<<-RUBY)
6
6
  describe(:some_method) { }
7
7
  ^^^^^^^^^^^^ Avoid describing symbols.
8
8
  RUBY
9
9
  end
10
10
 
11
11
  it 'flags violations for `describe :symbol` with multiple arguments' do
12
- expect_violation(<<-RUBY)
12
+ expect_offense(<<-RUBY)
13
13
  describe(:some_method, "description") { }
14
14
  ^^^^^^^^^^^^ Avoid describing symbols.
15
15
  RUBY
16
16
  end
17
17
 
18
18
  it 'flags violations for `RSpec.describe :symbol`' do
19
- expect_violation(<<-RUBY)
19
+ expect_offense(<<-RUBY)
20
20
  RSpec.describe(:some_method, "description") { }
21
21
  ^^^^^^^^^^^^ Avoid describing symbols.
22
22
  RUBY
23
23
  end
24
24
 
25
25
  it 'flags violations for a nested `describe`' do
26
- expect_violation(<<-RUBY)
26
+ expect_offense(<<-RUBY)
27
27
  RSpec.describe Foo do
28
28
  describe :to_s do
29
29
  ^^^^^ Avoid describing symbols.
@@ -33,10 +33,10 @@ RSpec.describe RuboCop::Cop::RSpec::DescribeSymbol do
33
33
  end
34
34
 
35
35
  it 'does not flag non-Symbol arguments' do
36
- expect_no_violations('describe("#some_method") { }')
36
+ expect_no_offenses('describe("#some_method") { }')
37
37
  end
38
38
 
39
39
  it 'does not flag `context :symbol`' do
40
- expect_no_violations('context(:some_method) { }')
40
+ expect_no_offenses('context(:some_method) { }')
41
41
  end
42
42
  end