Search code examples
ruby-on-railscapybarabundlerrspec-rails

dependency &/or bundler error? rails is calling non-installed gems


Capybara-screenshot is still running even though it was removed from my code and gemfile

To start off, this may be a continuation of a problem I encountered on the same project/machine previously Firefox is default but still get WebDriverError: unable to connect to chromedriver 127.0.0.1:9515 I've been working with legacy code didn't as much care and attention to updating gems as I should have.

What triggered this is that i was using capybara-screenshot which started giving me strange behaviour. When I removed it, i was able to isolate the problem to the deprecated gem chromedriver-helper. Upon migrating to the webdrivers gem, my failed system specs are still creating screenshots.

I have a sneaking suspicion that rbenv is acting up but can't put my finger on it. I've included my gemfile below in case I'm using some versions that don't play nice together.

If others agree that rbenv may be contributing here, can i safely uninstall/reinstall it without breaking this/other projects on this computer?

Of course, I'm open to other suggestions as well.

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

gem 'wrapper_based'
gem 'rails', '~> 5.1-stable'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.7'
gem 'sassc-rails', '~> 2.1.1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'foundation-rails'
gem 'autoprefixer-rails'
group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'rspec-rails', '~> 3.6'
  gem 'database_cleaner'
  gem 'faker'
  gem "factory_bot_rails"
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
  gem 'capybara'
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  gem 'selenium-webdriver'
  gem 'webdrivers'
end

1) example name Failure/Error: expect(page).to have_content("[expected]") expected to find text "[expected]" in "[actual]"

 [Screenshot]: tmp/screenshots/failures_r_spec_example_groups_[spec_name]_318.png


 # ./spec/system/[spec_name]

Solution

  • This has nothing to do with the capybara-screenshot gem. This is because you're using RSpec System specs which build on Rails System tests, which provide their own save screenshot on failed test behavior.

    https://github.com/rspec/rspec-rails/blob/master/lib/rspec/rails/example/system_example_group.rb#L68