I have been following TDD for a new project and am loving it so far. All of my tests pass locally. However, I am trying to use CircleCI and am having problems getting my tests to run there. From my research and the error messages I have seen so far I think I have something wrong with my Rspec setup that is causing trouble with CircleCI. I am not quite sure how to troubleshoot this. My app is Rails 4.2 and Ruby 2.2. If you have any advice or suggestions I appreciate it.
spec_helper.rb
require "webmock/rspec"
require "capybara/rspec"
require "capybara/rails"
# http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.include Rails.application.routes.url_helpers
config.expect_with :rspec do |expectations|
expectations.syntax = :expect
end
config.mock_with :rspec do |mocks|
mocks.syntax = :expect
end
config.order = :random
end
WebMock.disable_net_connect!(allow_localhost: true)
rails_helper.rb
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment", __FILE__)
require "rspec/rails"
require "shoulda/matchers"
Dir[Rails.root.join("spec/support/**/*.rb")].each { |file| require file }
module Features
# Extend this module in spec/support/features/*.rb
include Formulaic::Dsl
end
RSpec.configure do |config|
config.include Features, type: :feature
config.infer_base_class_for_anonymous_controllers = false
config.infer_spec_type_from_file_location!
config.use_transactional_fixtures = false
end
ActiveRecord::Migration.maintain_test_schema!
Capybara.javascript_driver = :webkit
The primary error I have been getting is (there is a long trace that followed):
bundle exec rspec --color --require spec_helper spec --format progress
/home/ubuntu/burger-club/vendor/bundle/ruby/2.2.0/gems/capybara-
2.4.4/lib/capybara/rails.rb:6:in `block (2 levels) in <top (required)>':
uninitialized constant Rails (NameError)