How do I configure integration tests using rspec 2?

Posted by Jamie Monserrate on Stack Overflow See other posts from Stack Overflow or by Jamie Monserrate
Published on 2010-12-31T04:50:32Z Indexed on 2010/12/31 4:54 UTC
Read the original article Hit count: 255

I need to have different settings for my unit tests and different settings for my integration tests. Example

For unit tests, I would like to do

WebMock.disable_net_connect!(:allow_localhost => true)

And for integration tests, I would like to do

WebMock.allow_net_connect!

Also, before the start of an integration test, I would like to make sure that solr is started. Hence I want to be able to call

config.before(:suite) do
  SunspotStarter.start
end

BUT, only for integration tests. I do not want to start my solr if its a unit test.

How do I keep their configurations separate? Right now, I have solved this by keeping my integration tests in a folder outside the spec folder, which has its own spec_helper. Is there any better way?

© Stack Overflow or respective owner

Related posts about ruby-on-rails3

Related posts about integration-testing