[rspec-users] Configuring RSpec for Integration Test

Sarah Allen lists at ruby-forum.com
Sat Dec 18 15:11:50 EST 2010

In using RSpec for integration testing with Capybara, I was surprised
thave I needed to do extra configuration.  I started with the config
from this blog post:

and I pared it down to only what I needed to write an integration test,
and ended up with

require 'action_dispatch'
require 'capybara/rails'
require 'capybara/dsl'

module RSpec::Rails
  module IntegrationExampleGroup
    include ActionDispatch::Integration::Runner
    include Capybara

    def app

    RSpec.configure do |c|
      c.include self, :example_group => { :file_path =>
/\bspec\/integration\// }


I understand why I would need special config to include Capybara, but I
don't understand why I need to define app and include the
ActionDisplatch stuff -- I thought that would come automagically with
rspec-rails by just including spec_helper.

My whole little test project is here:

Before I give this to other folks as example code, I would really like
to understand it and know if there is an easier/better/more recommended
way to do this.

work http://blazingcloud.net/
personal blog http://www.ultrasaurus.com

p.s. I know cucumber is an alternate way.  I'm doing a compare/contrast.
The cucumber version is here:

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list