Skip to content

Fix Undefined Method cache on rails 4.2.5.1 / 4.1.14.1 #1533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions features/controller_specs/isolation_from_views.feature
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,28 @@ Feature: views are stubbed by default
"""
When I run `rspec spec`
Then the examples should all pass

Scenario: expect template that is rendered as a file(passes)
Given a file named "spec/controllers/widgets_controller_spec.rb" with:
"""ruby
require "rails_helper"

RSpec.describe ApplicationController, :type => :controller do
controller do
def index
render file: File.expand_path('app/views/widgets/widget.html.erb')
end
end
it "renders the template" do
get :index
expect(response).to render_template(file: File.expand_path('app/views/widgets/widget.html.erb'))
expect(response.body).to eq ""
end
end
"""
And a file named "app/views/widgets/widget.html.erb" with:
"""
HTML
"""
When I run `rspec spec`
Then the examples should all pass
2 changes: 2 additions & 0 deletions lib/rspec/rails/view_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def find_all(*args)
)
end
end

alias_method :find_all_anywhere, :find_all
end

# @private
Expand Down