-2

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?

Rajarshi Das
  • 11,778
  • 6
  • 46
  • 74
mmr
  • 14,781
  • 29
  • 95
  • 145
  • So, you want to run another driver on the mac? It's bit unclear to me what you are asking for. [poltergeist](https://github.com/jonleighton/poltergeist) is a phanthomJS driver for capybara that might work. – Andreas Lyngstad Jun 11 '13 at 07:43
  • OK, not sure what the downvotes are for, but hey. Also, @AndreasLyngstad I ended up using poltergeist on the mac side, since it actually works, but I still have different test drivers. Thanks for the tip. – mmr Jun 12 '13 at 18:20

1 Answers1

1

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.

Rajarshi Das
  • 11,778
  • 6
  • 46
  • 74
Jon
  • 3,985
  • 7
  • 48
  • 80