rspec-rails 1.2.7.1 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/Contribute.rdoc +4 -0
  2. data/History.rdoc +26 -1
  3. data/Manifest.txt +2 -3
  4. data/Rakefile +16 -15
  5. data/TODO.txt +2 -3
  6. data/Upgrade.rdoc +34 -0
  7. data/generators/integration_spec/templates/integration_spec.rb +1 -1
  8. data/generators/rspec/rspec_generator.rb +0 -1
  9. data/generators/rspec/templates/rspec.rake +1 -39
  10. data/generators/rspec/templates/spec_helper.rb +5 -2
  11. data/generators/rspec_controller/rspec_controller_generator.rb +2 -0
  12. data/generators/rspec_controller/templates/controller_spec.rb +1 -1
  13. data/generators/rspec_controller/templates/helper_spec.rb +1 -1
  14. data/generators/rspec_controller/templates/view_spec.rb +1 -1
  15. data/generators/rspec_model/templates/model_spec.rb +1 -1
  16. data/generators/rspec_scaffold/templates/controller_spec.rb +1 -1
  17. data/generators/rspec_scaffold/templates/edit_erb_spec.rb +1 -1
  18. data/generators/rspec_scaffold/templates/helper_spec.rb +1 -1
  19. data/generators/rspec_scaffold/templates/index_erb_spec.rb +1 -1
  20. data/generators/rspec_scaffold/templates/new_erb_spec.rb +1 -1
  21. data/generators/rspec_scaffold/templates/routing_spec.rb +16 -46
  22. data/generators/rspec_scaffold/templates/show_erb_spec.rb +1 -1
  23. data/lib/spec/rails/example/controller_example_group.rb +12 -1
  24. data/lib/spec/rails/example/routing_helpers.rb +16 -20
  25. data/lib/spec/rails/extensions/action_controller/rescue.rb +2 -2
  26. data/lib/spec/rails/extensions/action_controller/test_case.rb +1 -1
  27. data/lib/spec/rails/matchers.rb +1 -0
  28. data/lib/spec/rails/matchers/render_template.rb +8 -2
  29. data/lib/spec/rails/matchers/route_to.rb +149 -0
  30. data/lib/spec/rails/version.rb +3 -3
  31. data/spec/autotest/mappings_spec.rb +1 -1
  32. data/spec/resources/controllers/controller_spec_controller.rb +5 -1
  33. data/spec/resources/controllers/render_spec_controller.rb +4 -0
  34. data/spec/spec/rails/example/assigns_hash_proxy_spec.rb +1 -1
  35. data/spec/spec/rails/example/configuration_spec.rb +1 -1
  36. data/spec/spec/rails/example/controller_example_group_spec.rb +15 -7
  37. data/spec/spec/rails/example/controller_isolation_spec.rb +22 -9
  38. data/spec/spec/rails/example/cookies_proxy_spec.rb +1 -1
  39. data/spec/spec/rails/example/error_handling_spec.rb +1 -1
  40. data/spec/spec/rails/example/example_group_factory_spec.rb +1 -1
  41. data/spec/spec/rails/example/helper_example_group_spec.rb +2 -2
  42. data/spec/spec/rails/example/model_example_group_spec.rb +1 -1
  43. data/spec/spec/rails/example/routing_example_group_spec.rb +3 -2
  44. data/spec/spec/rails/example/shared_routing_example_group_examples.rb +224 -31
  45. data/spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb +1 -1
  46. data/spec/spec/rails/example/view_example_group_spec.rb +1 -1
  47. data/spec/spec/rails/extensions/action_view_base_spec.rb +1 -1
  48. data/spec/spec/rails/extensions/active_record_spec.rb +1 -1
  49. data/spec/spec/rails/interop/testcase_spec.rb +1 -1
  50. data/spec/spec/rails/matchers/ar_be_valid_spec.rb +11 -37
  51. data/spec/spec/rails/matchers/assert_select_spec.rb +1 -1
  52. data/spec/spec/rails/matchers/errors_on_spec.rb +1 -1
  53. data/spec/spec/rails/matchers/have_text_spec.rb +1 -1
  54. data/spec/spec/rails/matchers/include_text_spec.rb +1 -1
  55. data/spec/spec/rails/matchers/redirect_to_spec.rb +1 -1
  56. data/spec/spec/rails/matchers/render_template_spec.rb +8 -1
  57. data/spec/spec/rails/matchers/should_change_spec.rb +1 -1
  58. data/spec/spec/rails/mocks/mock_model_spec.rb +1 -1
  59. data/spec/spec/rails/mocks/stub_model_spec.rb +1 -1
  60. data/spec/spec/rails/sample_modified_fixture.rb +1 -1
  61. data/spec/spec/rails/sample_spec.rb +1 -1
  62. data/spec/spec/rails/spec_spec.rb +1 -1
  63. data/spec/spec_helper.rb +23 -24
  64. metadata +11 -12
  65. data/generators/rspec/templates/script/spec_server +0 -9
  66. data/lib/spec/rails/spec_server.rb +0 -135
  67. data/spec/spec/rails/spec_server_spec.rb +0 -108
@@ -0,0 +1,4 @@
1
+ == Contribute
2
+
3
+ If you're interested in contributing to rspec-rails, please see
4
+ http://wiki.github.com/dchelimsky/rspec-dev for information.
@@ -1,3 +1,28 @@
1
+ === Version 1.2.9 / 2009-10-05
2
+
3
+ * enhancements
4
+ * added route_to and be_routable matchers (Randy Harmon). Closes #843.
5
+ * Provide better failure message for render_template when redirected (Josh
6
+ Nichols). Closes #885.
7
+ * generated specs require 'spec_helper'
8
+
9
+ * bug fixes
10
+ * pass the correct args to super in controller#render depending on the rails
11
+ version (Lucas Carlson). Closes #865.
12
+ * use Rack::Utils.parse_query to convert query strings to hashes. Closes #872.
13
+ * errors correctly bubble up when a controller spec in isolation mode
14
+ requests a non-existent action/template
15
+ * no error if either action or template exist
16
+ * error if neither exist
17
+ * Closes #888.
18
+
19
+ * removals
20
+ * spec_server has been removed in favor of spork.
21
+ * You can still use the --drb flag, but you've got to install the spork
22
+ gem.
23
+ * Windows users who cannot use the spork gem can install the spec_server
24
+ from http://github.com/dchelimsky/spec_server
25
+
1
26
  === Version 1.2.7 / 2009-06-22
2
27
 
3
28
  * enhancements
@@ -255,4 +280,4 @@ Maintenance release.
255
280
  * Applied patch from Wincent Colaiuta to invert sense of "spec --diff". Closes #281.
256
281
  * Allow any type of render in view specs. Closes #57.
257
282
  * Applied patch from Ian White to get rspec working with edge rails (8804). Closes #271.
258
- * Applied patch from Jon Strother to have spec_server reload fixtures. Closes #344.
283
+ * Applied patch from Jon Strother to have spec_server reload fixtures. Closes #344.
@@ -1,4 +1,5 @@
1
1
  .document
2
+ Contribute.rdoc
2
3
  History.rdoc
3
4
  License.txt
4
5
  Manifest.txt
@@ -15,7 +16,6 @@ generators/rspec/templates/rcov.opts
15
16
  generators/rspec/templates/rspec.rake
16
17
  generators/rspec/templates/script/autospec
17
18
  generators/rspec/templates/script/spec
18
- generators/rspec/templates/script/spec_server
19
19
  generators/rspec/templates/spec.opts
20
20
  generators/rspec/templates/spec_helper.rb
21
21
  generators/rspec_controller/USAGE
@@ -69,8 +69,8 @@ lib/spec/rails/matchers/have_text.rb
69
69
  lib/spec/rails/matchers/include_text.rb
70
70
  lib/spec/rails/matchers/redirect_to.rb
71
71
  lib/spec/rails/matchers/render_template.rb
72
+ lib/spec/rails/matchers/route_to.rb
72
73
  lib/spec/rails/mocks.rb
73
- lib/spec/rails/spec_server.rb
74
74
  lib/spec/rails/version.rb
75
75
  spec/autotest/mappings_spec.rb
76
76
  spec/rails_suite.rb
@@ -161,6 +161,5 @@ spec/spec/rails/mocks/mock_model_spec.rb
161
161
  spec/spec/rails/mocks/stub_model_spec.rb
162
162
  spec/spec/rails/sample_modified_fixture.rb
163
163
  spec/spec/rails/sample_spec.rb
164
- spec/spec/rails/spec_server_spec.rb
165
164
  spec/spec/rails/spec_spec.rb
166
165
  spec/spec_helper.rb
data/Rakefile CHANGED
@@ -1,25 +1,26 @@
1
1
  # -*- ruby -*-
2
2
  gem 'hoe', '>=2.0.0'
3
3
  require 'hoe'
4
- require './lib/spec/rails/version'
5
- require 'cucumber/rake/task'
6
4
 
7
- $:.unshift(File.join(File.dirname(__FILE__), "/../rspec/lib"))
5
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__),"..","rspec","lib")))
6
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__),"lib")))
8
7
 
8
+ require 'spec/rails/version'
9
9
  require 'spec/rake/spectask'
10
+ require 'cucumber/rake/task'
10
11
 
11
- Hoe.spec('rspec-rails') do |p|
12
- p.version = Spec::Rails::VERSION::STRING
13
- p.summary = Spec::Rails::VERSION::SUMMARY
14
- p.description = "Behaviour Driven Development for Ruby on Rails."
15
- p.rubyforge_name = 'rspec'
16
- p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
17
- p.extra_deps = [["rspec",">=1.2.7"],["rack",">=0.4.0"]]
18
- p.extra_dev_deps = [["cucumber",">= 0.3.11"]]
19
- p.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
20
- p.history_file = 'History.rdoc'
21
- p.readme_file = 'README.rdoc'
22
- p.post_install_message = <<-POST_INSTALL_MESSAGE
12
+ Hoe.spec 'rspec-rails' do
13
+ self.version = Spec::Rails::VERSION::STRING
14
+ self.summary = Spec::Rails::VERSION::SUMMARY
15
+ self.description = "Behaviour Driven Development for Ruby on Rails."
16
+ self.rubyforge_name = 'rspec'
17
+ self.developer 'RSpec Development Team', 'rspec-devel@rubyforge.org'
18
+ self.extra_deps = [["rspec",">=1.2.9"],["rack",">=1.0.0"]]
19
+ self.extra_dev_deps = [["cucumber",">= 0.3.99"]]
20
+ self.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
21
+ self.history_file = 'History.rdoc'
22
+ self.readme_file = 'README.rdoc'
23
+ self.post_install_message = <<-POST_INSTALL_MESSAGE
23
24
  #{'*'*50}
24
25
 
25
26
  Thank you for installing rspec-rails-#{Spec::Rails::VERSION::STRING}
data/TODO.txt CHANGED
@@ -1,11 +1,10 @@
1
- * delegate params_from to assert_recognizes
2
1
  * wiki
3
2
  * need a matrix of which rspec-rails versions support which rails versions
4
3
  * CI
5
4
  * need a robust CI setup that runs
6
5
  * Multiple rubies
7
6
  * MRI: 1.8.6
8
- * MRI: 1.8.9
7
+ * MRI: 1.8.7
9
8
  * MRI: 1.9.1
10
9
  * JRuby
11
10
  * IronRuby??? (perhaps using mono)
@@ -13,6 +12,6 @@
13
12
  * 2.0.5
14
13
  * 2.1.2
15
14
  * 2.2.2
16
- * 2.3.2
15
+ * 2.3.4
17
16
  * 3.0 (once available)
18
17
  * With and without ActiveRecord
@@ -1,3 +1,37 @@
1
+ = Upgrade to 1.2.8 (in git)
2
+
3
+ == What's new
4
+
5
+ === route_to and be_routable matchers
6
+
7
+ Stop using route_for and params_from today! These new matchers from Randy
8
+ Harmon are more expressive and more reliable. Here's how you use them:
9
+
10
+ { :put => "/projects/37" }.should route_to(:controller => 'projects', :action => 'update', :id => '37')
11
+
12
+ { :get => "/nonexisting_route" }.should_not be_routable
13
+
14
+ == What's changed
15
+
16
+ === spec_server has been removed
17
+
18
+ spec_server was deprecated in 1.2.7 and has now been removed. Admittedly, this
19
+ was a short deprecation cycle, but spec server never quite worked right in all
20
+ situations and spork is a great solution that you can use today! This is all
21
+ you need to do:
22
+
23
+ [sudo] gem install spork
24
+ cd path/to/project
25
+ spork --bootsrap
26
+
27
+ Now open up spec/spec_helper.rb and follow the directions at the top. You'll
28
+ be up and running in no time.
29
+
30
+ For more info:
31
+
32
+ * http://github.com/timcharper/spork
33
+ * http://groups.google.com/group/sporkgem
34
+
1
35
  = Upgrade to 1.2.7
2
36
 
3
37
  == What's changed
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe "<%= class_name.pluralize %>" do
4
4
  end
@@ -36,7 +36,6 @@ HELPFUL_INSTRUCTIONS
36
36
 
37
37
  m.file 'script/autospec', 'script/autospec', script_options
38
38
  m.file 'script/spec', 'script/spec', script_options
39
- m.file 'script/spec_server', 'script/spec_server', script_options
40
39
 
41
40
  m.directory 'spec'
42
41
  m.file 'rcov.opts', 'spec/rcov.opts'
@@ -27,7 +27,7 @@ rescue MissingSourceFile
27
27
  def initialize(name)
28
28
  task name do
29
29
  # if rspec-rails is a configured gem, this will output helpful material and exit ...
30
- require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
30
+ require File.expand_path(File.join(File.dirname(__FILE__),"..","..","config","environment"))
31
31
 
32
32
  # ... otherwise, do this:
33
33
  raise <<-MSG
@@ -139,44 +139,6 @@ namespace :spec do
139
139
  end
140
140
  end
141
141
  end
142
-
143
- namespace :server do
144
- daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/pids/spec_server.pid")
145
-
146
- desc "start spec_server."
147
- task :start do
148
- if File.exist?(daemonized_server_pid)
149
- $stderr.puts "spec_server is already running."
150
- else
151
- $stderr.puts %Q{Starting up spec_server ...}
152
- FileUtils.mkdir_p('tmp/pids') unless test ?d, 'tmp/pids'
153
- system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
154
- end
155
- end
156
-
157
- desc "stop spec_server."
158
- task :stop do
159
- unless File.exist?(daemonized_server_pid)
160
- $stderr.puts "No server running."
161
- else
162
- $stderr.puts "Shutting down spec_server ..."
163
- system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
164
- File.delete(daemonized_server_pid)
165
- end
166
- end
167
-
168
- desc "restart spec_server."
169
- task :restart => [:stop, :start]
170
-
171
- desc "check if spec server is running"
172
- task :status do
173
- if File.exist?(daemonized_server_pid)
174
- $stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).gsub("\n","")})}
175
- else
176
- $stderr.puts "No server running."
177
- end
178
- end
179
- end
180
142
  end
181
143
 
182
144
  end
@@ -1,13 +1,16 @@
1
1
  # This file is copied to ~/spec when you run 'ruby script/generate rspec'
2
2
  # from the project root directory.
3
3
  ENV["RAILS_ENV"] ||= 'test'
4
- require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
4
+ require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment'))
5
5
  require 'spec/autorun'
6
6
  require 'spec/rails'
7
7
 
8
+ # Uncomment the next line to use webrat's matchers
9
+ #require 'webrat/integrations/rspec-rails'
10
+
8
11
  # Requires supporting files with custom matchers and macros, etc,
9
12
  # in ./support/ and its subdirectories.
10
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
13
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
11
14
 
12
15
  Spec::Runner.configure do |config|
13
16
  # If you're not using ActiveRecord you should remove these
@@ -30,6 +30,8 @@ class RspecControllerGenerator < ControllerGenerator
30
30
  m.template 'controller:helper.rb',
31
31
  File.join('app/helpers', class_path, "#{file_name}_helper.rb")
32
32
 
33
+
34
+
33
35
  # Spec and view template for each action.
34
36
  actions.each do |action|
35
37
  m.template 'view_spec.rb',
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe <%= class_name %>Controller do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe <%= class_name %>Helper do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe "/<%= class_name.underscore %>/<%= action %>" do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe <%= class_name %> do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe <%= controller_class_name %>Controller do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
4
  describe "/<%= table_name %>/edit.<%= default_file_extension %>" do
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe <%= controller_class_name %>Helper do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
4
  describe "/<%= table_name %>/index.<%= default_file_extension %>" do
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
4
  describe "/<%= table_name %>/new.<%= default_file_extension %>" do
@@ -1,63 +1,33 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe <%= controller_class_name %>Controller do
4
- describe "route generation" do
5
- it "maps #index" do
6
- route_for(:controller => "<%= table_name %>", :action => "index").should == "/<%= table_name %>"
4
+ describe "routing" do
5
+ it "recognizes and generates #index" do
6
+ { :get => "/<%= table_name %>" }.should route_to(:controller => "<%= table_name %>", :action => "index")
7
7
  end
8
8
 
9
- it "maps #new" do
10
- route_for(:controller => "<%= table_name %>", :action => "new").should == "/<%= table_name %>/new"
9
+ it "recognizes and generates #new" do
10
+ { :get => "/<%= table_name %>/new" }.should route_to(:controller => "<%= table_name %>", :action => "new")
11
11
  end
12
12
 
13
- it "maps #show" do
14
- route_for(:controller => "<%= table_name %>", :action => "show", :id => "1").should == "/<%= table_name %>/1"
13
+ it "recognizes and generates #show" do
14
+ { :get => "/<%= table_name %>/1" }.should route_to(:controller => "<%= table_name %>", :action => "show", :id => "1")
15
15
  end
16
16
 
17
- it "maps #edit" do
18
- route_for(:controller => "<%= table_name %>", :action => "edit", :id => "1").should == "/<%= table_name %>/1/edit"
17
+ it "recognizes and generates #edit" do
18
+ { :get => "/<%= table_name %>/1/edit" }.should route_to(:controller => "<%= table_name %>", :action => "edit", :id => "1")
19
19
  end
20
20
 
21
- it "maps #create" do
22
- route_for(:controller => "<%= table_name %>", :action => "create").should == {:path => "/<%= table_name %>", :method => :post}
21
+ it "recognizes and generates #create" do
22
+ { :post => "/<%= table_name %>" }.should route_to(:controller => "<%= table_name %>", :action => "create")
23
23
  end
24
24
 
25
- it "maps #update" do
26
- route_for(:controller => "<%= table_name %>", :action => "update", :id => "1").should == {:path =>"/<%= table_name %>/1", :method => :put}
25
+ it "recognizes and generates #update" do
26
+ { :put => "/<%= table_name %>/1" }.should route_to(:controller => "<%= table_name %>", :action => "update", :id => "1")
27
27
  end
28
28
 
29
- it "maps #destroy" do
30
- route_for(:controller => "<%= table_name %>", :action => "destroy", :id => "1").should == {:path =>"/<%= table_name %>/1", :method => :delete}
31
- end
32
- end
33
-
34
- describe "route recognition" do
35
- it "generates params for #index" do
36
- params_from(:get, "/<%= table_name %>").should == {:controller => "<%= table_name %>", :action => "index"}
37
- end
38
-
39
- it "generates params for #new" do
40
- params_from(:get, "/<%= table_name %>/new").should == {:controller => "<%= table_name %>", :action => "new"}
41
- end
42
-
43
- it "generates params for #create" do
44
- params_from(:post, "/<%= table_name %>").should == {:controller => "<%= table_name %>", :action => "create"}
45
- end
46
-
47
- it "generates params for #show" do
48
- params_from(:get, "/<%= table_name %>/1").should == {:controller => "<%= table_name %>", :action => "show", :id => "1"}
49
- end
50
-
51
- it "generates params for #edit" do
52
- params_from(:get, "/<%= table_name %>/1/edit").should == {:controller => "<%= table_name %>", :action => "edit", :id => "1"}
53
- end
54
-
55
- it "generates params for #update" do
56
- params_from(:put, "/<%= table_name %>/1").should == {:controller => "<%= table_name %>", :action => "update", :id => "1"}
57
- end
58
-
59
- it "generates params for #destroy" do
60
- params_from(:delete, "/<%= table_name %>/1").should == {:controller => "<%= table_name %>", :action => "destroy", :id => "1"}
29
+ it "recognizes and generates #destroy" do
30
+ { :delete => "/<%= table_name %>/1" }.should route_to(:controller => "<%= table_name %>", :action => "destroy", :id => "1")
61
31
  end
62
32
  end
63
33
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
4
  describe "/<%= table_name %>/show.<%= default_file_extension %>" do
@@ -165,7 +165,14 @@ MESSAGE
165
165
  PickedTemplate.new
166
166
  end
167
167
 
168
+ def __action_exists?(params)
169
+ controller.respond_to? params[:action]
170
+ end
171
+
168
172
  def render(*args)
173
+ if ::Rails::VERSION::STRING >= "2.1"
174
+ return super unless __action_exists?(params)
175
+ end
169
176
  if file = args.last[:file].instance_eval{@template_path}
170
177
  record_render :file => file
171
178
  elsif args.last[:inline]
@@ -215,7 +222,11 @@ MESSAGE
215
222
  if matching_stub_exists(options)
216
223
  @performed_render = true
217
224
  else
218
- super
225
+ if ::Rails::VERSION::STRING > '2.1'
226
+ super(options, extra_options, &block)
227
+ else
228
+ super(options, &block)
229
+ end
219
230
  end
220
231
  end
221
232
  end