spec_helper.rb 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # This file is copied to spec/ when you run 'rails generate rspec:install'
  2. ENV["RAILS_ENV"] ||= 'test'
  3. require File.expand_path("../../config/environment", __FILE__)
  4. require 'rspec/rails'
  5. require 'rspec/autorun'
  6. require 'rr'
  7. require 'webmock/rspec'
  8. WebMock.disable_net_connect!
  9. # Requires supporting ruby files with custom matchers and macros, etc,
  10. # in spec/support/ and its subdirectories.
  11. Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
  12. RSpec.configure do |config|
  13. config.mock_with :rr
  14. # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  15. config.fixture_path = "#{::Rails.root}/spec/fixtures"
  16. # If you're not using ActiveRecord, or you'd prefer not to run each of your
  17. # examples within a transaction, remove the following line or assign false
  18. # instead of true.
  19. config.use_transactional_fixtures = true
  20. # If true, the base class of anonymous controllers will be inferred
  21. # automatically. This will be the default behavior in future versions of
  22. # rspec-rails.
  23. config.infer_base_class_for_anonymous_controllers = false
  24. # Run specs in random order to surface order dependencies. If you find an
  25. # order dependency and want to debug it, you can fix the order by providing
  26. # the seed, which is printed after each run.
  27. # --seed 1234
  28. config.order = "random"
  29. config.global_fixtures = :all
  30. config.treat_symbols_as_metadata_keys_with_true_values = true
  31. config.include Devise::TestHelpers, :type => :controller
  32. config.include SpecHelpers
  33. end