Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

RSpec 2 support for rspec-rails #59

Open
wants to merge 1 commit into from

1 participant

@david-mccullars

We're using rspec 2 (2.6.0) with rails (3.1), and we currently get deprecation warnings coming from webrat. The new syntax is RSpec.configure (instead of Spec::Runner.configure).

This patch provides support for the new syntax while retaining support for the old (depending on whether rspec 2 is installed or not).

David McCullars For Rspec 2 (rails), avoid deprecation warning by using RSpec.configu…
…re rather than Spec::Runner.configure. Retain support for Rspec 1, though.
d9e7259
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 8, 2011
  1. For Rspec 2 (rails), avoid deprecation warning by using RSpec.configu…

    David McCullars authored
    …re rather than Spec::Runner.configure. Retain support for Rspec 1, though.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/webrat/integrations/rspec-rails.rb
View
4 lib/webrat/integrations/rspec-rails.rb
@@ -6,6 +6,8 @@
require "nokogiri"
require "webrat/core/matchers"
-Spec::Runner.configure do |config|
+# If Rspec 2 is being used, avoid deprecation warning
+configure_method = defined?(RSpec) ? RSpec.method(:configure) : Spec::Runner.method(:configure)
+configure_method.call do |config|
config.include(Webrat::Matchers, :type => [:controller, :helper, :view])
end
Something went wrong with that request. Please try again.