0
@@ -4,10 +4,10 @@ require Pathname(__FILE__).dirname.expand_path.parent.parent + 'spec_helper'
0
describe ControllerGenerator do
0
- FileUtils.rm_rf(File.join(Mack.root, "app", "controllers", "controllers", "zoos_controller.rb"))
0
+ FileUtils.rm_rf(File.join(Mack.root, "app", "controllers", "zoos_controller.rb"))
0
+ FileUtils.rm_rf(File.join(Mack.root, "app", "views", "zoos"))
0
FileUtils.rm_rf(File.join(Mack.root, "app", "helpers", "controllers", "zoos_controller_helper.rb"))
0
- FileUtils.rm_rf(File.join(Mack.root, "test", "helpers", "controllers", "zoos_controller_helper_test.rb"))
0
- FileUtils.rm_rf(File.join(Mack.root, "test", "helpers", "controllers", "zoos_controller_helper_spec.rb"))
0
+ FileUtils.rm_rf(File.join(Mack.root, "test"))
0
@@ -23,7 +23,18 @@ describe ControllerGenerator do
0
ControllerGenerator.new("name" => "zoo").should be_instance_of(ControllerGenerator)
0
- it "should also take an optional 'actions' parameter"
0
+ it "should also take an optional 'actions' parameter" do
0
+ index = File.join(Mack.root, "app", "views", "zoos", "index.html.erb")
0
+ show = File.join(Mack.root, "app", "views", "zoos", "show.html.erb")
0
+ file = File.join(Mack.root, "app", "controllers", "zoos_controller.rb")
0
+ ControllerGenerator.run("name" => "zoo", "actions" => "index,show")
0
+ File.should be_exists(file)
0
+ File.read(file).should == fixture("zoos_controller_with_actions.rb")
0
+ File.should be_exists(index)
0
+ File.read(index).should match(/<h1>ZoosController#index<\/h1>/)
0
+ File.should be_exists(show)
0
+ File.read(show).should match(/<p>You can find me in app\/views\/zoos\/show.html.erb<\/p>/)
0
it "should generate a controller" do
0
file = File.join(Mack.root, "app", "controllers", "zoos_controller.rb")
0
@@ -31,6 +42,7 @@ describe ControllerGenerator do
0
ControllerGenerator.run("name" => "zoo")
0
File.should be_exists(file)
0
File.read(file).should == fixture("zoos_controller.rb")
0
+ File.should be_exists(File.join(Mack.root, "app", "views", "zoos"))
0
it "should generate a controller helper" do