reek 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +5 -0
  3. data/README.md +13 -2
  4. data/Rakefile +2 -1
  5. data/features/command_line_interface/options.feature +2 -3
  6. data/features/command_line_interface/smell_selection.feature +0 -1
  7. data/features/command_line_interface/smells_count.feature +0 -2
  8. data/features/command_line_interface/stdin.feature +3 -10
  9. data/features/configuration_files/masking_smells.feature +1 -5
  10. data/features/configuration_files/overrides_defaults.feature +0 -1
  11. data/features/rake_task/rake_task.feature +1 -4
  12. data/features/reports/json.feature +73 -0
  13. data/features/reports/reports.feature +0 -3
  14. data/features/reports/yaml.feature +0 -1
  15. data/features/ruby_api/api.feature +0 -1
  16. data/features/samples.feature +0 -4
  17. data/features/step_definitions/reek_steps.rb +14 -4
  18. data/features/support/env.rb +3 -0
  19. data/lib/reek/cli/option_interpreter.rb +2 -0
  20. data/lib/reek/cli/options.rb +3 -3
  21. data/lib/reek/cli/report/formatter.rb +1 -1
  22. data/lib/reek/cli/report/location_formatter.rb +11 -0
  23. data/lib/reek/cli/report/report.rb +11 -2
  24. data/lib/reek/core/code_context.rb +49 -10
  25. data/lib/reek/core/sniffer.rb +2 -2
  26. data/lib/reek/core/{code_parser.rb → tree_walker.rb} +16 -7
  27. data/lib/reek/examiner.rb +0 -39
  28. data/lib/reek/smells.rb +3 -25
  29. data/lib/reek/smells/feature_envy.rb +0 -2
  30. data/lib/reek/smells/smell_detector.rb +0 -6
  31. data/lib/reek/source/sexp_extensions.rb +17 -6
  32. data/lib/reek/source/sexp_node.rb +1 -1
  33. data/lib/reek/spec.rb +66 -0
  34. data/lib/reek/spec/should_reek.rb +0 -6
  35. data/lib/reek/spec/should_reek_of.rb +0 -49
  36. data/lib/reek/spec/should_reek_only_of.rb +0 -11
  37. data/lib/reek/version.rb +6 -1
  38. data/reek.gemspec +3 -2
  39. data/spec/reek/cli/json_report_spec.rb +20 -0
  40. data/spec/reek/core/code_context_spec.rb +6 -0
  41. data/spec/reek/core/smell_configuration_spec.rb +3 -3
  42. data/spec/reek/core/{code_parser_spec.rb → tree_walker_spec.rb} +4 -4
  43. data/spec/reek/examiner_spec.rb +0 -19
  44. data/spec/reek/smells/attribute_spec.rb +6 -9
  45. data/spec/reek/smells/boolean_parameter_spec.rb +13 -15
  46. data/spec/reek/smells/class_variable_spec.rb +17 -17
  47. data/spec/reek/smells/control_parameter_spec.rb +44 -46
  48. data/spec/reek/smells/data_clump_spec.rb +73 -70
  49. data/spec/reek/smells/duplicate_method_call_spec.rb +39 -37
  50. data/spec/reek/smells/feature_envy_spec.rb +53 -57
  51. data/spec/reek/smells/irresponsible_module_spec.rb +12 -11
  52. data/spec/reek/smells/long_parameter_list_spec.rb +33 -26
  53. data/spec/reek/smells/long_yield_list_spec.rb +15 -19
  54. data/spec/reek/smells/module_initialize_spec.rb +4 -6
  55. data/spec/reek/smells/nested_iterators_spec.rb +28 -28
  56. data/spec/reek/smells/nil_check_spec.rb +18 -20
  57. data/spec/reek/smells/prima_donna_method_spec.rb +6 -9
  58. data/spec/reek/smells/repeated_conditional_spec.rb +41 -43
  59. data/spec/reek/smells/too_many_instance_variables_spec.rb +6 -11
  60. data/spec/reek/smells/too_many_methods_spec.rb +44 -61
  61. data/spec/reek/smells/too_many_statements_spec.rb +14 -41
  62. data/spec/reek/smells/uncommunicative_method_name_spec.rb +6 -11
  63. data/spec/reek/smells/uncommunicative_module_name_spec.rb +10 -14
  64. data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +15 -16
  65. data/spec/reek/smells/uncommunicative_variable_name_spec.rb +33 -36
  66. data/spec/reek/smells/unused_parameters_spec.rb +16 -19
  67. data/spec/reek/smells/utility_function_spec.rb +7 -10
  68. metadata +22 -6
@@ -1,12 +1,13 @@
1
1
  require 'spec_helper'
2
+ require 'reek/core/code_context'
2
3
  require 'reek/smells/irresponsible_module'
3
4
  require 'reek/smells/smell_detector_shared'
4
- include Reek::Smells
5
5
 
6
- describe IrresponsibleModule do
6
+ describe Reek::Smells::IrresponsibleModule do
7
7
  before(:each) do
8
8
  @bad_module_name = 'WrongUn'
9
- @detector = IrresponsibleModule.new('yoof')
9
+ @source_name = 'dummy_source'
10
+ @detector = build(:smell_detector, smell_type: :IrresponsibleModule, source: @source_name)
10
11
  end
11
12
 
12
13
  it_should_behave_like 'SmellDetector'
@@ -26,17 +27,17 @@ describe IrresponsibleModule do
26
27
  # test class
27
28
  class Responsible; end
28
29
  EOS
29
- ctx = CodeContext.new(nil, src.to_reek_source.syntax_tree)
30
+ ctx = Reek::Core::CodeContext.new(nil, src.to_reek_source.syntax_tree)
30
31
  expect(@detector.examine_context(ctx)).to be_empty
31
32
  end
32
33
 
33
34
  it 'reports a class without a comment' do
34
35
  src = "class #{@bad_module_name}; end"
35
- ctx = CodeContext.new(nil, src.to_reek_source.syntax_tree)
36
+ ctx = Reek::Core::CodeContext.new(nil, src.to_reek_source.syntax_tree)
36
37
  smells = @detector.examine_context(ctx)
37
38
  expect(smells.length).to eq(1)
38
- expect(smells[0].smell_category).to eq(IrresponsibleModule.smell_category)
39
- expect(smells[0].smell_type).to eq(IrresponsibleModule.smell_type)
39
+ expect(smells[0].smell_category).to eq(Reek::Smells::IrresponsibleModule.smell_category)
40
+ expect(smells[0].smell_type).to eq(Reek::Smells::IrresponsibleModule.smell_type)
40
41
  expect(smells[0].lines).to eq([1])
41
42
  expect(smells[0].parameters[:name]).to eq(@bad_module_name)
42
43
  end
@@ -48,7 +49,7 @@ describe IrresponsibleModule do
48
49
  #
49
50
  class #{@bad_module_name}; end
50
51
  EOS
51
- expect(src).to reek_of IrresponsibleModule
52
+ expect(src).to reek_of :IrresponsibleModule
52
53
  end
53
54
 
54
55
  it 'reports a class with a preceding comment with intermittent material' do
@@ -64,11 +65,11 @@ describe IrresponsibleModule do
64
65
 
65
66
  it 'reports a fq module name correctly' do
66
67
  src = 'class Foo::Bar; end'
67
- ctx = CodeContext.new(nil, src.to_reek_source.syntax_tree)
68
+ ctx = Reek::Core::CodeContext.new(nil, src.to_reek_source.syntax_tree)
68
69
  smells = @detector.examine_context(ctx)
69
70
  expect(smells.length).to eq(1)
70
- expect(smells[0].smell_category).to eq(IrresponsibleModule.smell_category)
71
- expect(smells[0].smell_type).to eq(IrresponsibleModule.smell_type)
71
+ expect(smells[0].smell_category).to eq(described_class.smell_category)
72
+ expect(smells[0].smell_type).to eq(described_class.smell_type)
72
73
  expect(smells[0].parameters[:name]).to eq('Foo::Bar')
73
74
  expect(smells[0].context).to match(/#{smells[0].parameters['name']}/)
74
75
  end
@@ -1,45 +1,49 @@
1
1
  require 'spec_helper'
2
+ require 'reek/core/code_context'
2
3
  require 'reek/smells/long_parameter_list'
3
4
  require 'reek/smells/smell_detector_shared'
4
5
 
5
- include Reek
6
- include Reek::Smells
7
-
8
- describe LongParameterList do
6
+ describe Reek::Smells::LongParameterList do
9
7
  context 'for methods with few parameters' do
10
8
  it 'should report nothing for no parameters' do
11
- expect('def simple; f(3);true; end').not_to reek_of(LongParameterList)
9
+ expect('def simple; f(3);true; end').not_to reek_of(:LongParameterList)
12
10
  end
11
+
13
12
  it 'should report nothing for 1 parameter' do
14
- expect('def simple(yep) f(3);true end').not_to reek_of(LongParameterList)
13
+ expect('def simple(yep) f(3);true end').not_to reek_of(:LongParameterList)
15
14
  end
15
+
16
16
  it 'should report nothing for 2 parameters' do
17
- expect('def simple(yep,zero) f(3);true end').not_to reek_of(LongParameterList)
17
+ expect('def simple(yep,zero) f(3);true end').not_to reek_of(:LongParameterList)
18
18
  end
19
+
19
20
  it 'should not count an optional block' do
20
21
  src = 'def simple(alpha, yep, zero, &opt) f(3); true end'
21
- expect(src).not_to reek_of(LongParameterList)
22
+ expect(src).not_to reek_of(:LongParameterList)
22
23
  end
24
+
23
25
  it 'should not report inner block with too many parameters' do
24
26
  src = '
25
27
  def simple(yep,zero)
26
28
  m[3]; rand(34); f.each { |arga, argb, argc, argd| true}
27
29
  end
28
30
  '
29
- expect(src).not_to reek_of(LongParameterList)
31
+ expect(src).not_to reek_of(:LongParameterList)
30
32
  end
31
33
 
32
34
  describe 'and default values' do
33
35
  it 'should report nothing for 1 parameter' do
34
- expect('def simple(zero=nil) f(3);false end').not_to reek_of(LongParameterList)
36
+ expect('def simple(zero=nil) f(3);false end').not_to reek_of(:LongParameterList)
35
37
  end
38
+
36
39
  it 'should report nothing for 2 parameters with 1 default' do
37
40
  source = 'def simple(yep, zero=nil) f(3); false end'
38
- expect(source).not_to reek_of(LongParameterList)
41
+ expect(source).not_to reek_of(:LongParameterList)
39
42
  end
43
+
40
44
  it 'should report nothing for 2 defaulted parameters' do
41
45
  source = 'def simple(yep=4, zero=nil) f(3); false end'
42
- expect(source).not_to reek_of(LongParameterList)
46
+ expect(source).not_to reek_of(:LongParameterList)
43
47
  end
44
48
  end
45
49
  end
@@ -47,43 +51,45 @@ describe LongParameterList do
47
51
  describe 'for methods with too many parameters' do
48
52
  it 'should report 4 parameters' do
49
53
  src = 'def simple(arga, argb, argc, argd) f(3);true end'
50
- expect(src).to reek_of(LongParameterList, count: 4)
54
+ expect(src).to reek_of(:LongParameterList, count: 4)
51
55
  end
56
+
52
57
  it 'should report 8 parameters' do
53
58
  src = 'def simple(arga, argb, argc, argd,arge, argf, argg, argh) f(3);true end'
54
- expect(src).to reek_of(LongParameterList, count: 8)
59
+ expect(src).to reek_of(:LongParameterList, count: 8)
55
60
  end
56
61
 
57
62
  describe 'and default values' do
58
63
  it 'should report 3 with 1 defaulted' do
59
64
  src = 'def simple(polly, queue, yep, zero=nil) f(3);false end'
60
- expect(src).to reek_of(LongParameterList, count: 4)
65
+ expect(src).to reek_of(:LongParameterList, count: 4)
61
66
  end
67
+
62
68
  it 'should report with 3 defaulted' do
63
69
  src = 'def simple(aarg, polly=2, yep=:truth, zero=nil) f(3);false end'
64
- expect(src).to reek_of(LongParameterList, count: 4)
70
+ expect(src).to reek_of(:LongParameterList, count: 4)
65
71
  end
66
72
  end
67
73
  end
68
74
  end
69
75
 
70
- describe LongParameterList do
76
+ describe Reek::Smells::LongParameterList do
71
77
  before(:each) do
72
- @source_name = 'smokin'
73
- @detector = LongParameterList.new(@source_name)
78
+ @source_name = 'dummy_source'
79
+ @detector = build(:smell_detector, smell_type: :LongParameterList, source: @source_name)
74
80
  end
75
81
 
76
82
  it_should_behave_like 'SmellDetector'
77
83
 
78
84
  context 'when a smell is reported' do
79
85
  before :each do
80
- src = <<EOS
81
- def badguy(arga, argb, argc, argd)
82
- f(3)
83
- true
84
- end
85
- EOS
86
- ctx = CodeContext.new(nil, src.to_reek_source.syntax_tree)
86
+ src = <<-EOS
87
+ def badguy(arga, argb, argc, argd)
88
+ f(3)
89
+ true
90
+ end
91
+ EOS
92
+ ctx = Reek::Core::CodeContext.new(nil, src.to_reek_source.syntax_tree)
87
93
  @smells = @detector.examine_context(ctx)
88
94
  @warning = @smells[0]
89
95
  end
@@ -93,6 +99,7 @@ EOS
93
99
  it 'reports the number of parameters' do
94
100
  expect(@warning.parameters[:count]).to eq(4)
95
101
  end
102
+
96
103
  it 'reports the line number of the method' do
97
104
  expect(@warning.lines).to eq([1])
98
105
  end
@@ -1,16 +1,12 @@
1
1
  require 'spec_helper'
2
+ require 'reek/core/code_context'
2
3
  require 'reek/smells/long_yield_list'
3
4
  require 'reek/smells/smell_detector_shared'
4
5
 
5
- include Reek
6
- include Reek::Smells
7
-
8
- describe LongYieldList do
6
+ describe Reek::Smells::LongYieldList do
9
7
  before(:each) do
10
- @source_name = 'oo la la'
11
- @detector = LongYieldList.new(@source_name)
12
- # SMELL: can't use the default config, because that contains an override,
13
- # which causes the mocked matches?() method to be called twice!!
8
+ @source_name = 'dummy_source'
9
+ @detector = build(:smell_detector, smell_type: :LongYieldList, source: @source_name)
14
10
  end
15
11
 
16
12
  it_should_behave_like 'SmellDetector'
@@ -18,31 +14,31 @@ describe LongYieldList do
18
14
  context 'yield' do
19
15
  it 'should not report yield with no parameters' do
20
16
  src = 'def simple(arga, argb, &blk) f(3);yield; end'
21
- expect(src).not_to reek_of(LongYieldList)
17
+ expect(src).not_to reek_of(:LongYieldList)
22
18
  end
23
19
  it 'should not report yield with few parameters' do
24
20
  src = 'def simple(arga, argb, &blk) f(3);yield a,b; end'
25
- expect(src).not_to reek_of(LongYieldList)
21
+ expect(src).not_to reek_of(:LongYieldList)
26
22
  end
27
23
  it 'should report yield with many parameters' do
28
24
  src = 'def simple(arga, argb, &blk) f(3);yield arga,argb,arga,argb; end'
29
- expect(src).to reek_of(LongYieldList, count: 4)
25
+ expect(src).to reek_of(:LongYieldList, count: 4)
30
26
  end
31
27
  it 'should not report yield of a long expression' do
32
28
  src = 'def simple(arga, argb, &blk) f(3);yield(if @dec then argb else 5+3 end); end'
33
- expect(src).not_to reek_of(LongYieldList)
29
+ expect(src).not_to reek_of(:LongYieldList)
34
30
  end
35
31
  end
36
32
 
37
33
  context 'when a smells is reported' do
38
34
  before :each do
39
- src = <<EOS
40
- def simple(arga, argb, &blk)
41
- f(3)
42
- yield(arga,argb,arga,argb)
43
- end
44
- EOS
45
- ctx = CodeContext.new(nil, src.to_reek_source.syntax_tree)
35
+ src = <<-EOS
36
+ def simple(arga, argb, &blk)
37
+ f(3)
38
+ yield(arga,argb,arga,argb)
39
+ end
40
+ EOS
41
+ ctx = Reek::Core::CodeContext.new(nil, src.to_reek_source.syntax_tree)
46
42
  @smells = @detector.examine_context(ctx)
47
43
  @warning = @smells[0]
48
44
  end
@@ -2,9 +2,7 @@ require 'spec_helper'
2
2
  require 'reek/smells/module_initialize'
3
3
  require 'reek/smells/smell_detector_shared'
4
4
 
5
- include Reek::Smells
6
-
7
- describe ModuleInitialize do
5
+ describe Reek::Smells::ModuleInitialize do
8
6
  context 'module' do
9
7
  context 'with method named initialize' do
10
8
  it 'smells' do
@@ -13,7 +11,7 @@ describe ModuleInitialize do
13
11
  def initialize; end
14
12
  end
15
13
  EOF
16
- expect(src).to reek_of(ModuleInitialize)
14
+ expect(src).to reek_of(:ModuleInitialize)
17
15
  end
18
16
  end
19
17
 
@@ -26,7 +24,7 @@ describe ModuleInitialize do
26
24
  end
27
25
  end
28
26
  EOF
29
- expect(src).not_to reek_of(ModuleInitialize)
27
+ expect(src).not_to reek_of(:ModuleInitialize)
30
28
  end
31
29
  end
32
30
 
@@ -39,7 +37,7 @@ describe ModuleInitialize do
39
37
  end
40
38
  end
41
39
  EOF
42
- expect(src).not_to reek_of(ModuleInitialize)
40
+ expect(src).not_to reek_of(:ModuleInitialize)
43
41
  end
44
42
  end
45
43
  end
@@ -2,26 +2,24 @@ require 'spec_helper'
2
2
  require 'reek/smells/nested_iterators'
3
3
  require 'reek/smells/smell_detector_shared'
4
4
 
5
- include Reek::Smells
6
-
7
- describe NestedIterators do
5
+ describe Reek::Smells::NestedIterators do
8
6
  context 'with no iterators' do
9
7
  it 'reports no smells' do
10
8
  src = 'def fred() nothing = true; end'
11
- expect(src).not_to reek_of(NestedIterators)
9
+ expect(src).not_to reek_of(:NestedIterators)
12
10
  end
13
11
  end
14
12
 
15
13
  context 'with one iterator' do
16
14
  it 'reports no smells' do
17
15
  src = 'def fred() nothing.each {|item| item}; end'
18
- expect(src).not_to reek_of(NestedIterators)
16
+ expect(src).not_to reek_of(:NestedIterators)
19
17
  end
20
18
  end
21
19
 
22
20
  it 'should report nested iterators in a method' do
23
21
  src = 'def bad(fred) @fred.each {|item| item.each {|ting| ting.ting} } end'
24
- expect(src).to reek_of(NestedIterators)
22
+ expect(src).to reek_of(:NestedIterators)
25
23
  end
26
24
 
27
25
  it 'should not report method with successive iterators' do
@@ -31,7 +29,7 @@ describe NestedIterators do
31
29
  @jim.each {|ting| ting.each }
32
30
  end
33
31
  EOS
34
- expect(src).not_to reek_of(NestedIterators)
32
+ expect(src).not_to reek_of(:NestedIterators)
35
33
  end
36
34
 
37
35
  it 'should not report method with chained iterators' do
@@ -40,7 +38,7 @@ describe NestedIterators do
40
38
  @sig.keys.sort_by { |xray| xray.to_s }.each { |min| md5 << min.to_s }
41
39
  end
42
40
  EOS
43
- expect(src).not_to reek_of(NestedIterators)
41
+ expect(src).not_to reek_of(:NestedIterators)
44
42
  end
45
43
 
46
44
  it 'detects an iterator with an empty block' do
@@ -49,7 +47,7 @@ describe NestedIterators do
49
47
  bar { baz { } }
50
48
  end
51
49
  EOS
52
- expect(src).to reek_of(NestedIterators)
50
+ expect(src).to reek_of(:NestedIterators)
53
51
  end
54
52
 
55
53
  it 'should report nested iterators only once per method' do
@@ -59,7 +57,7 @@ describe NestedIterators do
59
57
  @jim.each {|ting| ting.each {|piece| @hal.send} }
60
58
  end
61
59
  EOS
62
- expect(src).to reek_of(NestedIterators)
60
+ expect(src).to reek_of(:NestedIterators)
63
61
  end
64
62
 
65
63
  it 'reports nested iterators only once per method even if levels are different' do
@@ -69,7 +67,7 @@ describe NestedIterators do
69
67
  @jim.each {|ting| ting.each {|piece| piece.each {|atom| atom.foo } } }
70
68
  end
71
69
  EOS
72
- expect(src).to reek_of(NestedIterators)
70
+ expect(src).to reek_of(:NestedIterators)
73
71
  end
74
72
 
75
73
  it 'reports nesting inside iterator arguments' do
@@ -84,7 +82,7 @@ describe NestedIterators do
84
82
  ) { |qux| qux.quuz }
85
83
  end
86
84
  EOS
87
- expect(src).to reek_of(NestedIterators, count: 2)
85
+ expect(src).to reek_of(:NestedIterators, count: 2)
88
86
  end
89
87
 
90
88
  it 'reports the deepest level of nesting only' do
@@ -97,12 +95,13 @@ describe NestedIterators do
97
95
  }
98
96
  end
99
97
  EOS
100
- expect(src).to reek_of(NestedIterators, count: 3)
98
+ expect(src).to reek_of(:NestedIterators, count: 3)
101
99
  end
102
100
 
103
101
  context 'when the allowed nesting depth is 3' do
104
102
  before :each do
105
- @config = { NestedIterators: { NestedIterators::MAX_ALLOWED_NESTING_KEY => 3 } }
103
+ @config = { NestedIterators:
104
+ { Reek::Smells::NestedIterators::MAX_ALLOWED_NESTING_KEY => 3 } }
106
105
  end
107
106
 
108
107
  it 'should not report nested iterators 2 levels deep' do
@@ -113,7 +112,7 @@ describe NestedIterators do
113
112
  EOS
114
113
 
115
114
  with_test_config(@config) do
116
- expect(src).not_to reek_of(NestedIterators)
115
+ expect(src).not_to reek_of(:NestedIterators)
117
116
  end
118
117
  end
119
118
 
@@ -125,7 +124,7 @@ describe NestedIterators do
125
124
  EOS
126
125
 
127
126
  with_test_config(@config) do
128
- expect(src).not_to reek_of(NestedIterators)
127
+ expect(src).not_to reek_of(:NestedIterators)
129
128
  end
130
129
  end
131
130
 
@@ -137,27 +136,28 @@ describe NestedIterators do
137
136
  EOS
138
137
 
139
138
  with_test_config(@config) do
140
- expect(src).to reek_of(NestedIterators)
139
+ expect(src).to reek_of(:NestedIterators)
141
140
  end
142
141
  end
143
142
  end
144
143
 
145
144
  context 'when ignoring iterators' do
146
145
  before :each do
147
- @config = { NestedIterators: { NestedIterators::IGNORE_ITERATORS_KEY => ['ignore_me'] } }
146
+ @config = { NestedIterators:
147
+ { Reek::Smells::NestedIterators::IGNORE_ITERATORS_KEY => ['ignore_me'] } }
148
148
  end
149
149
 
150
150
  it 'should not report nesting the ignored iterator inside another' do
151
151
  src = 'def bad(fred) @fred.each {|item| item.ignore_me {|ting| ting.ting} } end'
152
152
  with_test_config(@config) do
153
- expect(src).not_to reek_of(NestedIterators)
153
+ expect(src).not_to reek_of(:NestedIterators)
154
154
  end
155
155
  end
156
156
 
157
157
  it 'should not report nesting inside the ignored iterator' do
158
158
  src = 'def bad(fred) @fred.ignore_me {|item| item.each {|ting| ting.ting} } end'
159
159
  with_test_config(@config) do
160
- expect(src).not_to reek_of(NestedIterators)
160
+ expect(src).not_to reek_of(:NestedIterators)
161
161
  end
162
162
  end
163
163
 
@@ -168,7 +168,7 @@ describe NestedIterators do
168
168
  end
169
169
  '
170
170
  with_test_config(@config) do
171
- expect(src).to reek_of(NestedIterators, count: 2)
171
+ expect(src).to reek_of(:NestedIterators, count: 2)
172
172
  end
173
173
  end
174
174
 
@@ -179,7 +179,7 @@ describe NestedIterators do
179
179
  end
180
180
  '
181
181
  with_test_config(@config) do
182
- expect(src).to reek_of(NestedIterators, count: 2)
182
+ expect(src).to reek_of(:NestedIterators, count: 2)
183
183
  end
184
184
  end
185
185
 
@@ -190,16 +190,16 @@ describe NestedIterators do
190
190
  end
191
191
  '
192
192
  with_test_config(@config) do
193
- expect(src).to reek_of(NestedIterators, count: 2)
193
+ expect(src).to reek_of(:NestedIterators, count: 2)
194
194
  end
195
195
  end
196
196
  end
197
197
  end
198
198
 
199
- describe NestedIterators do
199
+ describe Reek::Smells::NestedIterators do
200
200
  before(:each) do
201
- @source_name = 'cuckoo'
202
- @detector = NestedIterators.new(@source_name)
201
+ @source_name = 'dummy_source'
202
+ @detector = build(:smell_detector, smell_type: :NestedIterators, source: @source_name)
203
203
  end
204
204
 
205
205
  it_should_behave_like 'SmellDetector'
@@ -213,7 +213,7 @@ describe NestedIterators do
213
213
  end
214
214
  end
215
215
  EOS
216
- ctx = CodeContext.new(nil, src.to_reek_source.syntax_tree)
216
+ ctx = Reek::Core::CodeContext.new(nil, src.to_reek_source.syntax_tree)
217
217
  @warning = @detector.examine_context(ctx)[0]
218
218
  end
219
219
 
@@ -235,7 +235,7 @@ describe NestedIterators do
235
235
  end
236
236
  EOS
237
237
 
238
- ctx = CodeContext.new(nil, src.to_reek_source.syntax_tree)
238
+ ctx = Reek::Core::CodeContext.new(nil, src.to_reek_source.syntax_tree)
239
239
  @warning = @detector.examine_context(ctx)[0]
240
240
  end
241
241