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,4 +1,4 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/configuration'
3
3
  require 'tailor/cli'
4
4
 
@@ -9,28 +9,28 @@ describe Tailor::Configuration do
9
9
  Tailor::Configuration.new('.')
10
10
  end
11
11
 
12
- describe "#formatters" do
13
- context "param is nil" do
14
- it "returns the pre-exisiting @formatters" do
12
+ describe '#formatters' do
13
+ context 'param is nil' do
14
+ it 'returns the pre-exisiting @formatters' do
15
15
  subject.instance_variable_set(:@formatters, [:blah])
16
16
  subject.formatters.should == [:blah]
17
17
  end
18
18
  end
19
19
 
20
- context "param is some value" do
21
- it "sets @formatters to that value" do
22
- subject.formatters "blah"
23
- subject.instance_variable_get(:@formatters).should == ["blah"]
20
+ context 'param is some value' do
21
+ it 'sets @formatters to that value' do
22
+ subject.formatters 'blah'
23
+ subject.instance_variable_get(:@formatters).should == ['blah']
24
24
  end
25
25
  end
26
26
  end
27
27
 
28
- describe "#file_set" do
28
+ describe '#file_set' do
29
29
  before do
30
30
  subject.instance_variable_set(:@file_sets, {})
31
31
  end
32
32
 
33
- it "adds the set of stuff to @file_sets" do
33
+ it 'adds the set of stuff to @file_sets' do
34
34
  subject.file_set('some_files', :bobo) do |style|
35
35
  style.trailing_newlines 2
36
36
  end
@@ -49,6 +49,7 @@ describe Tailor::Configuration do
49
49
  max_code_lines_in_method: [30, { level: :error }],
50
50
  max_line_length: [80, { level: :error }],
51
51
  spaces_after_comma: [1, { level: :error }],
52
+ spaces_after_conditional: [1, { :level=>:error }],
52
53
  spaces_after_lbrace: [1, { level: :error }],
53
54
  spaces_after_lbracket: [0, { level: :error }],
54
55
  spaces_after_lparen: [0, { level: :error }],
@@ -64,25 +65,25 @@ describe Tailor::Configuration do
64
65
  }
65
66
  end
66
67
 
67
- context "first param is nil" do
68
- it "uses :default as the label" do
68
+ context 'first param is nil' do
69
+ it 'uses :default as the label' do
69
70
  subject.file_set
70
71
  subject.instance_variable_get(:@file_sets).should include(:default)
71
72
  end
72
73
  end
73
74
  end
74
75
 
75
- describe "#confg_file" do
76
- context "@config_file is already set" do
77
- it "returns @config_file" do
76
+ describe '#confg_file' do
77
+ context '@config_file is already set' do
78
+ it 'returns @config_file' do
78
79
  subject.instance_variable_set(:@config_file, 'pants')
79
80
  subject.config_file
80
81
  subject.instance_variable_get(:@config_file).should == 'pants'
81
82
  end
82
83
  end
83
84
 
84
- context "@config_file is nil" do
85
- context "DEFAULT_PROJECT_CONFIG exists" do
85
+ context '@config_file is nil' do
86
+ context 'DEFAULT_PROJECT_CONFIG exists' do
86
87
  before do
87
88
  File.should_receive(:exists?).with(/\.tailor/).and_return true
88
89
  end
@@ -92,13 +93,13 @@ describe Tailor::Configuration do
92
93
  end
93
94
  end
94
95
 
95
- context "DEFAULT_PROJECT_CONFIG does not exist" do
96
+ context 'DEFAULT_PROJECT_CONFIG does not exist' do
96
97
  before do
97
98
  File.should_receive(:exists?).with(/\.tailor/).and_return false
98
99
  File.should_receive(:exists?).with(/\.tailorrc/).and_return true
99
100
  end
100
101
 
101
- it "returns DEFAULT_RC_FILE" do
102
+ it 'returns DEFAULT_RC_FILE' do
102
103
  subject.config_file
103
104
  subject.instance_variable_get(:@config_file).should ==
104
105
  Tailor::Configuration::DEFAULT_RC_FILE
@@ -107,8 +108,22 @@ describe Tailor::Configuration do
107
108
  end
108
109
  end
109
110
 
110
- describe "output file" do
111
- context "defined" do
111
+ describe '#recursive_file_set' do
112
+ before do
113
+ subject.instance_variable_set(:@file_sets, {})
114
+ end
115
+ it 'yields if a block is provided' do
116
+ expect do |config|
117
+ subject.recursive_file_set('*.rb', &config)
118
+ end.to yield_control
119
+ end
120
+ it 'does not raise if a block is not provided' do
121
+ expect { subject.recursive_file_set('*.rb') }.not_to raise_error
122
+ end
123
+ end
124
+
125
+ describe 'output file' do
126
+ context 'defined' do
112
127
  subject do
113
128
  parser = Tailor::CLI::Options
114
129
  args = %w(--output-file=tailor-result.yaml)
@@ -116,11 +131,11 @@ describe Tailor::Configuration do
116
131
  end
117
132
 
118
133
  before { subject.load! }
119
- its(:output_file) { should eq "tailor-result.yaml" }
134
+ its(:output_file) { should eq 'tailor-result.yaml' }
120
135
  end
121
136
 
122
- context "not defined" do
123
- its(:output_file) { should eq "" }
137
+ context 'not defined' do
138
+ its(:output_file) { should eq '' }
124
139
  end
125
140
  end
126
141
  end
@@ -1,20 +1,21 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/critic'
3
3
 
4
+
4
5
  describe Tailor::Critic do
5
6
  before { Tailor::Logger.stub(:log) }
6
7
 
7
- describe "#check_file" do
8
- let(:lexer) { double "Lexer" }
9
- let(:ruler) { double "Ruler" }
10
- let(:style) { double "Style", each: nil }
11
- let(:file_name) { "this_file.rb" }
8
+ describe '#check_file' do
9
+ let(:lexer) { double 'Lexer' }
10
+ let(:ruler) { double 'Ruler' }
11
+ let(:style) { double 'Style', each: nil }
12
+ let(:file_name) { 'this_file.rb' }
12
13
 
13
14
  before do
14
15
  subject.stub(:init_rulers)
15
16
  end
16
17
 
17
- it "lexes the file" do
18
+ it 'lexes the file' do
18
19
  lexer.should_receive(:lex)
19
20
  lexer.stub(:check_added_newline)
20
21
  Tailor::Lexer.should_receive(:new).with(file_name).and_return lexer
@@ -24,7 +25,7 @@ describe Tailor::Critic do
24
25
  subject.check_file(file_name, style)
25
26
  end
26
27
 
27
- it "adds problems for the file to the main list of problems" do
28
+ it 'adds problems for the file to the main list of problems' do
28
29
  lexer.stub(:lex)
29
30
  lexer.stub(:check_added_newline)
30
31
  Tailor::Lexer.stub(:new).and_return lexer
@@ -34,25 +35,25 @@ describe Tailor::Critic do
34
35
  end
35
36
  end
36
37
 
37
- describe "#problems" do
38
+ describe '#problems' do
38
39
  specify { subject.problems.should be_a Hash }
39
40
  specify { subject.problems.should be_empty }
40
41
  end
41
42
 
42
- describe "#problem_count" do
43
- context "#problems is empty" do
44
- it "returns 0" do
43
+ describe '#problem_count' do
44
+ context '#problems is empty' do
45
+ it 'returns 0' do
45
46
  subject.instance_variable_set(:@problems, {})
46
47
  subject.problem_count.should == 0
47
48
  end
48
49
  end
49
50
 
50
- context "#problems contains valid values" do
51
- it "adds the number of each problem together" do
51
+ context '#problems contains valid values' do
52
+ it 'adds the number of each problem together' do
52
53
  probs = {
53
- one: { type: :indentation, line: 1, message: "" },
54
- two: { type: :indentation, line: 2, message: "" },
55
- thre: { type: :indentation, line: 27, message: "" }
54
+ one: { type: :indentation, line: 1, message: '' },
55
+ two: { type: :indentation, line: 2, message: '' },
56
+ thre: { type: :indentation, line: 27, message: '' }
56
57
  }
57
58
  subject.instance_variable_set(:@problems, probs)
58
59
  subject.problem_count.should == 3
@@ -1,16 +1,16 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/formatter'
3
3
 
4
4
  describe Tailor::Formatter do
5
- describe "#problems_at_level" do
5
+ describe '#problems_at_level' do
6
6
  let(:problems) do
7
- msg = "File contains invalid Ruby; "
8
- msg << "run `ruby -c [your_file.rb]` for more details."
7
+ msg = 'File contains invalid Ruby; '
8
+ msg << 'run `ruby -c [your_file.rb]` for more details.'
9
9
 
10
10
  {
11
- "some_file.rb" => [
11
+ 'some_file.rb' => [
12
12
  {
13
- :type => "allow_invalid_ruby",
13
+ :type => 'allow_invalid_ruby',
14
14
  :line => 0,
15
15
  :column => 0,
16
16
  :message => msg,
@@ -20,20 +20,20 @@ describe Tailor::Formatter do
20
20
  }
21
21
  end
22
22
 
23
- context "problems are empty" do
24
- it "returns an empty Array" do
23
+ context 'problems are empty' do
24
+ it 'returns an empty Array' do
25
25
  subject.problems_at_level({}, :error).should == []
26
26
  end
27
27
  end
28
28
 
29
- context "the level asked for exists in the problems" do
30
- it "returns the problem" do
31
- msg = "File contains invalid Ruby; "
32
- msg << "run `ruby -c [your_file.rb]` for more details."
29
+ context 'the level asked for exists in the problems' do
30
+ it 'returns the problem' do
31
+ msg = 'File contains invalid Ruby; '
32
+ msg << 'run `ruby -c [your_file.rb]` for more details.'
33
33
 
34
34
  subject.problems_at_level(problems, :warn).should == [
35
35
  {
36
- :type => "allow_invalid_ruby",
36
+ :type => 'allow_invalid_ruby',
37
37
  :line => 0,
38
38
  :column => 0,
39
39
  :message => msg,
@@ -43,8 +43,8 @@ describe Tailor::Formatter do
43
43
  end
44
44
  end
45
45
 
46
- context "the level asked for does not exist in the problems" do
47
- it "returns an empty Array" do
46
+ context 'the level asked for does not exist in the problems' do
47
+ it 'returns an empty Array' do
48
48
  subject.problems_at_level(problems, :error).should == []
49
49
  end
50
50
  end
@@ -1,4 +1,4 @@
1
- require_relative '../../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/formatters/yaml'
3
3
  require 'yaml'
4
4
 
@@ -1,4 +1,4 @@
1
- require_relative '../../spec_helper'
1
+ require 'spec_helper'
2
2
  require 'tailor/lexed_line'
3
3
 
4
4
  describe Tailor::LexedLine do
@@ -8,43 +8,43 @@ describe Tailor::LexedLine do
8
8
 
9
9
  subject { Tailor::LexedLine.new(lexed_output, 1) }
10
10
 
11
- describe "#initialize" do
11
+ describe '#initialize' do
12
12
  let(:lexed_output) do
13
13
  [
14
- [[1, 0], :on_ident, "require"],
15
- [[1, 7], :on_sp, " "],
14
+ [[1, 0], :on_ident, 'require'],
15
+ [[1, 7], :on_sp, ' '],
16
16
  [[1, 8], :on_tstring_beg, "'"],
17
- [[1, 9], :on_tstring_content, "log_switch"],
17
+ [[1, 9], :on_tstring_content, 'log_switch'],
18
18
  [[1, 19], :on_tstring_end, "'"],
19
19
  [[1, 20], :on_nl, "\n"],
20
- [[2, 0], :on_ident, "require_relative"],
21
- [[2, 16], :on_sp, " "],
20
+ [[2, 0], :on_ident, 'require_relative'],
21
+ [[2, 16], :on_sp, ' '],
22
22
  [[2, 17], :on_tstring_beg, "'"],
23
- [[2, 18], :on_tstring_content, "tailor/runtime_error"],
23
+ [[2, 18], :on_tstring_content, 'tailor/runtime_error'],
24
24
  [[2, 38], :on_tstring_end, "'"],
25
25
  [[2, 39], :on_nl, "\n"]
26
26
  ]
27
27
  end
28
28
 
29
- it "returns all lexed output from line 1 when self.lineno is 1" do
29
+ it 'returns all lexed output from line 1 when self.lineno is 1' do
30
30
  line = Tailor::LexedLine.new(lexed_output, 1)
31
31
 
32
32
  line.should == [
33
- [[1, 0], :on_ident, "require"],
34
- [[1, 7], :on_sp, " "],
33
+ [[1, 0], :on_ident, 'require'],
34
+ [[1, 7], :on_sp, ' '],
35
35
  [[1, 8], :on_tstring_beg, "'"],
36
- [[1, 9], :on_tstring_content, "log_switch"],
36
+ [[1, 9], :on_tstring_content, 'log_switch'],
37
37
  [[1, 19], :on_tstring_end, "'"],
38
38
  [[1, 20], :on_nl, "\n"]
39
39
  ]
40
40
  end
41
41
  end
42
42
 
43
- describe "#only_spaces?" do
43
+ describe '#only_spaces?' do
44
44
  context '0 length line, no \n ending' do
45
- let(:lexed_output) { [[[1, 0], :on_sp, " "]] }
45
+ let(:lexed_output) { [[[1, 0], :on_sp, ' ']] }
46
46
 
47
- it "should return true" do
47
+ it 'should return true' do
48
48
  subject.only_spaces?.should be_true
49
49
  end
50
50
  end
@@ -52,15 +52,15 @@ describe Tailor::LexedLine do
52
52
  context '0 length line, with \n ending' do
53
53
  let(:lexed_output) { [[[1, 0], :on_nl, "\n"]] }
54
54
 
55
- it "should return true" do
55
+ it 'should return true' do
56
56
  subject.only_spaces?.should be_true
57
57
  end
58
58
  end
59
59
 
60
60
  context 'comment line, starting at column 0' do
61
- let(:lexed_output) { [[[1, 0], :on_comment, "# comment"]] }
61
+ let(:lexed_output) { [[[1, 0], :on_comment, '# comment']] }
62
62
 
63
- it "should return false" do
63
+ it 'should return false' do
64
64
  subject.only_spaces?.should be_false
65
65
  end
66
66
  end
@@ -68,12 +68,12 @@ describe Tailor::LexedLine do
68
68
  context 'comment line, starting at column 2' do
69
69
  let(:lexed_output) do
70
70
  [
71
- [[1, 0], :on_sp, " "],
72
- [[1, 2], :on_comment, "# comment"]
71
+ [[1, 0], :on_sp, ' '],
72
+ [[1, 2], :on_comment, '# comment']
73
73
  ]
74
74
  end
75
75
 
76
- it "should return false" do
76
+ it 'should return false' do
77
77
  subject.only_spaces?.should be_false
78
78
  end
79
79
  end
@@ -81,97 +81,97 @@ describe Tailor::LexedLine do
81
81
  context 'code line, starting at column 2' do
82
82
  let(:lexed_output) do
83
83
  [
84
- [[1, 0], :on_ident, "puts"],
85
- [[1, 4], :on_sp, " "],
84
+ [[1, 0], :on_ident, 'puts'],
85
+ [[1, 4], :on_sp, ' '],
86
86
  [[1, 5], :on_tstring_beg, "'"],
87
- [[1, 6], :on_tstring_content, "thing"],
87
+ [[1, 6], :on_tstring_content, 'thing'],
88
88
  [[1, 11], :on_tstring_end, "'"],
89
89
  [[1, 12], :on_nl, "\n"]
90
90
  ]
91
91
  end
92
92
 
93
- it "should return false" do
93
+ it 'should return false' do
94
94
  subject.only_spaces?.should be_false
95
95
  end
96
96
  end
97
97
  end
98
98
 
99
- describe "#ends_with_op?" do
100
- context "line ends with a +, then \\n" do
99
+ describe '#ends_with_op?' do
100
+ context 'line ends with a +, then \\n' do
101
101
  let(:lexed_output) do
102
102
  [
103
- [[1, 0], :on_ident, "thing"],
104
- [[1, 5], :on_sp, " "],
105
- [[1, 6], :on_op, "="],
106
- [[1, 7], :on_sp, " "],
107
- [[1, 8], :on_int, "1"],
108
- [[1, 9], :on_sp, " "],
109
- [[1, 10], :on_op, "+"],
103
+ [[1, 0], :on_ident, 'thing'],
104
+ [[1, 5], :on_sp, ' '],
105
+ [[1, 6], :on_op, '='],
106
+ [[1, 7], :on_sp, ' '],
107
+ [[1, 8], :on_int, '1'],
108
+ [[1, 9], :on_sp, ' '],
109
+ [[1, 10], :on_op, '+'],
110
110
  [[1, 11], :on_ignored_nl, "\n"],
111
111
  [[1, 11], :on_ignored_nl, "\n"]
112
112
  ]
113
113
  end
114
114
 
115
- it "returns true" do
115
+ it 'returns true' do
116
116
  subject.ends_with_op?.should be_true
117
117
  end
118
118
  end
119
119
 
120
- context "line ends with not an operator, then \\n" do
120
+ context 'line ends with not an operator, then \\n' do
121
121
  let(:lexed_output) do
122
122
  [
123
- [[1, 0], :on_ident, "thing"],
124
- [[1, 5], :on_sp, " "],
125
- [[1, 6], :on_op, "="],
126
- [[1, 7], :on_sp, " "],
127
- [[1, 8], :on_int, "1"],
123
+ [[1, 0], :on_ident, 'thing'],
124
+ [[1, 5], :on_sp, ' '],
125
+ [[1, 6], :on_op, '='],
126
+ [[1, 7], :on_sp, ' '],
127
+ [[1, 8], :on_int, '1'],
128
128
  [[1, 11], :on_nl, "\n"]
129
129
  ]
130
130
  end
131
131
 
132
- it "returns false" do
132
+ it 'returns false' do
133
133
  subject.ends_with_op?.should be_false
134
134
  end
135
135
  end
136
136
  end
137
137
 
138
- describe "#ends_with_modifier_kw?" do
139
- context "ends_with_kw? is false" do
138
+ describe '#ends_with_modifier_kw?' do
139
+ context 'ends_with_kw? is false' do
140
140
  let(:lexed_output) do
141
141
  [
142
- [[1, 0], :on_ident, "thing"],
143
- [[1, 5], :on_sp, " "],
144
- [[1, 6], :on_op, "="],
145
- [[1, 7], :on_sp, " "],
146
- [[1, 8], :on_int, "1"],
142
+ [[1, 0], :on_ident, 'thing'],
143
+ [[1, 5], :on_sp, ' '],
144
+ [[1, 6], :on_op, '='],
145
+ [[1, 7], :on_sp, ' '],
146
+ [[1, 8], :on_int, '1'],
147
147
  [[1, 9], :on_ignored_nl, "\n"]
148
148
  ]
149
149
  end
150
150
 
151
151
  before { subject.stub(:ends_with_kw?).and_return true }
152
152
 
153
- it "returns false" do
153
+ it 'returns false' do
154
154
  subject.ends_with_modifier_kw?.should be_false
155
155
  end
156
156
  end
157
157
 
158
- context "#ends_with_kw? is true" do
158
+ context '#ends_with_kw? is true' do
159
159
  let(:lexed_output) do
160
160
  [
161
- [[1, 0], :on_ident, "thing"],
162
- [[1, 5], :on_sp, " "],
163
- [[1, 6], :on_op, "="],
164
- [[1, 7], :on_sp, " "],
165
- [[1, 8], :on_int, "1"],
166
- [[1, 9], :on_sp, " "],
167
- [[1, 10], :on_kw, "if"],
161
+ [[1, 0], :on_ident, 'thing'],
162
+ [[1, 5], :on_sp, ' '],
163
+ [[1, 6], :on_op, '='],
164
+ [[1, 7], :on_sp, ' '],
165
+ [[1, 8], :on_int, '1'],
166
+ [[1, 9], :on_sp, ' '],
167
+ [[1, 10], :on_kw, 'if'],
168
168
  [[1, 12], :on_ignored_nl, "\n"]
169
169
  ]
170
170
  end
171
171
 
172
- let(:token) { double "Token" }
172
+ let(:token) { double 'Token' }
173
173
 
174
- context "the keyword is a modifier" do
174
+ context 'the keyword is a modifier' do
175
175
  before do
176
176
  token.stub(:modifier_keyword?).and_return true
177
177
  Tailor::Lexer::Token.stub(:new).and_return token
@@ -180,12 +180,12 @@ describe Tailor::LexedLine do
180
180
 
181
181
  after { Tailor::Lexer::Token.unstub(:new) }
182
182
 
183
- it "returns true" do
183
+ it 'returns true' do
184
184
  subject.ends_with_modifier_kw?.should be_true
185
185
  end
186
186
  end
187
187
 
188
- context "the keyword is not a modifier" do
188
+ context 'the keyword is not a modifier' do
189
189
  before do
190
190
  token.stub(:modifier_keyword?).and_return false
191
191
  Tailor::Lexer::Token.stub(:new).and_return token
@@ -194,84 +194,84 @@ describe Tailor::LexedLine do
194
194
 
195
195
  after { Tailor::Lexer::Token.unstub(:new) }
196
196
 
197
- it "returns true" do
197
+ it 'returns true' do
198
198
  subject.ends_with_modifier_kw?.should be_false
199
199
  end
200
200
  end
201
201
  end
202
202
  end
203
203
 
204
- describe "#does_line_end_with" do
204
+ describe '#does_line_end_with' do
205
205
  let(:lexed_output) do
206
206
  [
207
- [[1, 0], :on_kw, "def"],
208
- [[1, 3], :on_sp, " "],
209
- [[1, 4], :on_ident, "thing"],
210
- [[1, 9], :on_sp, " "],
207
+ [[1, 0], :on_kw, 'def'],
208
+ [[1, 3], :on_sp, ' '],
209
+ [[1, 4], :on_ident, 'thing'],
210
+ [[1, 9], :on_sp, ' '],
211
211
  [[1, 10], :on_nl, "\n"]
212
212
  ]
213
213
  end
214
214
 
215
- context "line ends with the event" do
216
- it "returns true" do
215
+ context 'line ends with the event' do
216
+ it 'returns true' do
217
217
  subject.does_line_end_with(:on_sp).should be_true
218
218
  end
219
219
  end
220
220
 
221
- context "line does not even with event" do
222
- it "returns false" do
221
+ context 'line does not even with event' do
222
+ it 'returns false' do
223
223
  subject.does_line_end_with(:on_kw).should be_false
224
224
  end
225
225
  end
226
226
  end
227
227
 
228
- describe "#last_non_line_feed_event" do
229
- context "line ends with a space" do
228
+ describe '#last_non_line_feed_event' do
229
+ context 'line ends with a space' do
230
230
  let(:lexed_output) do
231
231
  [
232
- [[1, 0], :on_kw, "def"],
233
- [[1, 3], :on_sp, " "],
234
- [[1, 4], :on_ident, "thing"],
235
- [[1, 9], :on_sp, " "],
232
+ [[1, 0], :on_kw, 'def'],
233
+ [[1, 3], :on_sp, ' '],
234
+ [[1, 4], :on_ident, 'thing'],
235
+ [[1, 9], :on_sp, ' '],
236
236
  [[1, 10], :on_nl, "\n"]
237
237
  ]
238
238
  end
239
239
 
240
- it "returns the space" do
241
- subject.last_non_line_feed_event.should == [[1, 9], :on_sp, " "]
240
+ it 'returns the space' do
241
+ subject.last_non_line_feed_event.should == [[1, 9], :on_sp, ' ']
242
242
  end
243
243
  end
244
244
 
245
- context "line ends with a backslash" do
245
+ context 'line ends with a backslash' do
246
246
  let(:lexed_output) do
247
247
  [
248
- [[1, 0], :on_kw, "def"],
249
- [[1, 3], :on_sp, " "],
250
- [[1, 4], :on_ident, "thing"],
248
+ [[1, 0], :on_kw, 'def'],
249
+ [[1, 3], :on_sp, ' '],
250
+ [[1, 4], :on_ident, 'thing'],
251
251
  [[1, 9], :on_sp, "\\\n"]
252
252
  ]
253
253
  end
254
254
 
255
- it "returns the event before it" do
256
- subject.last_non_line_feed_event.should == [[1, 4], :on_ident, "thing"]
255
+ it 'returns the event before it' do
256
+ subject.last_non_line_feed_event.should == [[1, 4], :on_ident, 'thing']
257
257
  end
258
258
  end
259
259
  end
260
260
 
261
- describe "#loop_with_do?" do
261
+ describe '#loop_with_do?' do
262
262
  context "line is 'while true do\\n'" do
263
263
  let(:lexed_output) do
264
264
  [
265
- [[1, 0], :on_kw, "while"],
266
- [[1, 5], :on_sp, " "],
267
- [[1, 6], :on_kw, "true"],
268
- [[1, 10], :on_sp, " "],
269
- [[1, 11], :on_kw, "do"],
265
+ [[1, 0], :on_kw, 'while'],
266
+ [[1, 5], :on_sp, ' '],
267
+ [[1, 6], :on_kw, 'true'],
268
+ [[1, 10], :on_sp, ' '],
269
+ [[1, 11], :on_kw, 'do'],
270
270
  [[1, 13], :on_ignored_nl, "\n"]
271
271
  ]
272
272
  end
273
273
 
274
- it "returns true" do
274
+ it 'returns true' do
275
275
  subject.loop_with_do?.should be_true
276
276
  end
277
277
  end
@@ -279,15 +279,15 @@ describe Tailor::LexedLine do
279
279
  context "line is 'while true\\n'" do
280
280
  let(:lexed_output) do
281
281
  [
282
- [[1, 0], :on_kw, "while"],
283
- [[1, 5], :on_sp, " "],
284
- [[1, 6], :on_kw, "true"],
285
- [[1, 10], :on_sp, " "],
282
+ [[1, 0], :on_kw, 'while'],
283
+ [[1, 5], :on_sp, ' '],
284
+ [[1, 6], :on_kw, 'true'],
285
+ [[1, 10], :on_sp, ' '],
286
286
  [[1, 11], :on_ignored_nl, "\n"]
287
287
  ]
288
288
  end
289
289
 
290
- it "returns false" do
290
+ it 'returns false' do
291
291
  subject.loop_with_do?.should be_false
292
292
  end
293
293
  end
@@ -295,16 +295,16 @@ describe Tailor::LexedLine do
295
295
  context "line is 'until true do\\n'" do
296
296
  let(:lexed_output) do
297
297
  [
298
- [[1, 0], :on_kw, "until"],
299
- [[1, 5], :on_sp, " "],
300
- [[1, 6], :on_kw, "true"],
301
- [[1, 10], :on_sp, " "],
302
- [[1, 11], :on_kw, "do"],
298
+ [[1, 0], :on_kw, 'until'],
299
+ [[1, 5], :on_sp, ' '],
300
+ [[1, 6], :on_kw, 'true'],
301
+ [[1, 10], :on_sp, ' '],
302
+ [[1, 11], :on_kw, 'do'],
303
303
  [[1, 13], :on_ignored_nl, "\n"]
304
304
  ]
305
305
  end
306
306
 
307
- it "returns true" do
307
+ it 'returns true' do
308
308
  subject.loop_with_do?.should be_true
309
309
  end
310
310
  end
@@ -312,15 +312,15 @@ describe Tailor::LexedLine do
312
312
  context "line is 'until true\\n'" do
313
313
  let(:lexed_output) do
314
314
  [
315
- [[1, 0], :on_kw, "until"],
316
- [[1, 5], :on_sp, " "],
317
- [[1, 6], :on_kw, "true"],
318
- [[1, 10], :on_sp, " "],
315
+ [[1, 0], :on_kw, 'until'],
316
+ [[1, 5], :on_sp, ' '],
317
+ [[1, 6], :on_kw, 'true'],
318
+ [[1, 10], :on_sp, ' '],
319
319
  [[1, 11], :on_ignored_nl, "\n"]
320
320
  ]
321
321
  end
322
322
 
323
- it "returns false" do
323
+ it 'returns false' do
324
324
  subject.loop_with_do?.should be_false
325
325
  end
326
326
  end
@@ -328,22 +328,22 @@ describe Tailor::LexedLine do
328
328
  context "line is 'for i in 1..5 do\\n'" do
329
329
  let(:lexed_output) do
330
330
  [
331
- [[1, 0], :on_kw, "for"],
332
- [[1, 3], :on_sp, " "],
333
- [[1, 4], :on_ident, "i"],
334
- [[1, 5], :on_sp, " "],
335
- [[1, 6], :on_kw, "in"],
336
- [[1, 8], :on_sp, " "],
337
- [[1, 9], :on_int, "1"],
338
- [[1, 10], :on_op, ".."],
339
- [[1, 12], :on_int, "5"],
340
- [[1, 13], :on_sp, " "],
341
- [[1, 14], :on_kw, "do"],
331
+ [[1, 0], :on_kw, 'for'],
332
+ [[1, 3], :on_sp, ' '],
333
+ [[1, 4], :on_ident, 'i'],
334
+ [[1, 5], :on_sp, ' '],
335
+ [[1, 6], :on_kw, 'in'],
336
+ [[1, 8], :on_sp, ' '],
337
+ [[1, 9], :on_int, '1'],
338
+ [[1, 10], :on_op, '..'],
339
+ [[1, 12], :on_int, '5'],
340
+ [[1, 13], :on_sp, ' '],
341
+ [[1, 14], :on_kw, 'do'],
342
342
  [[1, 16], :on_ignored_nl, "\n"]
343
343
  ]
344
344
  end
345
345
 
346
- it "returns true" do
346
+ it 'returns true' do
347
347
  subject.loop_with_do?.should be_true
348
348
  end
349
349
  end
@@ -351,31 +351,31 @@ describe Tailor::LexedLine do
351
351
  context "line is 'for i in 1..5\\n'" do
352
352
  let(:lexed_output) do
353
353
  [
354
- [[1, 0], :on_kw, "for"],
355
- [[1, 3], :on_sp, " "],
356
- [[1, 4], :on_ident, "i"],
357
- [[1, 5], :on_sp, " "],
358
- [[1, 6], :on_kw, "in"],
359
- [[1, 8], :on_sp, " "],
360
- [[1, 9], :on_int, "1"],
361
- [[1, 10], :on_op, ".."],
362
- [[1, 12], :on_int, "5"],
363
- [[1, 13], :on_sp, " "],
354
+ [[1, 0], :on_kw, 'for'],
355
+ [[1, 3], :on_sp, ' '],
356
+ [[1, 4], :on_ident, 'i'],
357
+ [[1, 5], :on_sp, ' '],
358
+ [[1, 6], :on_kw, 'in'],
359
+ [[1, 8], :on_sp, ' '],
360
+ [[1, 9], :on_int, '1'],
361
+ [[1, 10], :on_op, '..'],
362
+ [[1, 12], :on_int, '5'],
363
+ [[1, 13], :on_sp, ' '],
364
364
  [[1, 14], :on_ignored_nl, "\n"]
365
365
  ]
366
366
  end
367
367
 
368
- it "returns false" do
368
+ it 'returns false' do
369
369
  subject.loop_with_do?.should be_false
370
370
  end
371
371
  end
372
372
  end
373
373
 
374
- describe "#first_non_space_element" do
375
- context "lexed line contains only spaces" do
376
- let(:lexed_output) { [[[1, 0], :on_sp, " "]] }
374
+ describe '#first_non_space_element' do
375
+ context 'lexed line contains only spaces' do
376
+ let(:lexed_output) { [[[1, 0], :on_sp, ' ']] }
377
377
 
378
- it "returns nil" do
378
+ it 'returns nil' do
379
379
  subject.first_non_space_element.should be_nil
380
380
  end
381
381
  end
@@ -383,7 +383,7 @@ describe Tailor::LexedLine do
383
383
  context "lexed line contains only \\n" do
384
384
  let(:lexed_output) { [[[1, 0], :on_ignored_nl, "\n"]] }
385
385
 
386
- it "returns nil" do
386
+ it 'returns nil' do
387
387
  subject.first_non_space_element.should be_nil
388
388
  end
389
389
  end
@@ -391,56 +391,56 @@ describe Tailor::LexedLine do
391
391
  context "lexed line contains ' }\\n'" do
392
392
  let(:lexed_output) do
393
393
  [
394
- [[1, 0], :on_sp, " "],
395
- [[1, 2], :on_rbrace, "}"],
394
+ [[1, 0], :on_sp, ' '],
395
+ [[1, 2], :on_rbrace, '}'],
396
396
  [[1, 3], :on_nl, "\n"]
397
397
  ]
398
398
  end
399
399
 
400
- it "returns nil" do
401
- subject.first_non_space_element.should == [[1, 2], :on_rbrace, "}"]
400
+ it 'returns nil' do
401
+ subject.first_non_space_element.should == [[1, 2], :on_rbrace, '}']
402
402
  end
403
403
  end
404
404
  end
405
405
 
406
- describe "#event_at" do
407
- let(:lexed_output) { [[[1, 0], :on_sp, " "]] }
406
+ describe '#event_at' do
407
+ let(:lexed_output) { [[[1, 0], :on_sp, ' ']] }
408
408
 
409
- context "self contains an event at the given column" do
410
- it "returns that event" do
409
+ context 'self contains an event at the given column' do
410
+ it 'returns that event' do
411
411
  subject.event_at(0).should == lexed_output.first
412
412
  end
413
413
  end
414
414
 
415
- context "self does not contain an event at the given column" do
416
- it "returns nil" do
415
+ context 'self does not contain an event at the given column' do
416
+ it 'returns nil' do
417
417
  subject.event_at(1234).should be_nil
418
418
  end
419
419
  end
420
420
  end
421
421
 
422
- describe "#event_index" do
423
- let(:lexed_output) { [[[1, 0], :on_sp, " "]] }
422
+ describe '#event_index' do
423
+ let(:lexed_output) { [[[1, 0], :on_sp, ' ']] }
424
424
 
425
- context "#event_at returns nil" do
425
+ context '#event_at returns nil' do
426
426
  before { subject.stub(:event_at).and_return nil }
427
427
  specify { subject.event_index(1234).should be_nil }
428
428
  end
429
429
 
430
- context "#event_at returns a valid column" do
431
- it "returns the event" do
430
+ context '#event_at returns a valid column' do
431
+ it 'returns the event' do
432
432
  subject.event_index(0).should be_zero
433
433
  end
434
434
  end
435
435
  end
436
436
 
437
- describe "#to_s" do
437
+ describe '#to_s' do
438
438
  let(:lexed_output) do
439
439
  [
440
- [[1, 0], :on_kw, "def"],
441
- [[1, 3], :on_sp, " "],
442
- [[1, 4], :on_ident, "thing"],
443
- [[1, 9], :on_sp, " "],
440
+ [[1, 0], :on_kw, 'def'],
441
+ [[1, 3], :on_sp, ' '],
442
+ [[1, 4], :on_ident, 'thing'],
443
+ [[1, 9], :on_sp, ' '],
444
444
  [[1, 10], :on_nl, "\n"]
445
445
  ]
446
446
  end
@@ -450,18 +450,18 @@ describe Tailor::LexedLine do
450
450
  end
451
451
  end
452
452
 
453
- describe "#remove_comment_at" do
454
- context "stuff before comment is an incomplete statement" do
455
- context "spaces before comment" do
453
+ describe '#remove_comment_at' do
454
+ context 'stuff before comment is an incomplete statement' do
455
+ context 'spaces before comment' do
456
456
  let(:lexed_output) do
457
457
  [
458
- [[1, 0], :on_kw, "def"],
459
- [[1, 3], :on_sp, " "],
460
- [[1, 4], :on_ident, "thing"],
461
- [[1, 9], :on_sp, " "],
462
- [[1, 10], :on_ident, "one"],
463
- [[1, 13], :on_comma, ","],
464
- [[1, 14], :on_sp, " "],
458
+ [[1, 0], :on_kw, 'def'],
459
+ [[1, 3], :on_sp, ' '],
460
+ [[1, 4], :on_ident, 'thing'],
461
+ [[1, 9], :on_sp, ' '],
462
+ [[1, 10], :on_ident, 'one'],
463
+ [[1, 13], :on_comma, ','],
464
+ [[1, 14], :on_sp, ' '],
465
465
  [[1, 16], :on_comment, "# comment\n"]
466
466
  ]
467
467
  end
@@ -470,28 +470,28 @@ describe Tailor::LexedLine do
470
470
  "def thing one, # comment\n two\nend\n"
471
471
  end
472
472
 
473
- it "replaces the comment with an :on_ignored_nl" do
473
+ it 'replaces the comment with an :on_ignored_nl' do
474
474
  subject.remove_trailing_comment(file_text).should == [
475
- [[1, 0], :on_kw, "def"],
476
- [[1, 3], :on_sp, " "],
477
- [[1, 4], :on_ident, "thing"],
478
- [[1, 9], :on_sp, " "],
479
- [[1, 10], :on_ident, "one"],
480
- [[1, 13], :on_comma, ","],
475
+ [[1, 0], :on_kw, 'def'],
476
+ [[1, 3], :on_sp, ' '],
477
+ [[1, 4], :on_ident, 'thing'],
478
+ [[1, 9], :on_sp, ' '],
479
+ [[1, 10], :on_ident, 'one'],
480
+ [[1, 13], :on_comma, ','],
481
481
  [[1, 14], :on_ignored_nl, "\n"]
482
482
  ]
483
483
  end
484
484
  end
485
485
 
486
- context "no spaces before comment" do
486
+ context 'no spaces before comment' do
487
487
  let(:lexed_output) do
488
488
  [
489
- [[1, 0], :on_kw, "def"],
490
- [[1, 3], :on_sp, " "],
491
- [[1, 4], :on_ident, "thing"],
492
- [[1, 9], :on_sp, " "],
493
- [[1, 10], :on_ident, "one"],
494
- [[1, 13], :on_comma, ","],
489
+ [[1, 0], :on_kw, 'def'],
490
+ [[1, 3], :on_sp, ' '],
491
+ [[1, 4], :on_ident, 'thing'],
492
+ [[1, 9], :on_sp, ' '],
493
+ [[1, 10], :on_ident, 'one'],
494
+ [[1, 13], :on_comma, ','],
495
495
  [[1, 14], :on_comment, "# comment\n"]
496
496
  ]
497
497
  end
@@ -500,30 +500,30 @@ describe Tailor::LexedLine do
500
500
  "def thing one,# comment\n two\nend\n"
501
501
  end
502
502
 
503
- it "replaces the comment with an :on_ignored_nl" do
503
+ it 'replaces the comment with an :on_ignored_nl' do
504
504
  subject.remove_trailing_comment(file_text).should == [
505
- [[1, 0], :on_kw, "def"],
506
- [[1, 3], :on_sp, " "],
507
- [[1, 4], :on_ident, "thing"],
508
- [[1, 9], :on_sp, " "],
509
- [[1, 10], :on_ident, "one"],
510
- [[1, 13], :on_comma, ","],
505
+ [[1, 0], :on_kw, 'def'],
506
+ [[1, 3], :on_sp, ' '],
507
+ [[1, 4], :on_ident, 'thing'],
508
+ [[1, 9], :on_sp, ' '],
509
+ [[1, 10], :on_ident, 'one'],
510
+ [[1, 13], :on_comma, ','],
511
511
  [[1, 14], :on_ignored_nl, "\n"]
512
512
  ]
513
513
  end
514
514
  end
515
515
  end
516
516
 
517
- context "stuff before comment is a complete statement" do
518
- context "spaces before comment" do
517
+ context 'stuff before comment is a complete statement' do
518
+ context 'spaces before comment' do
519
519
  let(:lexed_output) do
520
520
  [
521
- [[1, 0], :on_kw, "def"],
522
- [[1, 3], :on_sp, " "],
523
- [[1, 4], :on_ident, "thing"],
524
- [[1, 9], :on_sp, " "],
525
- [[1, 10], :on_ident, "one"],
526
- [[1, 13], :on_sp, " "],
521
+ [[1, 0], :on_kw, 'def'],
522
+ [[1, 3], :on_sp, ' '],
523
+ [[1, 4], :on_ident, 'thing'],
524
+ [[1, 9], :on_sp, ' '],
525
+ [[1, 10], :on_ident, 'one'],
526
+ [[1, 13], :on_sp, ' '],
527
527
  [[1, 15], :on_comment, "# comment\n"]
528
528
  ]
529
529
  end
@@ -532,26 +532,26 @@ describe Tailor::LexedLine do
532
532
  "def thing one # comment\n\nend\n"
533
533
  end
534
534
 
535
- it "replaces the comment with an :on_nl" do
535
+ it 'replaces the comment with an :on_nl' do
536
536
  subject.remove_trailing_comment(file_text).should == [
537
- [[1, 0], :on_kw, "def"],
538
- [[1, 3], :on_sp, " "],
539
- [[1, 4], :on_ident, "thing"],
540
- [[1, 9], :on_sp, " "],
541
- [[1, 10], :on_ident, "one"],
537
+ [[1, 0], :on_kw, 'def'],
538
+ [[1, 3], :on_sp, ' '],
539
+ [[1, 4], :on_ident, 'thing'],
540
+ [[1, 9], :on_sp, ' '],
541
+ [[1, 10], :on_ident, 'one'],
542
542
  [[1, 13], :on_nl, "\n"]
543
543
  ]
544
544
  end
545
545
  end
546
546
 
547
- context "no spaces before comment" do
547
+ context 'no spaces before comment' do
548
548
  let(:lexed_output) do
549
549
  [
550
- [[1, 0], :on_kw, "def"],
551
- [[1, 3], :on_sp, " "],
552
- [[1, 4], :on_ident, "thing"],
553
- [[1, 9], :on_sp, " "],
554
- [[1, 10], :on_ident, "one"],
550
+ [[1, 0], :on_kw, 'def'],
551
+ [[1, 3], :on_sp, ' '],
552
+ [[1, 4], :on_ident, 'thing'],
553
+ [[1, 9], :on_sp, ' '],
554
+ [[1, 10], :on_ident, 'one'],
555
555
  [[1, 13], :on_comment, "# comment\n"]
556
556
  ]
557
557
  end
@@ -560,18 +560,18 @@ describe Tailor::LexedLine do
560
560
  "def thing one# comment\n \nend\n"
561
561
  end
562
562
 
563
- it "replaces the comment with an :on_nl" do
563
+ it 'replaces the comment with an :on_nl' do
564
564
  subject.remove_trailing_comment(file_text).should == [
565
- [[1, 0], :on_kw, "def"],
566
- [[1, 3], :on_sp, " "],
567
- [[1, 4], :on_ident, "thing"],
568
- [[1, 9], :on_sp, " "],
569
- [[1, 10], :on_ident, "one"],
565
+ [[1, 0], :on_kw, 'def'],
566
+ [[1, 3], :on_sp, ' '],
567
+ [[1, 4], :on_ident, 'thing'],
568
+ [[1, 9], :on_sp, ' '],
569
+ [[1, 10], :on_ident, 'one'],
570
570
  [[1, 13], :on_nl, "\n"]
571
571
  ]
572
572
  end
573
573
 
574
- it "returns a LexedLine" do
574
+ it 'returns a LexedLine' do
575
575
  subject.remove_trailing_comment(file_text).
576
576
  should be_a Tailor::LexedLine
577
577
  end
@@ -579,50 +579,50 @@ describe Tailor::LexedLine do
579
579
  end
580
580
  end
581
581
 
582
- describe "#end_of_multi-line_string?" do
583
- context "lexed output is from the end of a multi-line % statement" do
582
+ describe '#end_of_multi-line_string?' do
583
+ context 'lexed output is from the end of a multi-line % statement' do
584
584
  let(:lexed_output) do
585
- [[[1, 11], :on_tstring_end, "}"], [[1, 12], :on_nl, "\n"]]
585
+ [[[1, 11], :on_tstring_end, '}'], [[1, 12], :on_nl, "\n"]]
586
586
  end
587
587
 
588
- it "returns true" do
588
+ it 'returns true' do
589
589
  subject.end_of_multi_line_string?.should be_true
590
590
  end
591
591
  end
592
592
 
593
- context "lexed output is not from the end of a multi-line % statement" do
593
+ context 'lexed output is not from the end of a multi-line % statement' do
594
594
  let(:lexed_output) do
595
- [[[1, 11], :on_comma, ","], [[1, 12], :on_nl, "\n"]]
595
+ [[[1, 11], :on_comma, ','], [[1, 12], :on_nl, "\n"]]
596
596
  end
597
597
 
598
- it "returns true" do
598
+ it 'returns true' do
599
599
  subject.end_of_multi_line_string?.should be_false
600
600
  end
601
601
  end
602
602
 
603
- context "lexed output contains start AND end of a multi-line % statement" do
603
+ context 'lexed output contains start AND end of a multi-line % statement' do
604
604
  let(:lexed_output) do
605
605
  [
606
- [[1, 0], :on_tstring_beg, "%Q{"],
607
- [[1, 3], :on_tstring_content, "this is a t string! suckaaaaaa!"],
608
- [[1, 32], :on_tstring_end, "}"]
606
+ [[1, 0], :on_tstring_beg, '%Q{'],
607
+ [[1, 3], :on_tstring_content, 'this is a t string! suckaaaaaa!'],
608
+ [[1, 32], :on_tstring_end, '}']
609
609
  ]
610
610
  end
611
611
 
612
- it "returns true" do
612
+ it 'returns true' do
613
613
  subject.end_of_multi_line_string?.should be_false
614
614
  end
615
615
  end
616
616
  end
617
617
 
618
- describe "#is_line_only_a" do
618
+ describe '#is_line_only_a' do
619
619
  let(:lexed_output) do
620
- [[[1, 11], :on_comma, ","], [[1, 12], :on_nl, "\n"]]
620
+ [[[1, 11], :on_comma, ','], [[1, 12], :on_nl, "\n"]]
621
621
  end
622
622
 
623
- context "last event is not the event passed in" do
623
+ context 'last event is not the event passed in' do
624
624
  let(:last_event) do
625
- [[[1, 11], :on_comma, ","]]
625
+ [[[1, 11], :on_comma, ',']]
626
626
  end
627
627
 
628
628
  before do
@@ -632,24 +632,24 @@ describe Tailor::LexedLine do
632
632
  specify { subject.is_line_only_a(:on_period).should be_false }
633
633
  end
634
634
 
635
- context "last event is the last event passed in" do
636
- context "there is only space before the last event" do
635
+ context 'last event is the last event passed in' do
636
+ context 'there is only space before the last event' do
637
637
  let(:lexed_output) do
638
638
  [
639
639
  [[1, 0], :on_sp, ' '],
640
- [[1, 11], :on_comma, ","],
640
+ [[1, 11], :on_comma, ','],
641
641
  [[1, 12], :on_nl, "\n"]]
642
642
  end
643
643
 
644
644
  specify { subject.is_line_only_a(:on_comma).should be_true }
645
645
  end
646
646
 
647
- context "there is non-spaces before the last event" do
647
+ context 'there is non-spaces before the last event' do
648
648
  let(:lexed_output) do
649
649
  [
650
- [[1, 0], :on_sp, " "],
651
- [[1, 8], :on_ident, "one"],
652
- [[1, 11], :on_comma, ","],
650
+ [[1, 0], :on_sp, ' '],
651
+ [[1, 8], :on_ident, 'one'],
652
+ [[1, 11], :on_comma, ','],
653
653
  [[1, 12], :on_nl, "\n"]]
654
654
  end
655
655
 
@@ -658,57 +658,57 @@ describe Tailor::LexedLine do
658
658
  end
659
659
  end
660
660
 
661
- describe "#keyword_is_symbol?" do
662
- context "last event in line is not a keyword" do
661
+ describe '#keyword_is_symbol?' do
662
+ context 'last event in line is not a keyword' do
663
663
  let(:lexed_output) do
664
664
  [
665
- [[1, 0], :on_sp, " "],
666
- [[1, 8], :on_ident, "one"],
667
- [[1, 11], :on_comma, ","],
665
+ [[1, 0], :on_sp, ' '],
666
+ [[1, 8], :on_ident, 'one'],
667
+ [[1, 11], :on_comma, ','],
668
668
  [[1, 12], :on_nl, "\n"]]
669
669
  end
670
670
 
671
- it "returns false" do
671
+ it 'returns false' do
672
672
  subject.keyword_is_symbol?.should be_false
673
673
  end
674
674
  end
675
675
 
676
- context "last event in line is a keyword" do
677
- context "previous event is nil" do
676
+ context 'last event in line is a keyword' do
677
+ context 'previous event is nil' do
678
678
  let(:lexed_output) do
679
679
  [
680
- [[1, 0], :on_kw, "class"]
680
+ [[1, 0], :on_kw, 'class']
681
681
  ]
682
682
  end
683
683
 
684
- it "returns false" do
684
+ it 'returns false' do
685
685
  subject.keyword_is_symbol?.should be_false
686
686
  end
687
687
  end
688
688
 
689
- context "previous event is not :on_symbeg" do
689
+ context 'previous event is not :on_symbeg' do
690
690
  let(:lexed_output) do
691
691
  [
692
- [[1, 0], :on_sp, " "],
693
- [[1, 2], :on_kw, "class"]
692
+ [[1, 0], :on_sp, ' '],
693
+ [[1, 2], :on_kw, 'class']
694
694
  ]
695
695
  end
696
696
 
697
- it "returns false" do
697
+ it 'returns false' do
698
698
  subject.keyword_is_symbol?.should be_false
699
699
  end
700
700
  end
701
701
 
702
- context "previous event is :on_symbeg" do
702
+ context 'previous event is :on_symbeg' do
703
703
  let(:lexed_output) do
704
704
  [
705
- [[1, 0], :on_const, "INDENT_OK"],
706
- [[1, 9], :on_lbracket, "["],
707
- [[1, 10], :on_symbeg, ":"],
708
- [[1, 11], :on_kw, "class"]]
705
+ [[1, 0], :on_const, 'INDENT_OK'],
706
+ [[1, 9], :on_lbracket, '['],
707
+ [[1, 10], :on_symbeg, ':'],
708
+ [[1, 11], :on_kw, 'class']]
709
709
  end
710
710
 
711
- it "returns true" do
711
+ it 'returns true' do
712
712
  subject.keyword_is_symbol?.should be_true
713
713
  end
714
714
  end