msmith1114
msmith1114

Reputation: 3231

Capybara/Rspec tests will not run together, but work fine on their own?

So I have a few rspec tests, and i've been able to run them individually just fine without an issue (They are using Selenium as their driver).

However when I try to run multiples of them OR put both of them in the same file I get an error:

"     Failure/Error: visit ('/')
     ArgumentError:
       rack-test requires a rack application, but none was given"

I have an idea of why this is happening, since my tests are all written from a standalone point of view, they all have visit ('/') at the beginning of each test.

When a capybara test "ends" at literally the 'end' at the end of the 'describe' block...does it not close the browser? Or if im writing a test suite should it all assume that the browser is never closed?

The weird thing though, for instance if I run: rspec --tag type:feature spec/features/* I get the same issue (but they are each separate files, so you would think the browser would close, also each test is tagged with :feature so it should (and does) attempt to run them all. It just fails after the first one)

Upvotes: 0

Views: 195

Answers (1)

Thomas Walpole
Thomas Walpole

Reputation: 49950

Since the error message you specify mentions rack-test, not all of your tests are using selenium as the driver. It sounds like you're not testing a local app, so you need to figure out which test isn't using selenium and change it so it is, or set Capybara.default_driver = :selenium (or whatever you've named your instance of the driver that uses selenium) so all tests are using it

Upvotes: 1

Related Questions