Permalink
Browse files

align config extensions with changes to rspec-core planned for 2.8

  • Loading branch information...
1 parent 364fbb0 commit 48d4cd3b0f2f45e9c5911993dd0383023750ea82 @dchelimsky dchelimsky committed Oct 29, 2011
Showing with 14 additions and 7 deletions.
  1. +1 −2 lib/rspec/rails/fixture_support.rb
  2. +13 −5 lib/rspec/rails/view_rendering.rb
View
3 lib/rspec/rails/fixture_support.rb
@@ -29,8 +29,7 @@ module FixtureSupport
RSpec.configure do |c|
c.include RSpec::Rails::FixtureSupport
- c.add_setting :use_transactional_fixtures
- c.add_setting :use_transactional_examples, :alias => :use_transactional_fixtures
+ c.add_setting :use_transactional_fixtures, :alias_with => :use_transactional_examples
c.add_setting :use_instantiated_fixtures
c.add_setting :global_fixtures
c.add_setting :fixture_path
View
18 lib/rspec/rails/view_rendering.rb
@@ -1,16 +1,24 @@
require 'action_view/testing/resolvers'
RSpec.configure do |config|
- config.add_setting :render_views, :default => false
+ # This allows us to expose `render_views` as a config option even though it
+ # breaks the convention of other options by using `render_views` as a
+ # command (i.e. render_views = true), where it would normally be used as a
+ # getter. This makes it easier for rspec-rails users because we use
+ # `render_views` directly in example groups, so this aligns the two APIs,
+ # but requires this workaround:
+ config.add_setting :rendering_views, :default => false
+
+ def config.render_views=(val)
+ self.rendering_views = val
+ end
- # TODO - rspec-core needs a way to define a setting that works like this in
- # one go
def config.render_views
- settings[:render_views] = true
+ self.rendering_views = true
end
def config.render_views?
- settings[:render_views]
+ rendering_views
end
end

0 comments on commit 48d4cd3

Please sign in to comment.