Я использую Rails 6 с Grape, и я не знаю, почему мои спецификации без всякой причины начали возвращать такую ошибку
An error occurred while loading ./spec/controllers/health_check_spec.rb.
Failure/Error: require File.expand_path('../config/environment', __dir__)
ActiveSupport::MessageEncryptor::InvalidMessage:
ActiveSupport::MessageEncryptor::InvalidMessage
Что очень странно, потому что раньше у меня не было такой проблемы. Я добавляю devise
и shoulda-matchers gem
, но даже без этих драгоценных камней я получаю ту же ошибку.
spec_helper:
require 'simplecov'
SimpleCov.start
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.default_formatter = 'doc' if config.files_to_run.one?
config.shared_context_metadata_behavior = :apply_to_host_groups
config.profile_examples = 10
config.order = :random
Kernel.srand config.seed
end
rails_helper:
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
abort('The Rails environment is running in production mode!') if Rails.env.production?
require 'rspec/rails'
begin
ActiveRecord::Migration.maintain_test_schema!
rescue ActiveRecord::PendingMigrationError => e
puts e.to_s.strip
exit 1
end
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace!
end
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end