spec_helper.rb 1.7 KB

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