I've followed the README at the spinach repo as well as including spinach-rails instead of the base spinach gem.
Spinach documentation states:
# When using Capybara, you can switch the driver to use another one with
# javascript capabilities (Selenium, Poltergeist, capybara-webkit, ...)
#
# Spinach already integrates with Capybara if you add
# `require spinach/capybara` in `features/support/env.rb`.
Which I have done:
Head of my env.rb file:
require 'spinach-rails'
require 'spinach/capybara'
ENV['RAILS_ENV'] = 'feature'
require 'rspec'
require 'factory_girl_rails'
require 'webmock'
require 'coffee_script'
include WebMock::API
WebMock.disable_net_connect!(:allow_localhost => true)
require_relative '../../config/environment'
The step failing in the test reads:
step 'I see the Generals Page' do
expect(page).to have_content("Inventory")
end
When I inspect the Spinach::FeatureSteps class using RubyMine I can see two hits - one to the "base" class and the other to the capybara version:
require 'capybara'
require 'capybara/dsl'
require 'rbconfig'
require 'spinach/config'
require_relative 'feature_steps'
module Spinach
class FeatureSteps
# Spinach's capybara module makes Capybara DSL available in all features.
#
# @example
# require 'spinach/capybara'
# class CapybaraFeature < Spinach::FeatureSteps
# Given "I go to the home page" do
# visit '/'
# end
# end
#
module Capybara
include ::Capybara::DSL
Which really makes it seem like there should be a switch of sorts in the spinach configuration that lets me choose to use the capybara DSL in my tests.
But it doesn't appear to be working properly.
How can I get Capybara working with Spinach?
Gemfile.lock:
spinach (0.8.10)
colorize
gherkin-ruby (>= 0.3.2)
json
spinach-rails (0.2.1)
capybara (>= 2.0.0)
railties (>= 3)
spinach (>= 0.4)
test and feature group in Gemfile:
group :test, :feature do
gem "factory_girl_rails"
gem "capybara"
gem "webmock"
gem "capybara-webkit"
gem "spinach-rails"
end