Advertisement
Guest User

Untitled

a guest
Sep 10th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  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 'factory_girl_rails'
  5. require 'rspec/rails'
  6. require 'database_cleaner'
  7. require 'simplecov'
  8. SimpleCov.start
  9.  
  10. # Requires supporting ruby files with custom matchers and macros, etc,
  11. # in spec/support/ and its subdirectories.
  12. Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
  13.  
  14. RSpec.configure do |config|
  15.  
  16. # ## Mock Framework
  17. #
  18. # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  19. #
  20. # config.mock_with :mocha
  21. # config.mock_with :flexmock
  22. # config.mock_with :rr
  23.  
  24. # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  25. config.fixture_path = "#{::Rails.root}/spec/fixtures"
  26.  
  27. # If you're not using ActiveRecord, or you'd prefer not to run each of your
  28. # examples within a transaction, remove the following line or assign false
  29. # instead of true.
  30. config.use_transactional_fixtures = true
  31.  
  32. # If true, the base class of anonymous controllers will be inferred
  33. # automatically. This will be the default behavior in future versions of
  34. # rspec-rails.
  35. config.infer_base_class_for_anonymous_controllers = false
  36.  
  37. config.include FactoryGirl::Syntax::Methods
  38.  
  39. # Run specs in random order to surface order dependencies. If you find an
  40. # order dependency and want to debug it, you can fix the order by providing
  41. # the seed, which is printed after each run.
  42. # --seed 1234
  43. config.order = 'random'
  44. config.include Devise::TestHelpers, :type => :controller
  45. config.extend ControllerMacros, :type => :controller
  46.  
  47. config.before(:each) do
  48.  
  49. #La excepcion es para no borrar una tabla de posgis!!!
  50. DatabaseCleaner.clean_with :truncation, {except: %w[spatial_ref_sys]}
  51.  
  52. #Mock for zendesk tickets
  53. allow(::ZenDeskTicketGenerator).to receive(:generate_ticket)
  54. allow(::ZenDeskTicketGenerator).to receive(:generate_user_aware_ticket)
  55.  
  56. #Mock RMQ and cache
  57. allow(V3Driver).to receive(:cache_set)
  58. allow(::MessageQueue).to receive(:get_rabbit_connection).and_return(BunnyMock.new.start)
  59.  
  60. end
  61.  
  62. raise 'Not in test' unless ENV['RAILS_ENV'] == 'test'
  63.  
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement