1
0

spec_helper.rb 2.0 KB

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