On Dec 18, 2010, at 2:11 PM, Sarah Allen wrote:

> 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:
> http://codingfrontier.com/integration-testing-setup-with-rspec-2-and-ca

That blog post was based on a beta version of rspec-rails 2 before we got the 
integration worked out :)

Per "Webrat and Capybara" on http://relishapp.com/rspec/rspec-rails, all you 
should need now is this in your Gemfile:

  gem "capybara"

Cheers,
David

> 
> 
> 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
>        ::Rails.application
>    end
> 
>    RSpec.configure do |c|
>      c.include self, :example_group => { :file_path =>
> /\bspec\/integration\// }
>    end
> 
>  end
> end
> 
> 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:
> https://github.com/blazingcloud/rspec-capybara
> 
> 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.

> 
> Thanks,
> Sarah
> 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:
> https://github.com/blazingcloud/cucumber_lesson

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to