3

I'm trying to install capybara on a setup with Ruby 1.8.7 and Rails 2.3, but I received this message:

capybara requires Ruby version >= 1.9.3.

I have two questions.

The more relevant question:

  • What is the latest capybara version compatible with that setup?

The more important question:

  • How I can check that on my own?
Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
Arnold Roa
  • 7,335
  • 5
  • 50
  • 69

2 Answers2

2

Regarding Capybara's Ruby version dependency, I went to the capybara source code and read its History. Searching for "Ruby" quickly got me to the statement that Capybara dropped support for Ruby 1.8 in version 2.0.0. So the previous version, 1.1.4, is the most recent version compatible with Ruby 1.8.

Unfortunately that file says nothing about Rails versions. My Rails 2 projects used webrat, so I don't have any personal data points. However, Googling '"rails 2" capybara version' turns up examples of using Capybara 1.1 with Rails 2 (for example in the Cucumber documentation), so the most recent Capybara version that is compatible with your Ruby is also compatible with your Rails.

Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
  • I didn't know webrat, it allows me to write integration tests? I want to write integration test for an app running rails 2.3 but wanted to use rspec, not test::unit – Arnold Roa Aug 03 '14 at 15:30
  • webrat is an older tool. Capybara displaced it. rspec or Cucumber and capybara are the usual way to write acceptance/integration tests these days, and per the above you can use them even with Rails 2. – Dave Schweisguth Aug 03 '14 at 15:33
  • Capybara requires rubyzip, which requires ruby 1.9. When I tried to install capybara 1.1.3 it raises this error: `ERROR: Error installing rubyzip: rubyzip requires Ruby version >= 1.9.2.` – Arnold Roa Aug 03 '14 at 19:43
  • See whether Capybara 1.1.x is compatible with an older rubyzip. Put `gem rubyzip 0.9.9` in your Gemfile. – Dave Schweisguth Aug 03 '14 at 19:46
  • @DaveSchweisguth Yes, you're right, with `gem rubyzip 0.9.9` even Capybara 1.1.4 can be installed. Thanks! – khyox Dec 29 '14 at 15:17
  • @khyox, I have installed older rubyzip, but now I cannot install xpath gem as it requires mini_portile2, I do not know how to go around this. I have checked the xpath.gemspec and there are only 2 dependencies(rspec & yard) which I have installed manually but still gem installer want to install mini_portile2. The suppported version of mini_portile2 is named mini_portile so installation of it, did not help. I thought that I could rename the old version of gem, but I do not know to install it manually as there is no .gemspec file in src? – eldi Mar 10 '16 at 09:31
1

In your gemfile, specify a version so you can install it. Looking at an REE app i have at work, we're using 1.1.4:

gem 'capybara', '~> 1.1.4'

The ~> with 1.1.x will ensure it always stays at a 1.1.x patch level. Similarly if you use ~> 1.2 it will always stay at a 1.x patch level.

agmcleod
  • 13,321
  • 13
  • 57
  • 96