1
1
require "helper"
2
2
3
- class Application ; end
4
- module ApplicationHelper ; end
5
-
6
3
describe Thor ::Actions do
7
4
def runner ( options = { } , behavior = :invoke )
8
5
@runner ||= MyCounter . new ( [ 1 ] , options , :destination_root => destination_root , :behavior => behavior )
@@ -407,17 +404,17 @@ def file
407
404
end
408
405
409
406
it "appends content to a class" do
410
- action :inject_into_class , "application.rb" , Application , " filter_parameters :password\n "
407
+ action :inject_into_class , "application.rb" , " Application" , " filter_parameters :password\n "
411
408
expect ( File . binread ( file ) ) . to eq ( "class Application < Base\n filter_parameters :password\n end\n " )
412
409
end
413
410
414
411
it "accepts a block" do
415
- action ( :inject_into_class , "application.rb" , Application ) { " filter_parameters :password\n " }
412
+ action ( :inject_into_class , "application.rb" , " Application" ) { " filter_parameters :password\n " }
416
413
expect ( File . binread ( file ) ) . to eq ( "class Application < Base\n filter_parameters :password\n end\n " )
417
414
end
418
415
419
416
it "logs status" do
420
- expect ( action ( :inject_into_class , "application.rb" , Application , " filter_parameters :password\n " ) ) . to eq ( " insert application.rb\n " )
417
+ expect ( action ( :inject_into_class , "application.rb" , " Application" , " filter_parameters :password\n " ) ) . to eq ( " insert application.rb\n " )
421
418
end
422
419
423
420
it "does not append if class name does not match" do
@@ -432,17 +429,17 @@ def file
432
429
end
433
430
434
431
it "appends content to a module" do
435
- action :inject_into_module , "application_helper.rb" , ApplicationHelper , " def help; 'help'; end\n "
432
+ action :inject_into_module , "application_helper.rb" , " ApplicationHelper" , " def help; 'help'; end\n "
436
433
expect ( File . binread ( file ) ) . to eq ( "module ApplicationHelper\n def help; 'help'; end\n end\n " )
437
434
end
438
435
439
436
it "accepts a block" do
440
- action ( :inject_into_module , "application_helper.rb" , ApplicationHelper ) { " def help; 'help'; end\n " }
437
+ action ( :inject_into_module , "application_helper.rb" , " ApplicationHelper" ) { " def help; 'help'; end\n " }
441
438
expect ( File . binread ( file ) ) . to eq ( "module ApplicationHelper\n def help; 'help'; end\n end\n " )
442
439
end
443
440
444
441
it "logs status" do
445
- expect ( action ( :inject_into_module , "application_helper.rb" , ApplicationHelper , " def help; 'help'; end\n " ) ) . to eq ( " insert application_helper.rb\n " )
442
+ expect ( action ( :inject_into_module , "application_helper.rb" , " ApplicationHelper" , " def help; 'help'; end\n " ) ) . to eq ( " insert application_helper.rb\n " )
446
443
end
447
444
448
445
it "does not append if module name does not match" do
0 commit comments