spec_helper.rb 1.8 KB

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