Permalink
Browse files

move webrat and capybara configs to vendor

  • Loading branch information...
1 parent dbce7d2 commit 92bad323402ffb835934b9319e6006805350034d @dchelimsky dchelimsky committed May 4, 2011
View
@@ -2,6 +2,7 @@ tmp
doc
pkg
vendor
+!lib/rspec/rails/vendor
*.gem
Gemfile
Gemfile.lock
View
@@ -13,4 +13,5 @@
require 'rspec/rails/mocks'
require 'rspec/rails/module_inclusion'
require 'rspec/rails/example'
-require 'rspec/rails/browser_simulators'
+require 'rspec/rails/vendor/capybara'
+require 'rspec/rails/vendor/webrat'
@@ -0,0 +1,29 @@
+begin
+ require 'capybara/rspec'
+rescue LoadError
+end
+
+begin
+ require 'capybara/rails'
+rescue LoadError
+end
+
+RSpec.configure do |c|
+ if defined?(Capybara::RSpecMatchers)
+ c.include Capybara::RSpecMatchers, :type => :view
@justinko

justinko May 5, 2011

Contributor

Would adding the ability to specify :types be good? If so, we could squash these four lines into one.

@dchelimsky

dchelimsky May 5, 2011

Owner

I was thinking more on the lines of handling a symbol or an array of symbols.

@justinko

justinko May 5, 2011

Contributor

I'll do an array of symbols.

+ c.include Capybara::RSpecMatchers, :type => :helper
+ c.include Capybara::RSpecMatchers, :type => :mailer
+ c.include Capybara::RSpecMatchers, :type => :controller
+ end
+
+ if defined?(Capybara::DSL)
+ c.include Capybara::DSL, :type => :controller
@josevalim

josevalim May 7, 2012

Contributor

Isn't this supposed to be :type => :request. I can't see a reason to include this in controller specs!

+ end
+
+ unless defined?(Capybara::RSpecMatchers) || defined?(Capybara::DSL)
+ if defined?(Capybara)
+ c.include Capybara, :type => :request
+ c.include Capybara, :type => :controller
+ end
+ end
+end
@@ -1,37 +1,9 @@
begin
- require 'capybara/rspec'
-rescue LoadError
-end
-
-begin
- require 'capybara/rails'
-rescue LoadError
-end
-
-begin
require 'webrat'
rescue LoadError
end
RSpec.configure do |c|
- if defined?(Capybara::RSpecMatchers)
- c.include Capybara::RSpecMatchers, :type => :view
- c.include Capybara::RSpecMatchers, :type => :helper
- c.include Capybara::RSpecMatchers, :type => :mailer
- c.include Capybara::RSpecMatchers, :type => :controller
- end
-
- if defined?(Capybara::DSL)
- c.include Capybara::DSL, :type => :controller
- end
-
- unless defined?(Capybara::RSpecMatchers) || defined?(Capybara::DSL)
- if defined?(Capybara)
- c.include Capybara, :type => :request
- c.include Capybara, :type => :controller
- end
- end
-
if defined?(Webrat)
c.include Webrat::Matchers, :type => :request
c.include Webrat::Matchers, :type => :controller

0 comments on commit 92bad32

Please sign in to comment.