Search code examples
ruby-on-railsrspeccapybaragemfile

NoMethodError: undefined method `last_comment' during Capybara test


Is there a specific update to the Gemfile that needs to be made in order to run rspec/capybara feature tests? My gemfile is using ruby '2.5.3' and 'rails', '~. 5.2.4'. I have another test app that is rails 5.2.1 and ruby 2.5.1 that is not running into this issue. I have tried changing around the versions of rspec and capybara with no such luck. I know there is an issue with rake versions before Rake 11 where certain methods were removed. Would this be the cause or another version issue in Gemfile:

Gemfile ruby '2.5.3'
gem 'rails', '~> 5.2.4'

group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'rspec-rails', '3.1.0'
end

group :test do<br>
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  gem 'chromedriver-helper'
end

Solution

  • rsepc-rails 3.1.0 was released in September 2014 and is not compatible with Rake 11.0.1 or 12+ - Upgrade to the latest 3.x release of rspec-rails(3.9.1 as of now)