闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. ENV['RAILS_ENV'] ||= 'test'
  2. require File.expand_path('../../config/environment', __FILE__)
  3. abort("The Rails environment is running in production mode!") if Rails.env.production?
  4. require 'spec_helper'
  5. require 'rspec/rails'
  6. require 'webmock/rspec'
  7. require 'paperclip/matchers'
  8. ActiveRecord::Migration.maintain_test_schema!
  9. WebMock.disable_net_connect!(allow: 'localhost:7575')
  10. Sidekiq::Testing.inline!
  11. RSpec.configure do |config|
  12. config.fixture_path = "#{::Rails.root}/spec/fixtures"
  13. config.use_transactional_fixtures = true
  14. config.infer_spec_type_from_file_location!
  15. config.filter_rails_from_backtrace!
  16. config.include Devise::Test::ControllerHelpers, type: :controller
  17. config.include Devise::TestHelpers, type: :view
  18. config.include Paperclip::Shoulda::Matchers
  19. end
  20. RSpec::Sidekiq.configure do |config|
  21. config.warn_when_jobs_not_processed_by_sidekiq = false
  22. end
  23. def request_fixture(name)
  24. File.read(File.join(Rails.root, 'spec', 'fixtures', 'requests', name))
  25. end
  26. def attachment_fixture(name)
  27. File.open(File.join(Rails.root, 'spec', 'fixtures', 'files', name))
  28. end