Question

I have a project that we've been developing thus far entirely on PCs and then deploying on linux. We've developed our tests using capybara and capybara-webkit for javascript.

Turns out, as we try to run things on the mac with mountain lion, that capybara-webkit is broken (I get all kinds of pipe errors, 246 failures out of 1606 tests, 46 when switching to webkit_debug). Judging from their web page and the number of times that error is reported, these kinds of failures just happen. So, I'd like to run our rails tests on windows via capybara and capybara-webkit, but use something like selenium or some other comparable test driver (ie, so that the spec files and locations don't have to change). How can I do this? I'm familiar with C defines, would something like that in the gem files and spec_helper.rb files be sufficient?

Was it helpful?

Solution

Couldn't you do something along the lines of

if RUBY_PLATFORM =~ /mac/
  Capybara.javascript_driver = :firefox
else
  Capybara.javascript_driver = :webkit
end

in spec/support/env.rb?

I don't have a mac, so I'm not sure what the value of RUBY_PLATFORM should be, but by running puts RUBY_PLATFORM in irb, I'm sure you can figure out an appropriate value.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top