public
Description: A Ruby web application framework
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack.git
Click here to lend your support to: mack and make a donation at www.pledgie.com !
Added stub tests for ControllerGenerator. [#25 state:resolved]
markbates (author)
Tue Aug 05 07:50:21 -0700 2008
commit  32524881c1f10c595d6d918a618284eba6a63969
tree    1406bd808dec773eb62bc4cdc5ed071ef9d52f70
parent  939b76d6a186ceecd1644c8ca3da63466433f8cd
...
1
2
3
4
 
 
 
 
 
 
 
5
6
...
1
2
3
 
4
5
6
7
8
9
10
11
12
0
@@ -1,5 +1,11 @@
0
 require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
0
 
0
 describe <%= @name_plural_camel %>Controller do
0
-  
0
+  <% @actions.each do |action| %>
0
+  describe "<%= action %>" do
0
+    
0
+    it "should do something :)"
0
+    
0
+  end
0
+  <% end %>
0
 end
0
\ No newline at end of file
...
5
6
7
8
 
 
 
 
 
9
10
...
5
6
7
 
8
9
10
11
12
13
14
0
@@ -5,5 +5,9 @@ class <%= @name_plural_camel %>ControllerTest < Test::Unit::TestCase
0
   def test_truth
0
     assert true
0
   end
0
-  
0
+  <% @actions.each do |action| %>
0
+  def test_<%= action %>
0
+    assert true
0
+  end
0
+  <% end %>
0
 end
0
\ No newline at end of file
...
55
56
57
58
 
59
60
61
62
 
63
64
65
66
67
 
68
69
70
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
73
74
75
...
55
56
57
 
58
59
60
61
 
62
63
64
65
66
 
67
68
69
70
 
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
0
@@ -55,20 +55,38 @@ describe ControllerGenerator do
0
   
0
   it "should generate a Test::Unit::TestCase test if using the Test::Unit::TestCase framework" do
0
     temp_app_config("mack::testing_framework" => "test_case") do
0
-      file = File.join(Mack.root, "test", "helpers", "controllers", "zoos_controller_helper_test.rb")
0
+      file = File.join(Mack.root, "test", "controllers", "zoos_controller_test.rb")
0
       File.should_not be_exists(file)
0
       ControllerGenerator.run("name" => "zoo")
0
       File.should be_exists(file)
0
-      File.read(file).should == fixture("zoos_controller_helper_test.rb")
0
+      File.read(file).should == fixture("zoos_controller_test.rb")
0
     end
0
   end
0
   
0
   it "should generate a RSpec test if using the RSpec framework" do
0
-    file = File.join(Mack.root, "test", "helpers", "controllers", "zoos_controller_helper_spec.rb")
0
+    file = File.join(Mack.root, "test", "controllers", "zoos_controller_spec.rb")
0
     File.should_not be_exists(file)
0
     ControllerGenerator.run("name" => "zoo")
0
     File.should be_exists(file)
0
-    File.read(file).should == fixture("zoos_controller_helper_spec.rb")
0
+    File.read(file).should == fixture("zoos_controller_spec.rb")
0
+  end
0
+  
0
+  it "should generate a Test::Unit::TestCase test if using the Test::Unit::TestCase framework with optional actions" do
0
+    temp_app_config("mack::testing_framework" => "test_case") do
0
+      file = File.join(Mack.root, "test", "controllers", "zoos_controller_test.rb")
0
+      File.should_not be_exists(file)
0
+      ControllerGenerator.run("name" => "zoo", "actions" => "index,show")
0
+      File.should be_exists(file)
0
+      File.read(file).should == fixture("zoos_controller_test_with_actions.rb")
0
+    end
0
+  end
0
+  
0
+  it "should generate a RSpec test if using the RSpec framework with optional actions" do
0
+    file = File.join(Mack.root, "test", "controllers", "zoos_controller_spec.rb")
0
+    File.should_not be_exists(file)
0
+    ControllerGenerator.run("name" => "zoo", "actions" => "index,show")
0
+    File.should be_exists(file)
0
+    File.read(file).should == fixture("zoos_controller_spec_with_actions.rb")
0
   end
0
   
0
 end
0
\ No newline at end of file

Comments