mardi 28 novembre 2017

Capybara not working with mini-test and rails. Keep getting "uninitialized constant Capybara::Minitest::Capybara"

I know this usually means something is missing by way of a require, but I can't figure it out. Here's my test_helper.rb:

ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment", __FILE__)
require "rails/test_help"
require "minitest/rails"
require 'capybara/rails'
require 'capybara/minitest'

# To add Capybara feature tests add `gem "minitest-rails-capybara"`
# to the test group in the Gemfile and uncomment the following:

require 'minitest/rails/capybara'

and a portion of my Gemfile.lock

minitest-capybara (0.8.2)
  capybara (~> 2.2)
  minitest (~> 5.0)
  rake
minitest-metadata (0.6.0)
  minitest (>= 4.7, < 6.0)
minitest-rails (3.0.0)
  minitest (~> 5.8)
  railties (~> 5.0)
minitest-rails-capybara (3.0.1)
  capybara (~> 2.7)
  minitest-capybara (~> 0.8)
  minitest-metadata (~> 0.6)
  minitest-rails (~> 3.0)

If I comment out this line:

require 'minitest/rails/capybara'

I get:

undefined method `feature' for main:Object (NoMethodError)

While trying to test a feature.

Anyone have any ideas?

Full trace for gigs:

ruby test/features/can_access_home_test.rb
/usr/local/bundle/gems/minitest-capybara-0.8.2/lib/capybara/assertions.rb:37:in `<module:Assertions>': uninitialized constant Capybara::Minitest::Capybara (NameError)
    from /usr/local/bundle/gems/minitest-capybara-0.8.2/lib/capybara/assertions.rb:2:in `<module:Capybara>'
    from /usr/local/bundle/gems/minitest-capybara-0.8.2/lib/capybara/assertions.rb:1:in `<top (required)>'
    from /usr/local/bundle/gems/minitest-capybara-0.8.2/lib/minitest/capybara.rb:23:in `<top (required)>'
    from /usr/local/bundle/gems/minitest-capybara-0.8.2/lib/minitest-capybara.rb:2:in `<top (required)>'
    from /usr/local/bundle/gems/minitest-rails-capybara-3.0.1/lib/minitest/rails/capybara.rb:3:in `<top (required)>'
    from /usr/src/app/test/test_helper.rb:11:in `<top (required)>'
    from test/features/can_access_home_test.rb:1:in `require_relative'
    from test/features/can_access_home_test.rb:1:in `<main>'

Aucun commentaire:

Enregistrer un commentaire