public
Rubygem
Description: RSpec extension library for Ruby on Rails
Homepage:
Clone URL: git://github.com/dchelimsky/rspec-rails.git
Provide controller to the helper object in helper examples to support named 
routes, url_for, etc. [#433 state:resolved]
dchelimsky (author)
Tue Jun 10 21:23:33 -0700 2008
commit  a46a78d752a68814851db5111dfa957886ef9da8
tree    daa9b779eb805c7f7ee70a5bac71c1d78883e7cf
parent  385420313b64a4ba329c8f32e0796773fc95496c
...
92
93
94
 
 
 
95
96
97
...
92
93
94
95
96
97
98
99
100
0
@@ -92,6 +92,9 @@ module Spec
0
           session['flash'] = @flash
0
 
0
           ActionView::Helpers::AssetTagHelper::reset_javascript_include_default
0
+          
0
+          helper_controller = @controller
0
+          helper.instance_eval { @controller = helper_controller }
0
         end
0
 
0
         def flash
...
27
28
29
 
 
 
30
31
32
...
89
90
91
92
93
94
95
 
 
 
 
96
97
98
...
27
28
29
30
31
32
33
34
35
...
92
93
94
 
 
 
 
95
96
97
98
99
100
101
0
@@ -27,6 +27,9 @@ module Spec
0
         it "should have access to named routes" do
0
           rspec_on_rails_specs_url.should == "http://test.host/rspec_on_rails_specs"
0
           rspec_on_rails_specs_path.should == "/rspec_on_rails_specs"
0
+
0
+          helper.named_url.should == "http://test.host/rspec_on_rails_specs"
0
+          helper.named_path.should == "/rspec_on_rails_specs"
0
         end
0
 
0
         it "should fail if the helper method deson't exist" do
0
@@ -89,10 +92,10 @@ module Spec
0
         helpers << ActionView::Helpers::PaginationHelper rescue nil       #removed for 2.0
0
         helpers << ActionView::Helpers::JavaScriptMacrosHelper rescue nil #removed for 2.0
0
         helpers.each do |helper_module|
0
-          # it "should include #{helper_module}" do
0
-          #   self.class.ancestors.should include(helper_module)
0
-          #   helper.class.ancestors.should include(helper_module)
0
-          # end
0
+          it "should include #{helper_module}" do
0
+            self.class.ancestors.should include(helper_module)
0
+            helper.class.ancestors.should include(helper_module)
0
+          end
0
         end
0
       end
0
       
...
7
8
9
 
 
 
 
 
 
 
 
10
...
7
8
9
10
11
12
13
14
15
16
17
18
0
@@ -7,4 +7,12 @@ module ExplicitHelper
0
   def prepend(arg, &block)
0
     concat(arg, block.binding) + block.call
0
   end
0
+  
0
+  def named_url
0
+    rspec_on_rails_specs_url
0
+  end
0
+  
0
+  def named_path
0
+    rspec_on_rails_specs_path
0
+  end
0
 end

Comments