Skip to content
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

Fix empty template rendering for Rails 4.2.5.1 #1535

Merged
merged 1 commit into from
Jan 27, 2016

Conversation

pixeltrix
Copy link
Contributor

Closes #1532.

Refactor the template rendering overrides in controller specs to be more compatible with the Action View public api. Previously EmptyTemplatePathSetDecorator overrode the find_all method to wrap a path set. However ActionView::PathSet is not public api so instead create a subclass of ActionView::FileSystemResolver to return an empty template and treat view_paths as an array of string-like objects.

fables-tales pushed a commit that referenced this pull request Jan 26, 2016
fables-tales pushed a commit that referenced this pull request Jan 26, 2016
fables-tales pushed a commit that referenced this pull request Jan 26, 2016
fables-tales pushed a commit that referenced this pull request Jan 26, 2016
@fables-tales fables-tales force-pushed the fix-empty-template-resolver branch from 550f1b3 to b498a38 Compare January 26, 2016 17:05
controller.extend(EmptyTemplates)
end
end

after do
unless render_views?
controller.class.view_paths = @_empty_view_path_set_delegator.original_path_set
controller.class.view_paths = @_original_path_set

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubocop on Travis wants:

controller.class.view_paths = @_original_path_set unless render_views?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! We've actually merged a travis passing-fix in 3.4.1, this fix is a forward-port of that. And I'll fix that tomorrow.

Closes rspec#1532.

Refactor the template rendering overrides in controller specs to be more
compatible with the Action View public api. Previously `EmptyTemplatePathSetDecorator`
overrode the `find_all` method to wrap a path set. However `ActionView::PathSet`
is not public api so instead create a subclass of `ActionView::FileSystemResolver`
to return an empty template and treat `view_paths` as an array of string-like objects.
@fables-tales fables-tales force-pushed the fix-empty-template-resolver branch from b498a38 to 80637fc Compare January 27, 2016 07:44
fables-tales pushed a commit that referenced this pull request Jan 27, 2016
Fix empty template rendering for Rails 4.2.5.1
@fables-tales fables-tales merged commit 44e5b8a into rspec:master Jan 27, 2016
@fables-tales fables-tales deleted the fix-empty-template-resolver branch January 27, 2016 14:03
@bquorning
Copy link
Contributor

Thank you @pixeltrix @samphippen @fcheung etc. for fixing this issue. Much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants