Skip to content

Commit c2a0fcb

Browse files
committed
follow some changes in rails edge
1 parent 535b57e commit c2a0fcb

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

lib/generators/rspec/scaffold/templates/controller_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def <%= mock_file_name %>(stubs={})
6666
it "re-renders the 'new' template" do
6767
<%= stub! orm_class.build(class_name) %> { <%= mock_file_name(:save => false) %> }
6868
post :create, :<%= file_name %> => {}
69-
response.should render_template('new')
69+
response.should render_template(:new)
7070
end
7171
end
7272
@@ -104,7 +104,7 @@ def <%= mock_file_name %>(stubs={})
104104
it "re-renders the 'edit' template" do
105105
<%= stub! orm_class.find(class_name) %> { <%= mock_file_name(:update_attributes => false) %> }
106106
put :update, :id => "1"
107-
response.should render_template('edit')
107+
response.should render_template(:edit)
108108
end
109109
end
110110

lib/rspec/rails/example/controller_example_group.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ module ControllerExampleGroupBehaviour
1616
include Webrat::Methods
1717
include Rspec::Rails::Matchers
1818

19+
def self.setup(*args); end
20+
def self.teardown(*args); end
21+
22+
include ActionController::TemplateAssertions
23+
1924
def self.included(mod)
2025
mod.before do
2126
@_result = Struct.new(:add_assertion).new

lib/rspec/rails/example/view_example_group.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,22 @@ class ViewExampleController < ActionController::Base
88
attr_accessor :controller_path
99
end
1010

11+
module ViewExtension
12+
def protect_against_forgery?; end
13+
def method_missing(selector, *args)
14+
if Rails.application.routes.named_routes.helpers.include?(selector)
15+
controller.__send__(selector, *args)
16+
else
17+
super
18+
end
19+
end
20+
end
21+
1122
def view
1223
@view ||= begin
1324
view = ActionView::Base.new(ActionController::Base.view_paths, assigns, controller)
14-
view.extend(Module.new { def protect_against_forgery?; end })
25+
view.extend(ActionController::PolymorphicRoutes)
26+
view.extend(ViewExtension)
1527
view
1628
end
1729
end

0 commit comments

Comments
 (0)