lib/combustion.rb in combustion-0.3.0 vs lib/combustion.rb in combustion-0.3.1

- old
+ new

@@ -15,14 +15,25 @@ silence_stream(STDOUT) do load "#{Rails.root}/db/schema.rb" end RSpec.configure do |config| - config.include(Capybara) if defined?(Capybara) + include_capybara_into config config.include(Combustion::Application.routes.url_helpers) config.include(Combustion::Application.routes.mounted_helpers) end if defined?(RSpec) && RSpec.respond_to?(:configure) + end + + def self.include_capybara_into(config) + return unless defined?(Capybara) + + config.include Capybara::RSpecMatchers if defined?(Capybara::RSpecMatchers) + config.include Capybara::DSL if defined?(Capybara::DSL) + + unless defined?(Capybara::RSpecMatchers) || defined?(Capybara::DSL) + config.include Capybara + end end end require 'combustion/application' require 'combustion/version'