|
| 1 | +ENV['NEW_RELIC_ENV'] = 'test' |
| 2 | + |
| 3 | +require 'bundler' |
| 4 | +Bundler.require |
| 5 | +require './lib/eureka-bot' |
| 6 | +require 'webmock/rspec' |
| 7 | +require 'vcr' |
| 8 | +require 'factory_girl' |
| 9 | + |
| 10 | +$:.unshift File.dirname(__FILE__) + '/..' |
| 11 | +Dir['spec/support/**/*.rb'].each { |f| require f } |
| 12 | + |
| 13 | +RSpec.configure do |config| |
| 14 | + config.include WebRequestHelper |
| 15 | + config.include SettingsHelper |
| 16 | + config.include FactoryGirl::Syntax::Methods |
| 17 | + |
| 18 | + config.before(:suite) do |
| 19 | + FactoryGirl.find_definitions |
| 20 | + lint_time = Benchmark.realtime do |
| 21 | + factories_for_lint = FactoryGirl.factories.select{|f| f.send(:class_name) != Hash} |
| 22 | + FactoryGirl.lint(factories_for_lint) |
| 23 | + end |
| 24 | + # puts "=== FactoryGirl.lint complete in #{lint_time} seconds ===" |
| 25 | + end |
| 26 | + |
| 27 | + config.expect_with :rspec do |expectations| |
| 28 | + expectations.include_chain_clauses_in_custom_matcher_descriptions = true |
| 29 | + end |
| 30 | + |
| 31 | + config.mock_with :rspec do |mocks| |
| 32 | + mocks.verify_partial_doubles = true |
| 33 | + end |
| 34 | + |
| 35 | + config.disable_monkey_patching! |
| 36 | + # config.warnings = true |
| 37 | + |
| 38 | + config.profile_examples = 10 |
| 39 | + config.order = :random |
| 40 | + |
| 41 | + # tag to disable VCR and WebMock |
| 42 | + # it 'Real web request', :novcr { ... } |
| 43 | + config.around do |example| |
| 44 | + if example.metadata[:novcr] |
| 45 | + with_web_request do |
| 46 | + example.run |
| 47 | + end |
| 48 | + else |
| 49 | + example.run |
| 50 | + end |
| 51 | + end |
| 52 | + |
| 53 | + Kernel.srand config.seed |
| 54 | +end |
| 55 | + |
| 56 | +VCR.configure do |c| |
| 57 | + c.cassette_library_dir = 'spec/cassettes' |
| 58 | + c.hook_into :webmock |
| 59 | + c.configure_rspec_metadata! |
| 60 | +end |
0 commit comments