tailor 1.2.1 → 1.3.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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +30 -28
  3. data/History.md +257 -0
  4. data/README.md +486 -0
  5. data/Rakefile +1 -9
  6. data/lib/ext/string_ext.rb +1 -1
  7. data/lib/tailor/cli.rb +3 -1
  8. data/lib/tailor/cli/options.rb +59 -39
  9. data/lib/tailor/configuration.rb +8 -5
  10. data/lib/tailor/configuration/file_set.rb +1 -3
  11. data/lib/tailor/configuration/style.rb +2 -0
  12. data/lib/tailor/critic.rb +2 -2
  13. data/lib/tailor/formatters/text.rb +17 -16
  14. data/lib/tailor/lexed_line.rb +2 -4
  15. data/lib/tailor/lexer.rb +9 -9
  16. data/lib/tailor/lexer/lexer_constants.rb +32 -32
  17. data/lib/tailor/lexer/token.rb +8 -10
  18. data/lib/tailor/logger.rb +1 -1
  19. data/lib/tailor/problem.rb +4 -1
  20. data/lib/tailor/rake_task.rb +4 -1
  21. data/lib/tailor/reporter.rb +3 -3
  22. data/lib/tailor/ruler.rb +2 -2
  23. data/lib/tailor/rulers/allow_camel_case_methods_ruler.rb +2 -2
  24. data/lib/tailor/rulers/allow_hard_tabs_ruler.rb +1 -1
  25. data/lib/tailor/rulers/allow_invalid_ruby_ruler.rb +1 -1
  26. data/lib/tailor/rulers/allow_screaming_snake_case_classes_ruler.rb +2 -2
  27. data/lib/tailor/rulers/indentation_spaces_ruler.rb +24 -22
  28. data/lib/tailor/rulers/indentation_spaces_ruler/indentation_manager.rb +13 -13
  29. data/lib/tailor/rulers/max_code_lines_in_class_ruler.rb +2 -2
  30. data/lib/tailor/rulers/max_code_lines_in_method_ruler.rb +2 -2
  31. data/lib/tailor/rulers/spaces_after_comma_ruler.rb +6 -6
  32. data/lib/tailor/rulers/spaces_after_conditional_ruler.rb +48 -0
  33. data/lib/tailor/rulers/spaces_after_lbrace_ruler.rb +8 -8
  34. data/lib/tailor/rulers/spaces_after_lbracket_ruler.rb +6 -6
  35. data/lib/tailor/rulers/spaces_after_lparen_ruler.rb +6 -6
  36. data/lib/tailor/rulers/spaces_before_comma_ruler.rb +2 -2
  37. data/lib/tailor/rulers/spaces_before_lbrace_ruler.rb +4 -4
  38. data/lib/tailor/rulers/spaces_before_rbrace_ruler.rb +9 -9
  39. data/lib/tailor/rulers/spaces_before_rbracket_ruler.rb +6 -6
  40. data/lib/tailor/rulers/spaces_before_rparen_ruler.rb +6 -6
  41. data/lib/tailor/rulers/spaces_in_empty_braces_ruler.rb +1 -1
  42. data/lib/tailor/rulers/trailing_newlines_ruler.rb +2 -2
  43. data/lib/tailor/tailorrc.erb +1 -1
  44. data/lib/tailor/version.rb +1 -1
  45. data/spec/functional/conditional_spacing_spec.rb +149 -0
  46. data/spec/functional/configuration_spec.rb +36 -26
  47. data/spec/functional/horizontal_spacing/braces_spec.rb +1 -1
  48. data/spec/functional/horizontal_spacing/brackets_spec.rb +14 -14
  49. data/spec/functional/horizontal_spacing/comma_spacing_spec.rb +8 -8
  50. data/spec/functional/horizontal_spacing/hard_tabs_spec.rb +13 -13
  51. data/spec/functional/horizontal_spacing/long_lines_spec.rb +6 -6
  52. data/spec/functional/horizontal_spacing/long_methods_spec.rb +55 -0
  53. data/spec/functional/horizontal_spacing/parens_spec.rb +17 -17
  54. data/spec/functional/horizontal_spacing/trailing_whitespace_spec.rb +8 -8
  55. data/spec/functional/horizontal_spacing_spec.rb +11 -11
  56. data/spec/functional/indentation_spacing/bad_indentation_spec.rb +83 -83
  57. data/spec/functional/indentation_spacing_spec.rb +10 -10
  58. data/spec/functional/naming/camel_case_methods_spec.rb +6 -6
  59. data/spec/functional/naming/screaming_snake_case_classes_spec.rb +10 -10
  60. data/spec/functional/naming_spec.rb +3 -3
  61. data/spec/functional/vertical_spacing/class_length_spec.rb +6 -6
  62. data/spec/functional/vertical_spacing/method_length_spec.rb +6 -6
  63. data/spec/functional/vertical_spacing_spec.rb +3 -3
  64. data/spec/support/conditional_spacing_cases.rb +37 -0
  65. data/spec/support/good_indentation_cases.rb +1 -1
  66. data/spec/unit/tailor/cli/options_spec.rb +50 -0
  67. data/spec/unit/tailor/cli_spec.rb +3 -3
  68. data/spec/unit/tailor/composite_observable_spec.rb +8 -8
  69. data/spec/unit/tailor/configuration/file_set_spec.rb +2 -2
  70. data/spec/unit/tailor/configuration/style_spec.rb +30 -29
  71. data/spec/unit/tailor/configuration_spec.rb +39 -24
  72. data/spec/unit/tailor/critic_spec.rb +18 -17
  73. data/spec/unit/tailor/formatter_spec.rb +15 -15
  74. data/spec/unit/tailor/formatters/yaml_spec.rb +1 -1
  75. data/spec/unit/tailor/lexed_line_spec.rb +258 -258
  76. data/spec/unit/tailor/lexer/token_spec.rb +11 -11
  77. data/spec/unit/tailor/lexer_spec.rb +35 -35
  78. data/spec/unit/tailor/problem_spec.rb +13 -13
  79. data/spec/unit/tailor/reporter_spec.rb +19 -18
  80. data/spec/unit/tailor/ruler_spec.rb +15 -15
  81. data/spec/unit/tailor/rulers/indentation_spaces_ruler/indentation_manager_spec.rb +72 -72
  82. data/spec/unit/tailor/rulers/indentation_spaces_ruler_spec.rb +32 -32
  83. data/spec/unit/tailor/rulers/spaces_after_comma_ruler_spec.rb +8 -8
  84. data/spec/unit/tailor/rulers/spaces_after_lbrace_ruler_spec.rb +36 -36
  85. data/spec/unit/tailor/rulers/spaces_before_lbrace_ruler_spec.rb +14 -14
  86. data/spec/unit/tailor/rulers/spaces_before_rbrace_ruler_spec.rb +14 -14
  87. data/spec/unit/tailor/rulers_spec.rb +2 -2
  88. data/spec/unit/tailor/version_spec.rb +1 -1
  89. data/spec/unit/tailor_spec.rb +4 -4
  90. data/tailor.gemspec +1 -1
  91. metadata +16 -9
  92. data/History.rdoc +0 -189
  93. data/README.rdoc +0 -422
  94. data/spec/unit/tailor/options_spec.rb +0 -6
@@ -1,110 +1,110 @@
1
- require_relative '../../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/rulers/indentation_spaces_ruler'
3
3
  require 'ripper'
4
4
 
5
5
  describe Tailor::Rulers::IndentationSpacesRuler do
6
6
  let!(:spaces) { 5 }
7
- let(:lexed_line) { double "LexedLine" }
7
+ let(:lexed_line) { double 'LexedLine' }
8
8
 
9
9
  subject do
10
10
  Tailor::Rulers::IndentationSpacesRuler.new(spaces, level: :error)
11
11
  end
12
12
 
13
- describe "#comment_update" do
14
- context "token does not contain a trailing newline" do
13
+ describe '#comment_update' do
14
+ context 'token does not contain a trailing newline' do
15
15
  pending
16
16
  end
17
17
 
18
- context "token contains a trailing newline" do
19
- context "lexed_line is spaces then a comment" do
18
+ context 'token contains a trailing newline' do
19
+ context 'lexed_line is spaces then a comment' do
20
20
  pending
21
21
  end
22
22
 
23
- context "lexed_line is no spaces and a comment" do
23
+ context 'lexed_line is no spaces and a comment' do
24
24
  pending
25
25
  end
26
26
 
27
- context "lexed_line ends with an operator" do
27
+ context 'lexed_line ends with an operator' do
28
28
  pending
29
29
  end
30
30
 
31
- context "lexed_line ends with a comma" do
31
+ context 'lexed_line ends with a comma' do
32
32
  pending
33
33
  end
34
34
  end
35
35
  end
36
36
 
37
- describe "#embexpr_beg_update" do
38
- it "sets @embexpr_nesting to [true]" do
37
+ describe '#embexpr_beg_update' do
38
+ it 'sets @embexpr_nesting to [true]' do
39
39
  subject.instance_variable_set(:@embexpr_nesting, [])
40
40
  subject.embexpr_beg_update(lexed_line, 1, 1)
41
41
  subject.instance_variable_get(:@embexpr_nesting).should == [true]
42
42
  end
43
43
  end
44
44
 
45
- describe "#embexpr_end_update" do
45
+ describe '#embexpr_end_update' do
46
46
  before do
47
47
  lexed_line.should_receive(:only_on_embexpr_end?).and_return(false)
48
48
  end
49
49
 
50
- it "pops @embexpr_nesting" do
50
+ it 'pops @embexpr_nesting' do
51
51
  subject.instance_variable_set(:@embexpr_nesting, [true])
52
52
  subject.embexpr_end_update(lexed_line, 1, 1)
53
53
  subject.instance_variable_get(:@embexpr_nesting).should == []
54
54
  end
55
55
  end
56
56
 
57
- describe "#ignored_nl_update" do
57
+ describe '#ignored_nl_update' do
58
58
  pending
59
59
  end
60
60
 
61
- describe "#kw_update" do
61
+ describe '#kw_update' do
62
62
  pending
63
63
  end
64
64
 
65
- describe "#lbrace_update" do
65
+ describe '#lbrace_update' do
66
66
  pending
67
67
  end
68
68
 
69
- describe "#lbracket_update" do
69
+ describe '#lbracket_update' do
70
70
  pending
71
71
  end
72
72
 
73
- describe "#lparen_update" do
73
+ describe '#lparen_update' do
74
74
  pending
75
75
  end
76
76
 
77
- describe "#nl_update" do
77
+ describe '#nl_update' do
78
78
  pending
79
79
  end
80
80
 
81
- describe "#period_update" do
81
+ describe '#period_update' do
82
82
  pending
83
83
  end
84
84
 
85
- describe "#rbrace_update" do
85
+ describe '#rbrace_update' do
86
86
  pending
87
87
  end
88
88
 
89
- describe "#rbracket_update" do
89
+ describe '#rbracket_update' do
90
90
  pending
91
91
  end
92
92
 
93
- describe "#rparen_update" do
93
+ describe '#rparen_update' do
94
94
  pending
95
95
  end
96
96
 
97
- describe "#tstring_beg_update" do
98
- let(:manager) { double "IndentationManager" }
97
+ describe '#tstring_beg_update' do
98
+ let(:manager) { double 'IndentationManager' }
99
99
 
100
- it "calls #stop on the indentation_manager object" do
100
+ it 'calls #stop on the indentation_manager object' do
101
101
  manager.should_receive(:update_actual_indentation).with lexed_line
102
102
  manager.should_receive(:stop)
103
103
  subject.instance_variable_set(:@manager, manager)
104
104
  subject.tstring_beg_update(lexed_line, 1)
105
105
  end
106
106
 
107
- it "adds the lineno to @tstring_nesting" do
107
+ it 'adds the lineno to @tstring_nesting' do
108
108
  manager.stub(:update_actual_indentation)
109
109
  manager.stub(:stop)
110
110
  subject.instance_variable_set(:@manager, manager)
@@ -113,17 +113,17 @@ describe Tailor::Rulers::IndentationSpacesRuler do
113
113
  end
114
114
  end
115
115
 
116
- describe "#tstring_end_update" do
117
- context "@tstring_nesting is not empty" do
118
- let(:manager) { double "IndentationManager" }
116
+ describe '#tstring_end_update' do
117
+ context '@tstring_nesting is not empty' do
118
+ let(:manager) { double 'IndentationManager' }
119
119
 
120
- it "calls #start" do
120
+ it 'calls #start' do
121
121
  manager.should_receive(:start)
122
122
  subject.instance_variable_set(:@manager, manager)
123
123
  subject.tstring_end_update(2)
124
124
  end
125
125
 
126
- it "removes the lineno to @tstring_nesting then calls @manager.start" do
126
+ it 'removes the lineno to @tstring_nesting then calls @manager.start' do
127
127
  manager.should_receive(:actual_indentation)
128
128
  manager.should_receive(:start)
129
129
  subject.instance_variable_set(:@manager, manager)
@@ -1,27 +1,27 @@
1
- require_relative '../../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/rulers/spaces_after_comma_ruler'
3
3
 
4
4
  describe Tailor::Rulers::SpacesAfterCommaRuler do
5
5
  subject { Tailor::Rulers::SpacesAfterCommaRuler.new(nil, {}) }
6
6
 
7
- describe "#comma_update" do
8
- it "adds the column number to @comma_columns" do
9
- subject.comma_update(",", 2, 1)
7
+ describe '#comma_update' do
8
+ it 'adds the column number to @comma_columns' do
9
+ subject.comma_update(',', 2, 1)
10
10
  subject.instance_variable_get(:@comma_columns).should == [1]
11
11
  end
12
12
  end
13
13
 
14
- describe "#check_spaces_after_comma" do
15
- context "no event after comma" do
14
+ describe '#check_spaces_after_comma' do
15
+ context 'no event after comma' do
16
16
  let(:lexed_line) do
17
- l = double "LexedLine"
17
+ l = double 'LexedLine'
18
18
  l.stub(:event_at)
19
19
  l.stub(:index)
20
20
 
21
21
  l
22
22
  end
23
23
 
24
- it "doesn't detect any problems" do
24
+ it 'does not detect any problems' do
25
25
  Tailor::Problem.should_not_receive(:new)
26
26
  expect { subject.check_spaces_after_comma(lexed_line, 1) }.
27
27
  to_not raise_error
@@ -1,143 +1,143 @@
1
- require_relative '../../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/rulers/spaces_after_lbrace_ruler'
3
3
 
4
4
  describe Tailor::Rulers::SpacesAfterLbraceRuler do
5
5
  subject { Tailor::Rulers::SpacesAfterLbraceRuler.new('', {}) }
6
6
 
7
- describe "#comment_update" do
8
- context "token has a trailing newline" do
9
- it "calls #ignored_nl_update" do
7
+ describe '#comment_update' do
8
+ context 'token has a trailing newline' do
9
+ it 'calls #ignored_nl_update' do
10
10
  subject.should_receive(:ignored_nl_update)
11
11
  subject.comment_update("\n", '', '', 1, 1)
12
12
  end
13
13
  end
14
14
 
15
- context "token does not have a trailing newline" do
16
- it "does not call #ignored_nl_update" do
15
+ context 'token does not have a trailing newline' do
16
+ it 'does not call #ignored_nl_update' do
17
17
  subject.should_not_receive(:ignored_nl_update)
18
- subject.comment_update("# comment", '', '', 1, 1)
18
+ subject.comment_update('# comment', '', '', 1, 1)
19
19
  end
20
20
  end
21
21
  end
22
22
 
23
- describe "#ignored_nl_update" do
24
- it "calls #check_spaces_after_lbrace" do
23
+ describe '#ignored_nl_update' do
24
+ it 'calls #check_spaces_after_lbrace' do
25
25
  subject.should_receive(:check_spaces_after_lbrace)
26
26
  subject.ignored_nl_update('', 1, 1)
27
27
  end
28
28
  end
29
29
 
30
- describe "#lbrace_update" do
31
- it "adds column to @lbrace_columns" do
30
+ describe '#lbrace_update' do
31
+ it 'adds column to @lbrace_columns' do
32
32
  subject.lbrace_update('', 1, 1)
33
33
  subject.instance_variable_get(:@lbrace_columns).should == [1]
34
34
  end
35
35
  end
36
36
 
37
- describe "#nl_update" do
38
- it "calls #ignored_nl_update" do
37
+ describe '#nl_update' do
38
+ it 'calls #ignored_nl_update' do
39
39
  subject.should_receive(:ignored_nl_update)
40
40
  subject.nl_update('', 1, 1)
41
41
  end
42
42
  end
43
43
 
44
- describe "#count_spaces" do
45
- context "lexed_line.event_index returns nil" do
44
+ describe '#count_spaces' do
45
+ context 'lexed_line.event_index returns nil' do
46
46
  let(:lexed_line) do
47
- l = double "LexedLine"
47
+ l = double 'LexedLine'
48
48
  l.stub(:event_index).and_return nil
49
49
 
50
50
  l
51
51
  end
52
52
 
53
- it "breaks from the loop and returns nil" do
53
+ it 'breaks from the loop and returns nil' do
54
54
  lexed_line.should_not_receive(:at)
55
55
  subject.count_spaces(lexed_line, 1).should be_nil
56
56
  end
57
57
  end
58
58
 
59
- context "lexed_line.at returns nil" do
59
+ context 'lexed_line.at returns nil' do
60
60
  let(:lexed_line) do
61
- l = double "LexedLine"
61
+ l = double 'LexedLine'
62
62
  l.stub(:event_index).and_return 1
63
63
  l.stub(:at).and_return nil
64
64
 
65
65
  l
66
66
  end
67
67
 
68
- it "returns 0" do
68
+ it 'returns 0' do
69
69
  subject.count_spaces(lexed_line, 1).should be_zero
70
70
  end
71
71
  end
72
72
 
73
- context "next_event is a :on_nl" do
73
+ context 'next_event is a :on_nl' do
74
74
  let!(:next_event) do
75
- [[1, 1], :on_nl, "\n"]
75
+ [[1, 1], :on_nl, '\n']
76
76
  end
77
77
 
78
78
  let(:lexed_line) do
79
- l = double "LexedLine"
79
+ l = double 'LexedLine'
80
80
  l.stub(:event_index).and_return 1
81
81
  l.should_receive(:at).with(2).and_return next_event
82
82
 
83
83
  l
84
84
  end
85
85
 
86
- it "returns 0" do
86
+ it 'returns 0' do
87
87
  subject.count_spaces(lexed_line, 1).should be_zero
88
88
  end
89
89
  end
90
90
 
91
- context "next_event is a :on_ignored_nl" do
91
+ context 'next_event is a :on_ignored_nl' do
92
92
  let!(:next_event) do
93
- [[1, 1], :on_ignored_nl, "\n"]
93
+ [[1, 1], :on_ignored_nl, '\n']
94
94
  end
95
95
 
96
96
  let(:lexed_line) do
97
- l = double "LexedLine"
97
+ l = double 'LexedLine'
98
98
  l.stub(:event_index).and_return 1
99
99
  l.should_receive(:at).with(2).and_return next_event
100
100
 
101
101
  l
102
102
  end
103
103
 
104
- it "breaks from the loop and returns nil" do
104
+ it 'breaks from the loop and returns nil' do
105
105
  subject.count_spaces(lexed_line, 1)
106
106
  end
107
107
  end
108
108
 
109
- context "next_event is a non-space event" do
109
+ context 'next_event is a non-space event' do
110
110
  let!(:next_event) do
111
- [[1, 1], :on_kw, "def"]
111
+ [[1, 1], :on_kw, 'def']
112
112
  end
113
113
 
114
114
  let(:lexed_line) do
115
- l = double "LexedLine"
115
+ l = double 'LexedLine'
116
116
  l.stub(:event_index).and_return 1
117
117
  l.stub(:at).and_return next_event
118
118
 
119
119
  l
120
120
  end
121
121
 
122
- it "returns 0" do
122
+ it 'returns 0' do
123
123
  subject.count_spaces(lexed_line, 1).should be_zero
124
124
  end
125
125
  end
126
126
 
127
- context "next_event is :on_sp" do
127
+ context 'next_event is :on_sp' do
128
128
  let!(:next_event) do
129
- [[1, 1], :on_sp, " "]
129
+ [[1, 1], :on_sp, ' ']
130
130
  end
131
131
 
132
132
  let(:lexed_line) do
133
- l = double "LexedLine"
133
+ l = double 'LexedLine'
134
134
  l.stub(:event_index).and_return 1
135
135
  l.stub(:at).and_return next_event
136
136
 
137
137
  l
138
138
  end
139
139
 
140
- it "returns 2" do
140
+ it 'returns 2' do
141
141
  subject.count_spaces(lexed_line, 1).should == 2
142
142
  end
143
143
  end
@@ -1,14 +1,14 @@
1
- require_relative '../../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/rulers/spaces_before_lbrace_ruler'
3
3
 
4
4
  describe Tailor::Rulers::SpacesBeforeLbraceRuler do
5
5
  subject { Tailor::Rulers::SpacesBeforeLbraceRuler.new(nil, {}) }
6
6
  before { Tailor::Logger.stub(:log) }
7
7
 
8
- describe "#count_spaces" do
9
- context "lexed_line.event_index is 0" do
8
+ describe '#count_spaces' do
9
+ context 'lexed_line.event_index is 0' do
10
10
  let(:lexed_line) do
11
- l = double "LexedLine"
11
+ l = double 'LexedLine'
12
12
  l.stub(:event_index).and_return 0
13
13
  l.stub(:at).and_return nil
14
14
 
@@ -17,18 +17,18 @@ describe Tailor::Rulers::SpacesBeforeLbraceRuler do
17
17
 
18
18
  specify { subject.count_spaces(lexed_line, 1).should be_zero }
19
19
 
20
- it "sets @do_measurement to false" do
20
+ it 'sets @do_measurement to false' do
21
21
  expect { subject.count_spaces(lexed_line, 1) }.
22
22
  to change{subject.instance_variable_get(:@do_measurement)}.from(true).
23
23
  to(false)
24
24
  end
25
25
  end
26
26
 
27
- context "no space before lbrace" do
27
+ context 'no space before lbrace' do
28
28
  let(:lexed_line) do
29
- l = double "LexedLine"
29
+ l = double 'LexedLine'
30
30
  l.stub(:event_index).and_return 1
31
- l.stub(:at).and_return [[10, 0], :on_const, "HI"]
31
+ l.stub(:at).and_return [[10, 0], :on_const, 'HI']
32
32
 
33
33
  l
34
34
  end
@@ -36,11 +36,11 @@ describe Tailor::Rulers::SpacesBeforeLbraceRuler do
36
36
  specify { subject.count_spaces(lexed_line, 1).should be_zero }
37
37
  end
38
38
 
39
- context "1 space before lbrace" do
39
+ context '1 space before lbrace' do
40
40
  let(:lexed_line) do
41
- l = double "LexedLine"
41
+ l = double 'LexedLine'
42
42
  l.stub(:event_index).and_return 1
43
- l.stub(:at).and_return [[10, 0], :on_sp, " "]
43
+ l.stub(:at).and_return [[10, 0], :on_sp, ' ']
44
44
 
45
45
  l
46
46
  end
@@ -48,11 +48,11 @@ describe Tailor::Rulers::SpacesBeforeLbraceRuler do
48
48
  specify { subject.count_spaces(lexed_line, 1).should == 1 }
49
49
  end
50
50
 
51
- context "> 1 space before lbrace" do
51
+ context '> 1 space before lbrace' do
52
52
  let(:lexed_line) do
53
- l = double "LexedLine"
53
+ l = double 'LexedLine'
54
54
  l.stub(:event_index).and_return 1
55
- l.stub(:at).and_return [[10, 1], :on_sp, " "]
55
+ l.stub(:at).and_return [[10, 1], :on_sp, ' ']
56
56
 
57
57
  l
58
58
  end
@@ -1,14 +1,14 @@
1
- require_relative '../../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/rulers/spaces_before_rbrace_ruler'
3
3
 
4
4
  describe Tailor::Rulers::SpacesBeforeRbraceRuler do
5
5
  subject { Tailor::Rulers::SpacesBeforeRbraceRuler.new(nil, {}) }
6
6
  before { Tailor::Logger.stub(:log) }
7
7
 
8
- describe "#count_spaces" do
9
- context "lexed_line.event_index is 0" do
8
+ describe '#count_spaces' do
9
+ context 'lexed_line.event_index is 0' do
10
10
  let(:lexed_line) do
11
- l = double "LexedLine"
11
+ l = double 'LexedLine'
12
12
  l.stub(:event_index).and_return 0
13
13
  l.stub(:at).and_return nil
14
14
 
@@ -17,18 +17,18 @@ describe Tailor::Rulers::SpacesBeforeRbraceRuler do
17
17
 
18
18
  specify { subject.count_spaces(lexed_line, 1).should be_zero }
19
19
 
20
- it "sets @do_measurement to false" do
20
+ it 'sets @do_measurement to false' do
21
21
  expect { subject.count_spaces(lexed_line, 1) }.
22
22
  to change{subject.instance_variable_get(:@do_measurement)}.from(true).
23
23
  to(false)
24
24
  end
25
25
  end
26
26
 
27
- context "no space before rbrace" do
27
+ context 'no space before rbrace' do
28
28
  let(:lexed_line) do
29
- l = double "LexedLine"
29
+ l = double 'LexedLine'
30
30
  l.stub(:event_index).and_return 1
31
- l.stub(:at).and_return [[10, 0], :on_const, "HI"]
31
+ l.stub(:at).and_return [[10, 0], :on_const, 'HI']
32
32
 
33
33
  l
34
34
  end
@@ -36,11 +36,11 @@ describe Tailor::Rulers::SpacesBeforeRbraceRuler do
36
36
  specify { subject.count_spaces(lexed_line, 1).should be_zero }
37
37
  end
38
38
 
39
- context "1 space before rbrace" do
39
+ context '1 space before rbrace' do
40
40
  let(:lexed_line) do
41
- l = double "LexedLine"
41
+ l = double 'LexedLine'
42
42
  l.stub(:event_index).and_return 1
43
- l.stub(:at).and_return [[10, 0], :on_sp, " "]
43
+ l.stub(:at).and_return [[10, 0], :on_sp, ' ']
44
44
 
45
45
  l
46
46
  end
@@ -48,11 +48,11 @@ describe Tailor::Rulers::SpacesBeforeRbraceRuler do
48
48
  specify { subject.count_spaces(lexed_line, 1).should == 1 }
49
49
  end
50
50
 
51
- context "> 1 space before rbrace" do
51
+ context '> 1 space before rbrace' do
52
52
  let(:lexed_line) do
53
- l = double "LexedLine"
53
+ l = double 'LexedLine'
54
54
  l.stub(:event_index).and_return 1
55
- l.stub(:at).and_return [[10, 0], :on_sp, " "]
55
+ l.stub(:at).and_return [[10, 0], :on_sp, ' ']
56
56
 
57
57
  l
58
58
  end