thor 0.16.0 → 0.17.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 (52) hide show
  1. data/.rspec +1 -0
  2. data/.travis.yml +2 -1
  3. data/CHANGELOG.rdoc +8 -0
  4. data/Gemfile +12 -8
  5. data/lib/thor.rb +79 -10
  6. data/lib/thor/actions.rb +13 -13
  7. data/lib/thor/actions/directory.rb +29 -10
  8. data/lib/thor/actions/file_manipulation.rb +8 -2
  9. data/lib/thor/base.rb +24 -11
  10. data/lib/thor/core_ext/hash_with_indifferent_access.rb +5 -0
  11. data/lib/thor/group.rb +5 -5
  12. data/lib/thor/parser/options.rb +63 -25
  13. data/lib/thor/rake_compat.rb +3 -2
  14. data/lib/thor/runner.rb +1 -1
  15. data/lib/thor/shell/basic.rb +16 -16
  16. data/lib/thor/shell/color.rb +9 -9
  17. data/lib/thor/shell/html.rb +9 -9
  18. data/lib/thor/task.rb +2 -2
  19. data/lib/thor/version.rb +1 -1
  20. data/spec/actions/create_file_spec.rb +30 -30
  21. data/spec/actions/create_link_spec.rb +12 -12
  22. data/spec/actions/directory_spec.rb +34 -27
  23. data/spec/actions/empty_directory_spec.rb +16 -16
  24. data/spec/actions/file_manipulation_spec.rb +62 -50
  25. data/spec/actions/inject_into_file_spec.rb +18 -18
  26. data/spec/actions_spec.rb +56 -56
  27. data/spec/base_spec.rb +69 -69
  28. data/spec/core_ext/hash_with_indifferent_access_spec.rb +19 -14
  29. data/spec/core_ext/ordered_hash_spec.rb +29 -29
  30. data/spec/exit_condition_spec.rb +3 -3
  31. data/spec/fixtures/preserve/script.sh +3 -0
  32. data/spec/fixtures/script.thor +5 -0
  33. data/spec/group_spec.rb +55 -55
  34. data/spec/invocation_spec.rb +26 -26
  35. data/spec/parser/argument_spec.rb +12 -12
  36. data/spec/parser/arguments_spec.rb +12 -12
  37. data/spec/parser/option_spec.rb +47 -47
  38. data/spec/parser/options_spec.rb +137 -72
  39. data/spec/rake_compat_spec.rb +11 -11
  40. data/spec/register_spec.rb +70 -8
  41. data/spec/runner_spec.rb +38 -38
  42. data/spec/shell/basic_spec.rb +49 -37
  43. data/spec/shell/color_spec.rb +13 -13
  44. data/spec/shell/html_spec.rb +3 -3
  45. data/spec/shell_spec.rb +7 -7
  46. data/spec/spec_helper.rb +4 -0
  47. data/spec/task_spec.rb +11 -11
  48. data/spec/thor_spec.rb +161 -91
  49. data/spec/util_spec.rb +42 -42
  50. data/thor.gemspec +1 -7
  51. metadata +8 -118
  52. data/lib/thor/core_ext/dir_escape.rb +0 -0
@@ -11,11 +11,11 @@ describe Thor::Actions::EmptyDirectory do
11
11
  end
12
12
 
13
13
  def invoke!
14
- capture(:stdout){ @action.invoke! }
14
+ capture(:stdout) { @action.invoke! }
15
15
  end
16
16
 
17
17
  def revoke!
18
- capture(:stdout){ @action.revoke! }
18
+ capture(:stdout) { @action.revoke! }
19
19
  end
20
20
 
21
21
  def base
@@ -24,12 +24,12 @@ describe Thor::Actions::EmptyDirectory do
24
24
 
25
25
  describe "#destination" do
26
26
  it "returns the full destination with the destination_root" do
27
- empty_directory('doc').destination.should == File.join(destination_root, 'doc')
27
+ expect(empty_directory('doc').destination).to eq(File.join(destination_root, 'doc'))
28
28
  end
29
29
 
30
30
  it "takes relative root into account" do
31
31
  base.inside('doc') do
32
- empty_directory('contents').destination.should == File.join(destination_root, 'doc', 'contents')
32
+ expect(empty_directory('contents').destination).to eq(File.join(destination_root, 'doc', 'contents'))
33
33
  end
34
34
  end
35
35
  end
@@ -37,7 +37,7 @@ describe Thor::Actions::EmptyDirectory do
37
37
  describe "#relative_destination" do
38
38
  it "returns the relative destination to the original destination root" do
39
39
  base.inside('doc') do
40
- empty_directory('contents').relative_destination.should == 'doc/contents'
40
+ expect(empty_directory('contents').relative_destination).to eq('doc/contents')
41
41
  end
42
42
  end
43
43
  end
@@ -45,7 +45,7 @@ describe Thor::Actions::EmptyDirectory do
45
45
  describe "#given_destination" do
46
46
  it "returns the destination supplied by the user" do
47
47
  base.inside('doc') do
48
- empty_directory('contents').given_destination.should == 'contents'
48
+ expect(empty_directory('contents').given_destination).to eq('contents')
49
49
  end
50
50
  end
51
51
  end
@@ -54,26 +54,26 @@ describe Thor::Actions::EmptyDirectory do
54
54
  it "copies the file to the specified destination" do
55
55
  empty_directory("doc")
56
56
  invoke!
57
- File.exists?(File.join(destination_root, "doc")).should be_true
57
+ expect(File.exists?(File.join(destination_root, "doc"))).to be_true
58
58
  end
59
59
 
60
60
  it "shows created status to the user" do
61
61
  empty_directory("doc")
62
- invoke!.should == " create doc\n"
62
+ expect(invoke!).to eq(" create doc\n")
63
63
  end
64
64
 
65
65
  it "does not create a directory if pretending" do
66
66
  base.inside("foo", :pretend => true) do
67
67
  empty_directory("ghost")
68
68
  end
69
- File.exists?(File.join(base.destination_root, "ghost")).should be_false
69
+ expect(File.exists?(File.join(base.destination_root, "ghost"))).to be_false
70
70
  end
71
71
 
72
72
  describe "when directory exists" do
73
73
  it "shows exist status" do
74
74
  empty_directory("doc")
75
75
  invoke!
76
- invoke!.should == " exist doc\n"
76
+ expect(invoke!).to eq(" exist doc\n")
77
77
  end
78
78
  end
79
79
  end
@@ -83,16 +83,16 @@ describe Thor::Actions::EmptyDirectory do
83
83
  empty_directory("doc")
84
84
  invoke!
85
85
  revoke!
86
- File.exists?(@action.destination).should be_false
86
+ expect(File.exists?(@action.destination)).to be_false
87
87
  end
88
88
  end
89
89
 
90
90
  describe "#exists?" do
91
91
  it "returns true if the destination file exists" do
92
92
  empty_directory("doc")
93
- @action.exists?.should be_false
93
+ expect(@action.exists?).to be_false
94
94
  invoke!
95
- @action.exists?.should be_true
95
+ expect(@action.exists?).to be_true
96
96
  end
97
97
  end
98
98
 
@@ -104,15 +104,15 @@ describe Thor::Actions::EmptyDirectory do
104
104
  end
105
105
 
106
106
  it "accepts and executes a 'legal' %\w+% encoded instruction" do
107
- @action.send(:convert_encoded_instructions, "%file_name%.txt").should == "expected.txt"
107
+ expect(@action.send(:convert_encoded_instructions, "%file_name%.txt")).to eq("expected.txt")
108
108
  end
109
109
 
110
110
  it "ignores an 'illegal' %\w+% encoded instruction" do
111
- @action.send(:convert_encoded_instructions, "%some_name%.txt").should == "%some_name%.txt"
111
+ expect(@action.send(:convert_encoded_instructions, "%some_name%.txt")).to eq("%some_name%.txt")
112
112
  end
113
113
 
114
114
  it "ignores incorrectly encoded instruction" do
115
- @action.send(:convert_encoded_instructions, "%some.name%.txt").should == "%some.name%.txt"
115
+ expect(@action.send(:convert_encoded_instructions, "%some.name%.txt")).to eq("%some.name%.txt")
116
116
  end
117
117
 
118
118
  it "raises an error if the instruction refers to a private method" do
@@ -8,15 +8,15 @@ describe Thor::Actions do
8
8
  end
9
9
 
10
10
  def action(*args, &block)
11
- capture(:stdout){ runner.send(*args, &block) }
11
+ capture(:stdout) { runner.send(*args, &block) }
12
12
  end
13
13
 
14
14
  def exists_and_identical?(source, destination)
15
15
  destination = File.join(destination_root, destination)
16
- File.exists?(destination).should be_true
16
+ expect(File.exists?(destination)).to be_true
17
17
 
18
18
  source = File.join(source_root, source)
19
- FileUtils.should be_identical(source, destination)
19
+ expect(FileUtils).to be_identical(source, destination)
20
20
  end
21
21
 
22
22
  def file
@@ -41,12 +41,12 @@ describe Thor::Actions do
41
41
 
42
42
  it "logs status" do
43
43
  FileUtils.should_receive(:chmod_R).with(0755, file)
44
- action(:chmod, "foo", 0755).should == " chmod foo\n"
44
+ expect(action(:chmod, "foo", 0755)).to eq(" chmod foo\n")
45
45
  end
46
46
 
47
47
  it "does not log status if required" do
48
48
  FileUtils.should_receive(:chmod_R).with(0755, file)
49
- action(:chmod, "foo", 0755, :verbose => false).should be_empty
49
+ expect(action(:chmod, "foo", 0755, :verbose => false)).to be_empty
50
50
  end
51
51
  end
52
52
 
@@ -68,15 +68,22 @@ describe Thor::Actions do
68
68
  exists_and_identical?("doc/README", "doc/README")
69
69
  end
70
70
 
71
+ it "copies file from source to default destination and preserves file mode" do
72
+ action :copy_file, "preserve/script.sh", :mode => :preserve
73
+ original = File.join(source_root, "preserve/script.sh")
74
+ copy = File.join(destination_root, "preserve/script.sh")
75
+ expect(File.stat(original).mode).to eq(File.stat(copy).mode)
76
+ end
77
+
71
78
  it "logs status" do
72
- action(:copy_file, "task.thor").should == " create task.thor\n"
79
+ expect(action(:copy_file, "task.thor")).to eq(" create task.thor\n")
73
80
  end
74
81
 
75
82
  it "accepts a block to change output" do
76
83
  action :copy_file, "task.thor" do |content|
77
84
  "OMG" + content
78
85
  end
79
- File.read(File.join(destination_root, "task.thor")).should =~ /^OMG/
86
+ expect(File.read(File.join(destination_root, "task.thor"))).to match(/^OMG/)
80
87
  end
81
88
  end
82
89
 
@@ -99,7 +106,7 @@ describe Thor::Actions do
99
106
  end
100
107
 
101
108
  it "logs status" do
102
- action(:link_file, "task.thor").should == " create task.thor\n"
109
+ expect(action(:link_file, "task.thor")).to eq(" create task.thor\n")
103
110
  end
104
111
  end
105
112
 
@@ -121,19 +128,19 @@ describe Thor::Actions do
121
128
 
122
129
  it "yields file content to a block" do
123
130
  action :get, "doc/README" do |content|
124
- content.should == "__start__\nREADME\n__end__\n"
131
+ expect(content).to eq("__start__\nREADME\n__end__\n")
125
132
  end
126
133
  end
127
134
 
128
135
  it "logs status" do
129
- action(:get, "doc/README", "docs/README").should == " create docs/README\n"
136
+ expect(action(:get, "doc/README", "docs/README")).to eq(" create docs/README\n")
130
137
  end
131
138
 
132
139
  it "accepts http remote sources" do
133
140
  body = "__start__\nHTTPFILE\n__end__\n"
134
141
  FakeWeb.register_uri(:get, 'http://example.com/file.txt', :body => body)
135
- action :get, 'http://example.com/file.txt' do |content|
136
- content.should == body
142
+ action :get, "http://example.com/file.txt" do |content|
143
+ expect(content).to eq(body)
137
144
  end
138
145
  FakeWeb.clean_registry
139
146
  end
@@ -141,8 +148,8 @@ describe Thor::Actions do
141
148
  it "accepts https remote sources" do
142
149
  body = "__start__\nHTTPSFILE\n__end__\n"
143
150
  FakeWeb.register_uri(:get, 'https://example.com/file.txt', :body => body)
144
- action :get, 'https://example.com/file.txt' do |content|
145
- content.should == body
151
+ action :get, "https://example.com/file.txt" do |content|
152
+ expect(content).to eq(body)
146
153
  end
147
154
  FakeWeb.clean_registry
148
155
  end
@@ -153,7 +160,7 @@ describe Thor::Actions do
153
160
  action :template, "doc/block_helper.rb"
154
161
 
155
162
  file = File.join(destination_root, "doc/block_helper.rb")
156
- File.read(file).should == "Hello world!"
163
+ expect(File.read(file)).to eq("Hello world!")
157
164
  end
158
165
 
159
166
  it "evaluates the template given as source" do
@@ -161,38 +168,38 @@ describe Thor::Actions do
161
168
  action :template, "doc/config.rb"
162
169
 
163
170
  file = File.join(destination_root, "doc/config.rb")
164
- File.read(file).should == "class Config; end\n"
171
+ expect(File.read(file)).to eq("class Config; end\n")
165
172
  end
166
173
 
167
174
  it "copies the template to the specified destination" do
168
175
  action :template, "doc/config.rb", "doc/configuration.rb"
169
176
  file = File.join(destination_root, "doc/configuration.rb")
170
- File.exists?(file).should be_true
177
+ expect(File.exists?(file)).to be_true
171
178
  end
172
179
 
173
180
  it "converts enconded instructions" do
174
181
  runner.should_receive(:file_name).and_return("rdoc")
175
182
  action :template, "doc/%file_name%.rb.tt"
176
183
  file = File.join(destination_root, "doc/rdoc.rb")
177
- File.exists?(file).should be_true
184
+ expect(File.exists?(file)).to be_true
178
185
  end
179
186
 
180
187
  it "logs status" do
181
- capture(:stdout){ runner.template("doc/config.rb") }.should == " create doc/config.rb\n"
188
+ expect(capture(:stdout) { runner.template("doc/config.rb") }).to eq(" create doc/config.rb\n")
182
189
  end
183
190
 
184
191
  it "accepts a block to change output" do
185
192
  action :template, "doc/config.rb" do |content|
186
193
  "OMG" + content
187
194
  end
188
- File.read(File.join(destination_root, "doc/config.rb")).should =~ /^OMG/
195
+ expect(File.read(File.join(destination_root, "doc/config.rb"))).to match(/^OMG/)
189
196
  end
190
197
 
191
198
  it "guesses the destination name when given only a source" do
192
199
  action :template, "doc/config.yaml.tt"
193
200
 
194
201
  file = File.join(destination_root, "doc/config.yaml")
195
- File.exists?(file).should be_true
202
+ expect(File.exists?(file)).to be_true
196
203
  end
197
204
  end
198
205
 
@@ -208,84 +215,84 @@ describe Thor::Actions do
208
215
  describe "#remove_file" do
209
216
  it "removes the file given" do
210
217
  action :remove_file, "doc/README"
211
- File.exists?(file).should be_false
218
+ expect(File.exists?(file)).to be_false
212
219
  end
213
220
 
214
221
  it "removes directories too" do
215
222
  action :remove_dir, "doc"
216
- File.exists?(File.join(destination_root, "doc")).should be_false
223
+ expect(File.exists?(File.join(destination_root, "doc"))).to be_false
217
224
  end
218
225
 
219
226
  it "does not remove if pretending" do
220
227
  runner(:pretend => true)
221
228
  action :remove_file, "doc/README"
222
- File.exists?(file).should be_true
229
+ expect(File.exists?(file)).to be_true
223
230
  end
224
231
 
225
232
  it "logs status" do
226
- action(:remove_file, "doc/README").should == " remove doc/README\n"
233
+ expect(action(:remove_file, "doc/README")).to eq(" remove doc/README\n")
227
234
  end
228
235
 
229
236
  it "does not log status if required" do
230
- action(:remove_file, "doc/README", :verbose => false).should be_empty
237
+ expect(action(:remove_file, "doc/README", :verbose => false)).to be_empty
231
238
  end
232
239
  end
233
240
 
234
241
  describe "#gsub_file" do
235
242
  it "replaces the content in the file" do
236
243
  action :gsub_file, "doc/README", "__start__", "START"
237
- File.binread(file).should == "START\nREADME\n__end__\n"
244
+ expect(File.binread(file)).to eq("START\nREADME\n__end__\n")
238
245
  end
239
246
 
240
247
  it "does not replace if pretending" do
241
248
  runner(:pretend => true)
242
249
  action :gsub_file, "doc/README", "__start__", "START"
243
- File.binread(file).should == "__start__\nREADME\n__end__\n"
250
+ expect(File.binread(file)).to eq("__start__\nREADME\n__end__\n")
244
251
  end
245
252
 
246
253
  it "accepts a block" do
247
254
  action(:gsub_file, "doc/README", "__start__"){ |match| match.gsub('__', '').upcase }
248
- File.binread(file).should == "START\nREADME\n__end__\n"
255
+ expect(File.binread(file)).to eq("START\nREADME\n__end__\n")
249
256
  end
250
257
 
251
258
  it "logs status" do
252
- action(:gsub_file, "doc/README", "__start__", "START").should == " gsub doc/README\n"
259
+ expect(action(:gsub_file, "doc/README", "__start__", "START")).to eq(" gsub doc/README\n")
253
260
  end
254
261
 
255
262
  it "does not log status if required" do
256
- action(:gsub_file, file, "__", :verbose => false){ |match| match * 2 }.should be_empty
263
+ expect(action(:gsub_file, file, "__", :verbose => false){ |match| match * 2 }).to be_empty
257
264
  end
258
265
  end
259
266
 
260
267
  describe "#append_to_file" do
261
268
  it "appends content to the file" do
262
269
  action :append_to_file, "doc/README", "END\n"
263
- File.binread(file).should == "__start__\nREADME\n__end__\nEND\n"
270
+ expect(File.binread(file)).to eq("__start__\nREADME\n__end__\nEND\n")
264
271
  end
265
272
 
266
273
  it "accepts a block" do
267
274
  action(:append_to_file, "doc/README"){ "END\n" }
268
- File.binread(file).should == "__start__\nREADME\n__end__\nEND\n"
275
+ expect(File.binread(file)).to eq("__start__\nREADME\n__end__\nEND\n")
269
276
  end
270
277
 
271
278
  it "logs status" do
272
- action(:append_to_file, "doc/README", "END").should == " append doc/README\n"
279
+ expect(action(:append_to_file, "doc/README", "END")).to eq(" append doc/README\n")
273
280
  end
274
281
  end
275
282
 
276
283
  describe "#prepend_to_file" do
277
284
  it "prepends content to the file" do
278
285
  action :prepend_to_file, "doc/README", "START\n"
279
- File.binread(file).should == "START\n__start__\nREADME\n__end__\n"
286
+ expect(File.binread(file)).to eq("START\n__start__\nREADME\n__end__\n")
280
287
  end
281
288
 
282
289
  it "accepts a block" do
283
290
  action(:prepend_to_file, "doc/README"){ "START\n" }
284
- File.binread(file).should == "START\n__start__\nREADME\n__end__\n"
291
+ expect(File.binread(file)).to eq("START\n__start__\nREADME\n__end__\n")
285
292
  end
286
293
 
287
294
  it "logs status" do
288
- action(:prepend_to_file, "doc/README", "START").should == " prepend doc/README\n"
295
+ expect(action(:prepend_to_file, "doc/README", "START")).to eq(" prepend doc/README\n")
289
296
  end
290
297
  end
291
298
 
@@ -296,21 +303,21 @@ describe Thor::Actions do
296
303
 
297
304
  it "appends content to a class" do
298
305
  action :inject_into_class, "application.rb", Application, " filter_parameters :password\n"
299
- File.binread(file).should == "class Application < Base\n filter_parameters :password\nend\n"
306
+ expect(File.binread(file)).to eq("class Application < Base\n filter_parameters :password\nend\n")
300
307
  end
301
308
 
302
309
  it "accepts a block" do
303
310
  action(:inject_into_class, "application.rb", Application){ " filter_parameters :password\n" }
304
- File.binread(file).should == "class Application < Base\n filter_parameters :password\nend\n"
311
+ expect(File.binread(file)).to eq("class Application < Base\n filter_parameters :password\nend\n")
305
312
  end
306
313
 
307
314
  it "logs status" do
308
- action(:inject_into_class, "application.rb", Application, " filter_parameters :password\n").should == " insert application.rb\n"
315
+ expect(action(:inject_into_class, "application.rb", Application, " filter_parameters :password\n")).to eq(" insert application.rb\n")
309
316
  end
310
317
 
311
318
  it "does not append if class name does not match" do
312
319
  action :inject_into_class, "application.rb", "App", " filter_parameters :password\n"
313
- File.binread(file).should == "class Application < Base\nend\n"
320
+ expect(File.binread(file)).to eq("class Application < Base\nend\n")
314
321
  end
315
322
  end
316
323
  end
@@ -324,46 +331,51 @@ describe Thor::Actions do
324
331
  File.join(destination_root, "doc", "COMMENTER")
325
332
  end
326
333
 
327
- unmodified_comments_file = /__start__\n # greenblue\n# yellowblue\n#yellowred\n #greenred\norange\n purple\n ind#igo\n # ind#igo\n__end__/
334
+ unmodified_comments_file = /__start__\n # greenblue\n#\n# yellowblue\n#yellowred\n #greenred\norange\n purple\n ind#igo\n # ind#igo\n__end__/
328
335
 
329
336
  describe "#uncomment_lines" do
330
337
  it "uncomments all matching lines in the file" do
331
338
  action :uncomment_lines, "doc/COMMENTER", "green"
332
- File.binread(file).should =~ /__start__\n greenblue\n# yellowblue\n#yellowred\n greenred\norange\n purple\n ind#igo\n # ind#igo\n__end__/
339
+ expect(File.binread(file)).to match(/__start__\n greenblue\n#\n# yellowblue\n#yellowred\n greenred\norange\n purple\n ind#igo\n # ind#igo\n__end__/)
333
340
 
334
341
  action :uncomment_lines, "doc/COMMENTER", "red"
335
- File.binread(file).should =~ /__start__\n greenblue\n# yellowblue\nyellowred\n greenred\norange\n purple\n ind#igo\n # ind#igo\n__end__/
342
+ expect(File.binread(file)).to match(/__start__\n greenblue\n#\n# yellowblue\nyellowred\n greenred\norange\n purple\n ind#igo\n # ind#igo\n__end__/)
336
343
  end
337
344
 
338
345
  it "correctly uncomments lines with hashes in them" do
339
346
  action :uncomment_lines, "doc/COMMENTER", "ind#igo"
340
- File.binread(file).should =~ /__start__\n # greenblue\n# yellowblue\n#yellowred\n #greenred\norange\n purple\n ind#igo\n ind#igo\n__end__/
347
+ expect(File.binread(file)).to match(/__start__\n # greenblue\n#\n# yellowblue\n#yellowred\n #greenred\norange\n purple\n ind#igo\n ind#igo\n__end__/)
341
348
  end
342
349
 
343
350
  it "does not modify already uncommented lines in the file" do
344
351
  action :uncomment_lines, "doc/COMMENTER", "orange"
345
352
  action :uncomment_lines, "doc/COMMENTER", "purple"
346
- File.binread(file).should =~ unmodified_comments_file
353
+ expect(File.binread(file)).to match(unmodified_comments_file)
354
+ end
355
+
356
+ it "does not uncomment the wrong line when uncommenting lines preceded by blank commented line" do
357
+ action :uncomment_lines, "doc/COMMENTER", "yellow"
358
+ expect(File.binread(file)).to match(/__start__\n # greenblue\n#\nyellowblue\nyellowred\n #greenred\norange\n purple\n ind#igo\n # ind#igo\n__end__/)
347
359
  end
348
360
  end
349
361
 
350
362
  describe "#comment_lines" do
351
363
  it "comments lines which are not commented" do
352
364
  action :comment_lines, "doc/COMMENTER", "orange"
353
- File.binread(file).should =~ /__start__\n # greenblue\n# yellowblue\n#yellowred\n #greenred\n# orange\n purple\n ind#igo\n # ind#igo\n__end__/
365
+ expect(File.binread(file)).to match(/__start__\n # greenblue\n#\n# yellowblue\n#yellowred\n #greenred\n# orange\n purple\n ind#igo\n # ind#igo\n__end__/)
354
366
 
355
367
  action :comment_lines, "doc/COMMENTER", "purple"
356
- File.binread(file).should =~ /__start__\n # greenblue\n# yellowblue\n#yellowred\n #greenred\n# orange\n # purple\n ind#igo\n # ind#igo\n__end__/
368
+ expect(File.binread(file)).to match(/__start__\n # greenblue\n#\n# yellowblue\n#yellowred\n #greenred\n# orange\n # purple\n ind#igo\n # ind#igo\n__end__/)
357
369
  end
358
370
 
359
371
  it "correctly comments lines with hashes in them" do
360
372
  action :comment_lines, "doc/COMMENTER", "ind#igo"
361
- File.binread(file).should =~ /__start__\n # greenblue\n# yellowblue\n#yellowred\n #greenred\norange\n purple\n # ind#igo\n # ind#igo\n__end__/
373
+ expect(File.binread(file)).to match(/__start__\n # greenblue\n#\n# yellowblue\n#yellowred\n #greenred\norange\n purple\n # ind#igo\n # ind#igo\n__end__/)
362
374
  end
363
375
 
364
376
  it "does not modify already commented lines" do
365
377
  action :comment_lines, "doc/COMMENTER", "green"
366
- File.binread(file).should =~ unmodified_comments_file
378
+ expect(File.binread(file)).to match(unmodified_comments_file)
367
379
  end
368
380
  end
369
381
  end