[rspec-users] Configuring RSpec for Integration Test

David Kahn dk at structuralartistry.com
Sat Dec 18 16:07:30 EST 2010


On Sat, Dec 18, 2010 at 2:47 PM, David Chelimsky <dchelimsky at gmail.com>wrote:

> 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
>

Also, you might want to check out Steak... it runs inside Rspec, I have been
using in lieu of Cucumber starting this week and I am very happy and
enjoying the process:

https://github.com/cavalle/steak

>
> 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 at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101218/ec76d55a/attachment.html>


More information about the rspec-users mailing list