public
Rubygem
Description: RSpec extension library for Ruby on Rails
Homepage:
Clone URL: git://github.com/dchelimsky/rspec-rails.git
support controller and action path params in view specs
dchelimsky (author)
Fri Nov 21 17:08:39 -0800 2008
commit  0461ecfecaa6dd3b88c14ab3ce053263cdba7279
tree    d5212366e399f051cc732a9e4a603c66ffe3555b
parent  fb8468b2860fd5b949d2eb54fb9738dcddb25897
...
1
2
 
 
 
 
3
4
5
...
1
2
3
4
5
6
7
8
9
0
@@ -1,5 +1,9 @@
0
 === Maintenance
0
 
0
+* 1 major enhancement
0
+
0
+  * support controller and action path params in view specs (Mike Vincent).
0
+
0
 * 1 minor enhancement
0
 
0
   * improve rdoc for render_template (Patch from Andrew Premdas). Fixes #571.
...
104
105
106
107
108
109
110
 
 
111
112
113
...
104
105
106
 
107
 
 
108
109
110
111
112
0
@@ -104,10 +104,9 @@ module Spec
0
 
0
           assigns[:action_name] = @action_name
0
 
0
-          @request.path_parameters ||= {}
0
           @request.path_parameters = @request.path_parameters.update(
0
-            :controller => derived_controller_name(options),
0
-            :action => derived_action_name(options)
0
+            :controller => options[:controller] || derived_controller_name(options),
0
+            :action => options[:action] || derived_action_name(options)
0
           )
0
 
0
           defaults = { :layout => false }
...
249
250
251
252
253
254
255
256
257
 
 
 
 
 
 
 
 
 
 
 
 
258
259
260
...
249
250
251
 
 
 
 
 
 
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
0
@@ -249,12 +249,18 @@ describe "render 'view_spec/foo/show.rhtml'", :type => :view do
0
   end
0
 end
0
 
0
-describe "setting special parameters" do
0
-  it "should not clobber path_parameters so customer path variables can be set" do
0
-    # hmm, no request object here?
0
-    request.path_parameters = {:required_parameter => 'foo'}
0
-    render "view_spec/entry_form"
0
-    request.path_parameters[:required_parameter].should == 'foo'
0
+describe "setting path parameters", :type => :view do
0
+  describe "(controller)" do
0
+    it "should supercede the default path parameters" do
0
+      render "view_spec/entry_form", :controller => 'foo'
0
+      request.path_parameters[:controller].should == 'foo'
0
+    end
0
+  end
0
+  describe "(action)" do
0
+    it "should supercede the default path parameters" do
0
+      render "view_spec/entry_form", :action => 'foo'
0
+      request.path_parameters[:action].should == 'foo'
0
+    end
0
   end
0
 end
0
 

Comments