Permalink
Browse files

fixed rspec generators o work with rails 2.3 and rspec 1.2.4

  • Loading branch information...
Diego Scataglini authored and technoweenie committed Apr 14, 2009
1 parent 7235d91 commit 1f994919d9e78d048ca5ee3d53f3ad7f2db9058c
@@ -1,12 +1,12 @@
require File.dirname(__FILE__) + '<%= ('/..'*controller_class_nesting_depth) + '/../spec_helper' %>'
# Be sure to include AuthenticatedTestHelper in spec/spec_helper.rb instead
# Then, you can remove it from this and the units test.
-include AuthenticatedTestHelper
#
# A test controller with and without access controls
#
class AccessControlTestController < ApplicationController
+ include AuthenticatedSystem
before_filter :login_required, :only => :login_is_required
def login_is_required
respond_to do |format|
@@ -42,6 +42,8 @@ def login_not_required
:login_is_required,]
describe AccessControlTestController do
+ include AuthenticatedTestHelper
+ include AuthenticatedSystem
fixtures :<%= table_name %>
before do
# is there a better way to do this?
@@ -2,11 +2,11 @@
# Be sure to include AuthenticatedTestHelper in spec/spec_helper.rb instead
# Then, you can remove it from this and the units test.
-include AuthenticatedTestHelper
-include AuthenticatedSystem
def action_name() end
describe <%= controller_class_name %>Controller do
+ include AuthenticatedTestHelper
+ include AuthenticatedSystem
fixtures :<%= table_name %>
before do
@@ -2,9 +2,10 @@
# Be sure to include AuthenticatedTestHelper in spec/spec_helper.rb instead
# Then, you can remove it from this and the units test.
-include AuthenticatedTestHelper
+
describe <%= controller_class_name %>Controller do
+ include AuthenticatedTestHelper
fixtures :<%= table_name %>
before do
@<%= file_name %> = mock_<%= file_name %>
@@ -105,7 +106,7 @@ def do_destroy
route_for(:controller => '<%= controller_controller_name %>', :action => 'new').should == "/login"
end
it "should route the create <%= controller_controller_name %> correctly" do
- route_for(:controller => '<%= controller_controller_name %>', :action => 'create').should == "/<%= controller_routing_path %>"
+ route_for(:controller => '<%= controller_controller_name %>', :action => 'create').should == {:path => "/<%= controller_routing_path %>", :method => :post}
end
it "should route the destroy <%= controller_controller_name %> action correctly" do
route_for(:controller => '<%= controller_controller_name %>', :action => 'destroy').should == "/logout"
@@ -2,9 +2,10 @@
# Be sure to include AuthenticatedTestHelper in spec/spec_helper.rb instead
# Then, you can remove it from this and the units test.
-include AuthenticatedTestHelper
+
describe <%= model_controller_class_name %>Controller do
+ include AuthenticatedTestHelper
fixtures :<%= table_name %>
it 'allows signup' do
@@ -117,11 +118,11 @@ def create_<%= file_name %>(options = {})
end
it "should route <%= model_controller_controller_name %>'s 'update' action correctly" do
- route_for(:controller => '<%= model_controller_controller_name %>', :action => 'update', :id => '1').should == "/<%= model_controller_routing_path %>/1"
+ route_for(:controller => '<%= model_controller_controller_name %>', :action => 'update', :id => '1').should == {:path => "/<%= model_controller_routing_path %>/1", :method => :put}
end
it "should route <%= model_controller_controller_name %>'s 'destroy' action correctly" do
- route_for(:controller => '<%= model_controller_controller_name %>', :action => 'destroy', :id => '1').should == "/<%= model_controller_routing_path %>/1"
+ route_for(:controller => '<%= model_controller_controller_name %>', :action => 'destroy', :id => '1').should == {:path => "/<%= model_controller_routing_path %>/1", :method => :delete}
end
end
@@ -174,20 +175,20 @@ def create_<%= file_name %>(options = {})
it "should route <%= model_controller_routing_name %>_path() to /<%= model_controller_routing_path %>" do
<%= model_controller_routing_name %>_path().should == "/<%= model_controller_routing_path %>"
- formatted_<%= model_controller_routing_name %>_path(:format => 'xml').should == "/<%= model_controller_routing_path %>.xml"
- formatted_<%= model_controller_routing_name %>_path(:format => 'json').should == "/<%= model_controller_routing_path %>.json"
+ <%= model_controller_routing_name %>_path(:format => 'xml').should == "/<%= model_controller_routing_path %>.xml"
+ <%= model_controller_routing_name %>_path(:format => 'json').should == "/<%= model_controller_routing_path %>.json"
end
it "should route new_<%= model_controller_routing_name.singularize %>_path() to /<%= model_controller_routing_path %>/new" do
new_<%= model_controller_routing_name.singularize %>_path().should == "/<%= model_controller_routing_path %>/new"
- formatted_new_<%= model_controller_routing_name.singularize %>_path(:format => 'xml').should == "/<%= model_controller_routing_path %>/new.xml"
- formatted_new_<%= model_controller_routing_name.singularize %>_path(:format => 'json').should == "/<%= model_controller_routing_path %>/new.json"
+ new_<%= model_controller_routing_name.singularize %>_path(:format => 'xml').should == "/<%= model_controller_routing_path %>/new.xml"
+ new_<%= model_controller_routing_name.singularize %>_path(:format => 'json').should == "/<%= model_controller_routing_path %>/new.json"
end
it "should route <%= model_controller_routing_name.singularize %>_(:id => '1') to /<%= model_controller_routing_path %>/1" do
<%= model_controller_routing_name.singularize %>_path(:id => '1').should == "/<%= model_controller_routing_path %>/1"
- formatted_<%= model_controller_routing_name.singularize %>_path(:id => '1', :format => 'xml').should == "/<%= model_controller_routing_path %>/1.xml"
- formatted_<%= model_controller_routing_name.singularize %>_path(:id => '1', :format => 'json').should == "/<%= model_controller_routing_path %>/1.json"
+ <%= model_controller_routing_name.singularize %>_path(:id => '1', :format => 'xml').should == "/<%= model_controller_routing_path %>/1.xml"
+ <%= model_controller_routing_name.singularize %>_path(:id => '1', :format => 'json').should == "/<%= model_controller_routing_path %>/1.json"
end
it "should route edit_<%= model_controller_routing_name.singularize %>_path(:id => '1') to /<%= model_controller_routing_path %>/1/edit" do
@@ -1,9 +1,10 @@
require File.dirname(__FILE__) + '<%= ('/..'*model_controller_class_nesting_depth) + '/../spec_helper' %>'
-include ApplicationHelper
-include <%= model_controller_class_name %>Helper
-include AuthenticatedTestHelper
describe <%= model_controller_class_name %>Helper do
+ include ApplicationHelper
+ include <%= model_controller_class_name %>Helper
+ include AuthenticatedTestHelper
+
before do
@<%= file_name %> = mock_<%= file_name %>
end
@@ -3,9 +3,10 @@
# Be sure to include AuthenticatedTestHelper in spec/spec_helper.rb instead.
# Then, you can remove it from this and the functional test.
-include AuthenticatedTestHelper
+
describe <%= class_name %> do
+ include AuthenticatedTestHelper
fixtures :<%= table_name %>
describe 'being created' do

0 comments on commit 1f99491

Please sign in to comment.