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

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

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to