Permalink
Browse files

Eliminate use of deprecated process_view_paths.

- Fixes #519.
  • Loading branch information...
1 parent f03065c commit ff6a9ff9555eaead5167497dd7d2e6c5519171c7 @dchelimsky dchelimsky committed Apr 21, 2012
@@ -17,12 +17,12 @@ Feature: views are stubbed by default
it "renders the index template" do
get :index
response.should render_template("index")
- response.body.should == ""
+ response.body.should eq ""
end
it "renders the widgets/index template" do
get :index
response.should render_template("widgets/index")
- response.body.should == ""
+ response.body.should eq ""
end
end
end
@@ -59,37 +59,29 @@ Feature: views are stubbed by default
controller.append_view_path 'app/views'
get :custom_action
response.should render_template("custom_action")
- response.body.should == ""
+ response.body.should eq ""
end
end
end
"""
When I run `rspec spec`
Then the examples should all pass
- Scenario: expect template to render when view path is changed at runtime (fails)
+ Scenario: expect template to render the real template with render_views when view path is changed at runtime
Given a file named "spec/controllers/things_controller_spec.rb" with:
"""
require "spec_helper"
describe ThingsController do
- describe "custom_action" do
- it "renders the custom_action template" do
- render_views
- controller.prepend_view_path 'app/views'
- get :custom_action
- response.should render_template("custom_action")
- response.body.should == ""
- end
+ render_views
- it "renders an empty custom_action template" do
- controller.prepend_view_path 'app/views'
- get :custom_action
- response.should render_template("custom_action")
- response.body.should == ""
- end
+ it "renders the real custom_action template" do
+ controller.prepend_view_path 'app/views'
+ get :custom_action
+ response.should render_template("custom_action")
+ response.body.should match(/template for a custom action/)
end
end
"""
When I run `rspec spec`
- Then the output should contain "2 examples, 1 failure"
+ Then the examples should all pass
@@ -97,7 +97,7 @@ def append_view_path(new_path)
private
def _path_decorator(path)
- EmptyTemplatePathSetDecorator.new(::ActionView::Base::process_view_paths(path))
+ EmptyTemplatePathSetDecorator.new(ActionView::PathSet.new(Array.wrap(path)))
end
end
@@ -11,11 +11,8 @@
generate('scaffold admin/accounts name:string') # scaffold with nested resource
generate('controller things custom_action')
-template_code= <<-TEMPLATE
- <% raise 'Error from custom_action because we should never render this template....derp derp derp' %>
-TEMPLATE
-file "app/views/things/custom_action.html.erb", template_code, {:force=>true}
+file "app/views/things/custom_action.html.erb", "This is a template for a custom action.", {:force=>true}
run('rake db:migrate')
run('rake db:test:prepare')

0 comments on commit ff6a9ff

Please sign in to comment.