Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Let local render_views override global setting

If render_views is enabled globally in the spec_helper, it clobbers attempts to disable it locally for specific examples due to the false || true logic.

Instead, only use the global setting if no local render_views was provided.
  • Loading branch information...
commit f7640adea007a6a7152d2e3caeaced58fffc77ec 1 parent 6b7adaf
@martinsvalin martinsvalin authored
View
3  lib/rspec/rails/view_rendering.rb
@@ -47,7 +47,8 @@ def integrate_views
# @api private
def render_views?
- metadata_for_rspec_rails[:render_views] || RSpec.configuration.render_views?
+ return RSpec.configuration.render_views? unless metadata_for_rspec_rails.key? :render_views
+ metadata_for_rspec_rails[:render_views]
end
end
View
6 spec/rspec/rails/view_rendering_spec.rb
@@ -54,6 +54,12 @@ def example.controller
group.render_views false
group.new.render_views?.should be_false
end
+
+ it "overrides the global config if render_views is enabled there" do
+ RSpec.configuration.stub(:render_views?).and_return true
+ group.render_views false
+ group.new.render_views?.should be_false
+ end
end
context "in a nested group" do
Please sign in to comment.
Something went wrong with that request. Please try again.