tailor 1.4.0 → 1.4.1

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -3
  3. data/Gemfile.lock +39 -31
  4. data/History.md +220 -207
  5. data/README.md +58 -45
  6. data/features/step_definitions/indentation_steps.rb +1 -1
  7. data/lib/tailor/reporter.rb +19 -7
  8. data/lib/tailor/rulers/spaces_before_lbrace_ruler.rb +0 -1
  9. data/lib/tailor/rulers/spaces_before_rbrace_ruler.rb +0 -1
  10. data/lib/tailor/rulers/spaces_in_empty_braces_ruler.rb +0 -1
  11. data/lib/tailor/version.rb +1 -1
  12. data/spec/functional/conditional_parentheses_spec.rb +1 -1
  13. data/spec/functional/conditional_spacing_spec.rb +1 -1
  14. data/spec/functional/configuration_spec.rb +61 -52
  15. data/spec/functional/horizontal_spacing/braces_spec.rb +134 -134
  16. data/spec/functional/horizontal_spacing/brackets_spec.rb +34 -36
  17. data/spec/functional/horizontal_spacing/comma_spacing_spec.rb +25 -27
  18. data/spec/functional/horizontal_spacing/hard_tabs_spec.rb +42 -42
  19. data/spec/functional/horizontal_spacing/long_lines_spec.rb +15 -17
  20. data/spec/functional/horizontal_spacing/long_methods_spec.rb +4 -4
  21. data/spec/functional/horizontal_spacing/parens_spec.rb +45 -45
  22. data/spec/functional/horizontal_spacing/trailing_whitespace_spec.rb +7 -8
  23. data/spec/functional/horizontal_spacing_spec.rb +10 -11
  24. data/spec/functional/indentation_spacing/argument_alignment_spec.rb +33 -62
  25. data/spec/functional/indentation_spacing/bad_indentation_spec.rb +176 -179
  26. data/spec/functional/indentation_spacing_spec.rb +13 -14
  27. data/spec/functional/naming/camel_case_methods_spec.rb +4 -6
  28. data/spec/functional/naming/screaming_snake_case_classes_spec.rb +28 -31
  29. data/spec/functional/naming_spec.rb +3 -3
  30. data/spec/functional/rake_task_spec.rb +9 -28
  31. data/spec/functional/string_interpolation_spec.rb +1 -1
  32. data/spec/functional/string_quoting_spec.rb +1 -1
  33. data/spec/functional/vertical_spacing/class_length_spec.rb +4 -6
  34. data/spec/functional/vertical_spacing/method_length_spec.rb +15 -17
  35. data/spec/functional/vertical_spacing_spec.rb +3 -3
  36. data/spec/spec_helper.rb +2 -0
  37. data/spec/support/argument_alignment_cases.rb +32 -32
  38. data/spec/support/conditional_parentheses_cases.rb +26 -26
  39. data/spec/support/good_indentation_cases.rb +205 -205
  40. data/spec/support/horizontal_spacing_cases.rb +53 -54
  41. data/spec/support/line_indentation_cases.rb +20 -20
  42. data/spec/support/naming_cases.rb +12 -12
  43. data/spec/support/string_interpolation_cases.rb +17 -17
  44. data/spec/support/string_quoting_cases.rb +12 -12
  45. data/spec/support/vertical_spacing_cases.rb +8 -8
  46. data/spec/unit/tailor/cli/options_spec.rb +20 -14
  47. data/spec/unit/tailor/cli_spec.rb +29 -43
  48. data/spec/unit/tailor/composite_observable_spec.rb +1 -1
  49. data/spec/unit/tailor/configuration/file_set_spec.rb +10 -11
  50. data/spec/unit/tailor/configuration/style_spec.rb +41 -42
  51. data/spec/unit/tailor/configuration_spec.rb +14 -12
  52. data/spec/unit/tailor/formatter_spec.rb +3 -3
  53. data/spec/unit/tailor/formatters/yaml_spec.rb +12 -13
  54. data/spec/unit/tailor/lexed_line_spec.rb +67 -69
  55. data/spec/unit/tailor/lexer/token_spec.rb +7 -7
  56. data/spec/unit/tailor/lexer_spec.rb +24 -24
  57. data/spec/unit/tailor/problem_spec.rb +12 -12
  58. data/spec/unit/tailor/reporter_spec.rb +8 -9
  59. data/spec/unit/tailor/ruler_spec.rb +10 -10
  60. data/spec/unit/tailor/rulers/indentation_spaces_ruler/indentation_manager_spec.rb +90 -86
  61. data/spec/unit/tailor/rulers/indentation_spaces_ruler_spec.rb +13 -13
  62. data/spec/unit/tailor/rulers/spaces_after_comma_ruler_spec.rb +4 -4
  63. data/spec/unit/tailor/rulers/spaces_after_lbrace_ruler_spec.rb +19 -19
  64. data/spec/unit/tailor/rulers/spaces_before_lbrace_ruler_spec.rb +6 -6
  65. data/spec/unit/tailor/rulers/spaces_before_rbrace_ruler_spec.rb +6 -6
  66. data/spec/unit/tailor/rulers_spec.rb +1 -1
  67. data/spec/unit/tailor/version_spec.rb +1 -2
  68. data/spec/unit/tailor_spec.rb +2 -2
  69. data/tailor.gemspec +3 -3
  70. metadata +20 -6
@@ -2,24 +2,22 @@ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
  require 'tailor/configuration/style'
4
4
 
5
-
6
5
  COMMA_SPACING = {}
7
- COMMA_SPACING['no_space_after_comma'] = %Q{[1,2]}
8
- COMMA_SPACING['two_spaces_after_comma'] = %Q{[1, 2]}
9
- COMMA_SPACING['one_space_before_comma'] = %Q{[1 , 2]}
10
- COMMA_SPACING['two_spaces_before_comma'] = %Q{[1 , 2]}
11
- COMMA_SPACING['two_spaces_before_comma_twice'] = %Q{[1 , 2 , 3]}
12
- COMMA_SPACING['two_spaces_after_comma_twice'] = %Q{[1, 2, 3]}
6
+ COMMA_SPACING['no_space_after_comma'] = %([1,2])
7
+ COMMA_SPACING['two_spaces_after_comma'] = %([1, 2])
8
+ COMMA_SPACING['one_space_before_comma'] = %([1 , 2])
9
+ COMMA_SPACING['two_spaces_before_comma'] = %([1 , 2])
10
+ COMMA_SPACING['two_spaces_before_comma_twice'] = %([1 , 2 , 3])
11
+ COMMA_SPACING['two_spaces_after_comma_twice'] = %([1, 2, 3])
13
12
 
14
- COMMA_SPACING['spaces_before_with_trailing_comments'] = %Q{[
13
+ COMMA_SPACING['spaces_before_with_trailing_comments'] = %([
15
14
  1 , # Comment!
16
15
  2 , # Another comment.
17
- }
18
-
16
+ )
19
17
 
20
18
  describe 'Spacing around comma detection' do
21
19
  before do
22
- Tailor::Logger.stub(:log)
20
+ allow(Tailor::Logger).to receive(:log)
23
21
  FakeFS.activate!
24
22
  File.open(file_name, 'w') { |f| f.write contents }
25
23
  critic.check_file(file_name, style.to_hash)
@@ -29,7 +27,7 @@ describe 'Spacing around comma detection' do
29
27
  Tailor::Critic.new
30
28
  end
31
29
 
32
- let(:contents) { COMMA_SPACING[file_name]}
30
+ let(:contents) { COMMA_SPACING[file_name] }
33
31
 
34
32
  let(:style) do
35
33
  style = Tailor::Configuration::Style.new
@@ -41,28 +39,28 @@ describe 'Spacing around comma detection' do
41
39
 
42
40
  context 'no space after a comma' do
43
41
  let(:file_name) { 'no_space_after_comma' }
44
- specify { critic.problems[file_name].size.should be 1 }
45
- specify { critic.problems[file_name].first[:type].should == 'spaces_after_comma' }
46
- specify { critic.problems[file_name].first[:line].should be 1 }
47
- specify { critic.problems[file_name].first[:column].should be 3 }
48
- specify { critic.problems[file_name].first[:level].should be :error }
42
+ specify { expect(critic.problems[file_name].size).to eq 1 }
43
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'spaces_after_comma' }
44
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
45
+ specify { expect(critic.problems[file_name].first[:column]).to eq 3 }
46
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
49
47
  end
50
48
 
51
49
  context 'two spaces after a comma' do
52
50
  let(:file_name) { 'two_spaces_after_comma' }
53
- specify { critic.problems[file_name].size.should be 1 }
54
- specify { critic.problems[file_name].first[:type].should == 'spaces_after_comma' }
55
- specify { critic.problems[file_name].first[:line].should be 1 }
56
- specify { critic.problems[file_name].first[:column].should be 3 }
57
- specify { critic.problems[file_name].first[:level].should be :error }
51
+ specify { expect(critic.problems[file_name].size).to eq 1 }
52
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'spaces_after_comma' }
53
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
54
+ specify { expect(critic.problems[file_name].first[:column]).to eq 3 }
55
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
58
56
  end
59
57
 
60
58
  context 'one space before comma' do
61
59
  let(:file_name) { 'one_space_before_comma' }
62
- specify { critic.problems[file_name].size.should be 1 }
63
- specify { critic.problems[file_name].first[:type].should == 'spaces_before_comma' }
64
- specify { critic.problems[file_name].first[:line].should be 1 }
65
- specify { critic.problems[file_name].first[:column].should be 2 }
66
- specify { critic.problems[file_name].first[:level].should be :error }
60
+ specify { expect(critic.problems[file_name].size).to eq 1 }
61
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'spaces_before_comma' }
62
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
63
+ specify { expect(critic.problems[file_name].first[:column]).to eq 2 }
64
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
67
65
  end
68
66
  end
@@ -8,16 +8,16 @@ require 'tailor/configuration/style'
8
8
  HARD_TABS = {}
9
9
 
10
10
  HARD_TABS['hard_tab'] =
11
- %Q{def something
11
+ %(def something
12
12
  \tputs 'something'
13
- end}
13
+ end)
14
14
 
15
15
  HARD_TABS['hard_tab_with_spaces'] =
16
- %Q{class Thing
16
+ %(class Thing
17
17
  def something
18
18
  \t puts 'something'
19
19
  end
20
- end}
20
+ end)
21
21
 
22
22
  # This only reports the hard tab problem (and not the indentation problem)
23
23
  # because a hard tab is counted as 1 space; here, this is 4 spaces, so it
@@ -25,22 +25,22 @@ end}
25
25
  # hard tab should signal the problem. If you fix the hard tab and don't
26
26
  # fix indentation, tailor will flag you on the indentation on the next run.
27
27
  HARD_TABS['hard_tab_with_1_indented_space'] =
28
- %Q{class Thing
28
+ %(class Thing
29
29
  def something
30
30
  \t puts 'something'
31
31
  end
32
- end}
32
+ end)
33
33
 
34
34
  HARD_TABS['hard_tab_with_2_indented_spaces'] =
35
- %Q{class Thing
35
+ %(class Thing
36
36
  def something
37
37
  \t puts 'something'
38
38
  end
39
- end}
39
+ end)
40
40
 
41
41
  describe 'Hard tab detection' do
42
42
  before do
43
- Tailor::Logger.stub(:log)
43
+ allow(Tailor::Logger).to receive(:log)
44
44
  FakeFS.activate!
45
45
  File.open(file_name, 'w') { |f| f.write contents }
46
46
  critic.check_file(file_name, style.to_hash)
@@ -50,7 +50,7 @@ describe 'Hard tab detection' do
50
50
  Tailor::Critic.new
51
51
  end
52
52
 
53
- let(:contents) { HARD_TABS[file_name]}
53
+ let(:contents) { HARD_TABS[file_name] }
54
54
 
55
55
  let(:style) do
56
56
  style = Tailor::Configuration::Style.new
@@ -62,49 +62,49 @@ describe 'Hard tab detection' do
62
62
 
63
63
  context '1 hard tab' do
64
64
  let(:file_name) { 'hard_tab' }
65
- specify { critic.problems[file_name].size.should be 2 }
66
- specify { critic.problems[file_name].first[:type].should == 'allow_hard_tabs' }
67
- specify { critic.problems[file_name].first[:line].should be 2 }
68
- specify { critic.problems[file_name].first[:column].should be 0 }
69
- specify { critic.problems[file_name].first[:level].should be :error }
70
- specify { critic.problems[file_name].last[:type].should == 'indentation_spaces' }
71
- specify { critic.problems[file_name].last[:line].should be 2 }
72
- specify { critic.problems[file_name].last[:column].should be 1 }
73
- specify { critic.problems[file_name].last[:level].should be :error }
65
+ specify { expect(critic.problems[file_name].size).to eq 2 }
66
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'allow_hard_tabs' }
67
+ specify { expect(critic.problems[file_name].first[:line]).to eq 2 }
68
+ specify { expect(critic.problems[file_name].first[:column]).to eq 0 }
69
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
70
+ specify { expect(critic.problems[file_name].last[:type]).to eq 'indentation_spaces' }
71
+ specify { expect(critic.problems[file_name].last[:line]).to eq 2 }
72
+ specify { expect(critic.problems[file_name].last[:column]).to eq 1 }
73
+ specify { expect(critic.problems[file_name].last[:level]).to eq :error }
74
74
  end
75
75
 
76
76
  context '1 hard tab with 2 spaces after it' do
77
77
  let(:file_name) { 'hard_tab_with_spaces' }
78
- specify { critic.problems[file_name].size.should be 2 }
79
- specify { critic.problems[file_name].first[:type].should == 'allow_hard_tabs' }
80
- specify { critic.problems[file_name].first[:line].should be 3 }
81
- specify { critic.problems[file_name].first[:column].should be 0 }
82
- specify { critic.problems[file_name].first[:level].should be :error }
83
- specify { critic.problems[file_name].last[:type].should == 'indentation_spaces' }
84
- specify { critic.problems[file_name].last[:line].should be 3 }
85
- specify { critic.problems[file_name].last[:column].should be 3 }
86
- specify { critic.problems[file_name].last[:level].should be :error }
78
+ specify { expect(critic.problems[file_name].size).to eq 2 }
79
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'allow_hard_tabs' }
80
+ specify { expect(critic.problems[file_name].first[:line]).to eq 3 }
81
+ specify { expect(critic.problems[file_name].first[:column]).to eq 0 }
82
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
83
+ specify { expect(critic.problems[file_name].last[:type]).to eq 'indentation_spaces' }
84
+ specify { expect(critic.problems[file_name].last[:line]).to eq 3 }
85
+ specify { expect(critic.problems[file_name].last[:column]).to eq 3 }
86
+ specify { expect(critic.problems[file_name].last[:level]).to eq :error }
87
87
  end
88
88
 
89
89
  context '1 hard tab with 3 spaces after it' do
90
90
  let(:file_name) { 'hard_tab_with_1_indented_space' }
91
- specify { critic.problems[file_name].size.should be 1 }
92
- specify { critic.problems[file_name].first[:type].should == 'allow_hard_tabs' }
93
- specify { critic.problems[file_name].first[:line].should be 3 }
94
- specify { critic.problems[file_name].first[:column].should be 0 }
95
- specify { critic.problems[file_name].first[:level].should be :error }
91
+ specify { expect(critic.problems[file_name].size).to eq 1 }
92
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'allow_hard_tabs' }
93
+ specify { expect(critic.problems[file_name].first[:line]).to eq 3 }
94
+ specify { expect(critic.problems[file_name].first[:column]).to eq 0 }
95
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
96
96
  end
97
97
 
98
98
  context '1 hard tab with 4 spaces after it' do
99
99
  let(:file_name) { 'hard_tab_with_2_indented_spaces' }
100
- specify { critic.problems[file_name].size.should be 2 }
101
- specify { critic.problems[file_name].first[:type].should == 'allow_hard_tabs' }
102
- specify { critic.problems[file_name].first[:line].should be 3 }
103
- specify { critic.problems[file_name].first[:column].should be 0 }
104
- specify { critic.problems[file_name].first[:level].should be :error }
105
- specify { critic.problems[file_name].last[:type].should == 'indentation_spaces' }
106
- specify { critic.problems[file_name].last[:line].should be 3 }
107
- specify { critic.problems[file_name].last[:column].should be 5 }
108
- specify { critic.problems[file_name].last[:level].should be :error }
100
+ specify { expect(critic.problems[file_name].size).to eq 2 }
101
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'allow_hard_tabs' }
102
+ specify { expect(critic.problems[file_name].first[:line]).to eq 3 }
103
+ specify { expect(critic.problems[file_name].first[:column]).to eq 0 }
104
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
105
+ specify { expect(critic.problems[file_name].last[:type]).to eq 'indentation_spaces' }
106
+ specify { expect(critic.problems[file_name].last[:line]).to eq 3 }
107
+ specify { expect(critic.problems[file_name].last[:column]).to eq 5 }
108
+ specify { expect(critic.problems[file_name].last[:level]).to eq :error }
109
109
  end
110
110
  end
@@ -2,16 +2,14 @@ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
  require 'tailor/configuration/style'
4
4
 
5
-
6
5
  LONG_LINE = {}
7
- LONG_LINE['long_line_no_newline'] = %Q{'#{'#' * 79}'}
8
- LONG_LINE['long_line_newline_at_82'] = %Q{'#{'#' * 79}'
9
- }
10
-
6
+ LONG_LINE['long_line_no_newline'] = %('#{'#' * 79}')
7
+ LONG_LINE['long_line_newline_at_82'] = %('#{'#' * 79}'
8
+ )
11
9
 
12
10
  describe 'Long line detection' do
13
11
  before do
14
- Tailor::Logger.stub(:log)
12
+ allow(Tailor::Logger).to receive(:log)
15
13
  FakeFS.activate!
16
14
  File.open(file_name, 'w') { |f| f.write contents }
17
15
  critic.check_file(file_name, style.to_hash)
@@ -21,7 +19,7 @@ describe 'Long line detection' do
21
19
  Tailor::Critic.new
22
20
  end
23
21
 
24
- let(:contents) { LONG_LINE[file_name]}
22
+ let(:contents) { LONG_LINE[file_name] }
25
23
 
26
24
  let(:style) do
27
25
  style = Tailor::Configuration::Style.new
@@ -33,19 +31,19 @@ describe 'Long line detection' do
33
31
 
34
32
  context 'line is 81 chars, no newline' do
35
33
  let(:file_name) { 'long_line_no_newline' }
36
- specify { critic.problems[file_name].size.should be 1 }
37
- specify { critic.problems[file_name].first[:type].should == 'max_line_length' }
38
- specify { critic.problems[file_name].first[:line].should be 1 }
39
- specify { critic.problems[file_name].first[:column].should be 81 }
40
- specify { critic.problems[file_name].first[:level].should be :error }
34
+ specify { expect(critic.problems[file_name].size).to eq 1 }
35
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'max_line_length' }
36
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
37
+ specify { expect(critic.problems[file_name].first[:column]).to eq 81 }
38
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
41
39
  end
42
40
 
43
41
  context 'line is 81 chars, plus a newline' do
44
42
  let(:file_name) { 'long_line_newline_at_82' }
45
- specify { critic.problems[file_name].size.should be 1 }
46
- specify { critic.problems[file_name].first[:type].should == 'max_line_length' }
47
- specify { critic.problems[file_name].first[:line].should be 1 }
48
- specify { critic.problems[file_name].first[:column].should be 81 }
49
- specify { critic.problems[file_name].first[:level].should be :error }
43
+ specify { expect(critic.problems[file_name].size).to eq 1 }
44
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'max_line_length' }
45
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
46
+ specify { expect(critic.problems[file_name].first[:column]).to eq 81 }
47
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
50
48
  end
51
49
  end
@@ -2,7 +2,6 @@ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
  require 'tailor/configuration/style'
4
4
 
5
-
6
5
  LONG_METHOD_IN_CLASS = {}
7
6
  LONG_METHOD_IN_CLASS['ok_with_equals'] = <<-METH
8
7
  class Test
@@ -21,7 +20,7 @@ METH
21
20
 
22
21
  describe 'Long method detection' do
23
22
  before do
24
- Tailor::Logger.stub(:log)
23
+ allow(Tailor::Logger).to receive(:log)
25
24
  FakeFS.activate!
26
25
  File.open('long_method.rb', 'w') { |f| f.write contents }
27
26
  subject.check_file(file_name, style.to_hash)
@@ -46,10 +45,11 @@ describe 'Long method detection' do
46
45
  context 'methods are within limits' do
47
46
  context 'method ends with line that ends with ==' do
48
47
  let(:file_name) { 'ok_with_equals' }
49
- specify {
48
+ specify do
50
49
  pending 'https://github.com/turboladen/tailor/issues/112'
51
50
 
52
- subject.problems[file_name].size.should be 1 }
51
+ expect(subject.problems[file_name].size).to eq 1
52
+ end
53
53
  end
54
54
  end
55
55
  end
@@ -2,24 +2,23 @@ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
  require 'tailor/configuration/style'
4
4
 
5
-
6
5
  PARENS = {}
7
- PARENS['simple_method_call_space_after_lparen'] = %Q{thing( one, two)}
8
- PARENS['simple_method_call_space_before_rparen'] = %Q{thing(one, two )}
6
+ PARENS['simple_method_call_space_after_lparen'] = %(thing( one, two))
7
+ PARENS['simple_method_call_space_before_rparen'] = %(thing(one, two ))
9
8
  PARENS['method_call_space_after_lparen_trailing_comment'] =
10
- %Q{thing( one, two) # comment}
9
+ %(thing( one, two) # comment)
11
10
  PARENS['method_call_space_after_lparen_before_rparen_trailing_comment'] =
12
- %Q{thing( one, two ) # comment}
11
+ %(thing( one, two ) # comment)
13
12
 
14
- PARENS['multi_line_method_call_space_after_lparen'] = %Q{thing( one,
15
- two)}
13
+ PARENS['multi_line_method_call_space_after_lparen'] = %(thing( one,
14
+ two))
16
15
  PARENS['multi_line_method_call_space_after_lparen_trailing_comment'] =
17
- %Q{thing( one,
18
- two)}
16
+ %(thing( one,
17
+ two))
19
18
 
20
19
  describe 'Detection of spaces around brackets' do
21
20
  before do
22
- Tailor::Logger.stub(:log)
21
+ allow(Tailor::Logger).to receive(:log)
23
22
  FakeFS.activate!
24
23
  File.open(file_name, 'w') { |f| f.write contents }
25
24
  critic.check_file(file_name, style.to_hash)
@@ -29,7 +28,7 @@ describe 'Detection of spaces around brackets' do
29
28
  Tailor::Critic.new
30
29
  end
31
30
 
32
- let(:contents) { PARENS[file_name]}
31
+ let(:contents) { PARENS[file_name] }
33
32
 
34
33
  let(:style) do
35
34
  style = Tailor::Configuration::Style.new
@@ -42,61 +41,62 @@ describe 'Detection of spaces around brackets' do
42
41
  context 'methods' do
43
42
  context 'space after lparen' do
44
43
  let(:file_name) { 'simple_method_call_space_after_lparen' }
45
- specify { critic.problems[file_name].size.should be 1 }
46
- specify { critic.problems[file_name].first[:type].should == 'spaces_after_lparen' }
47
- specify { critic.problems[file_name].first[:line].should be 1 }
48
- specify { critic.problems[file_name].first[:column].should be 6 }
49
- specify { critic.problems[file_name].first[:level].should be :error }
44
+ specify { expect(critic.problems[file_name].size).to eq 1 }
45
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'spaces_after_lparen' }
46
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
47
+ specify { expect(critic.problems[file_name].first[:column]).to eq 6 }
48
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
50
49
  end
51
50
 
52
51
  context 'space before rparen' do
53
52
  let(:file_name) { 'simple_method_call_space_before_rparen' }
54
- specify { critic.problems[file_name].size.should be 1 }
55
- specify { critic.problems[file_name].first[:type].should == 'spaces_before_rparen' }
56
- specify { critic.problems[file_name].first[:line].should be 1 }
57
- specify { critic.problems[file_name].first[:column].should be 15 }
58
- specify { critic.problems[file_name].first[:level].should be :error }
53
+ specify { expect(critic.problems[file_name].size).to eq 1 }
54
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'spaces_before_rparen' }
55
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
56
+ specify { expect(critic.problems[file_name].first[:column]).to eq 15 }
57
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
59
58
  end
60
59
 
61
60
  context 'space after lparen, trailing comment' do
62
61
  let(:file_name) { 'method_call_space_after_lparen_trailing_comment' }
63
- specify { critic.problems[file_name].size.should be 1 }
64
- specify { critic.problems[file_name].first[:type].should == 'spaces_after_lparen' }
65
- specify { critic.problems[file_name].first[:line].should be 1 }
66
- specify { critic.problems[file_name].first[:column].should be 6 }
67
- specify { critic.problems[file_name].first[:level].should be :error }
62
+ specify { expect(critic.problems[file_name].size).to eq 1 }
63
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'spaces_after_lparen' }
64
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
65
+ specify { expect(critic.problems[file_name].first[:column]).to eq 6 }
66
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
68
67
  end
69
68
 
70
69
  context 'space after lparen, before rparen, trailing comment' do
71
70
  let(:file_name) { 'method_call_space_after_lparen_before_rparen_trailing_comment' }
72
- specify { critic.problems[file_name].size.should be 2 }
73
- specify { critic.problems[file_name].first[:type].should == 'spaces_after_lparen' }
74
- specify { critic.problems[file_name].first[:line].should be 1 }
75
- specify { critic.problems[file_name].first[:column].should be 6 }
76
- specify { critic.problems[file_name].first[:level].should be :error }
77
- specify { critic.problems[file_name].last[:type].should == 'spaces_before_rparen' }
78
- specify { critic.problems[file_name].last[:line].should be 1 }
79
- specify { critic.problems[file_name].last[:column].should be 16 }
80
- specify { critic.problems[file_name].last[:level].should be :error }
71
+ specify { expect(critic.problems[file_name].size).to eq 2 }
72
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'spaces_after_lparen' }
73
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
74
+ specify { expect(critic.problems[file_name].first[:column]).to eq 6 }
75
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
76
+ specify { expect(critic.problems[file_name].last[:type]).to eq 'spaces_before_rparen' }
77
+ specify { expect(critic.problems[file_name].last[:line]).to eq 1 }
78
+ specify { expect(critic.problems[file_name].last[:column]).to eq 16 }
79
+ specify { expect(critic.problems[file_name].last[:level]).to eq :error }
81
80
  end
82
81
  end
83
82
 
84
83
  context 'multi-line method calls' do
85
84
  context 'space after lparen' do
86
85
  let(:file_name) { 'multi_line_method_call_space_after_lparen' }
87
- specify { critic.problems[file_name].size.should be 1 }
88
- specify { critic.problems[file_name].first[:type].should == 'spaces_after_lparen' }
89
- specify { critic.problems[file_name].first[:line].should be 1 }
90
- specify { critic.problems[file_name].first[:column].should be 6 }
91
- specify { critic.problems[file_name].first[:level].should be :error }
86
+ specify { expect(critic.problems[file_name].size).to eq 1 }
87
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'spaces_after_lparen' }
88
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
89
+ specify { expect(critic.problems[file_name].first[:column]).to eq 6 }
90
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
92
91
  end
92
+
93
93
  context 'space after lparen, trailing comment' do
94
94
  let(:file_name) { 'multi_line_method_call_space_after_lparen_trailing_comment' }
95
- specify { critic.problems[file_name].size.should be 1 }
96
- specify { critic.problems[file_name].first[:type].should == 'spaces_after_lparen' }
97
- specify { critic.problems[file_name].first[:line].should be 1 }
98
- specify { critic.problems[file_name].first[:column].should be 6 }
99
- specify { critic.problems[file_name].first[:level].should be :error }
95
+ specify { expect(critic.problems[file_name].size).to eq 1 }
96
+ specify { expect(critic.problems[file_name].first[:type]).to eq 'spaces_after_lparen' }
97
+ specify { expect(critic.problems[file_name].first[:line]).to eq 1 }
98
+ specify { expect(critic.problems[file_name].first[:column]).to eq 6 }
99
+ specify { expect(critic.problems[file_name].first[:level]).to eq :error }
100
100
  end
101
101
  end
102
102
  end