Commit 6dcbd646ddc629258b017b2d08f2b98c076eb1c3

Authored by Dmitriy Zaporozhets
1 parent b8ba0b75

disable mailer for Spinach

features/support/env.rb
... ... @@ -35,7 +35,7 @@ Capybara.ignore_hidden_elements = false
35 35 DatabaseCleaner.strategy = :truncation
36 36  
37 37 Spinach.hooks.before_scenario do
38   - TestEnv.init
  38 + TestEnv.init(mailer: false)
39 39  
40 40 DatabaseCleaner.start
41 41 end
... ...
spec/support/test_env.rb
... ... @@ -21,6 +21,10 @@ module TestEnv
21 21 #
22 22 disable_observers if opts[:observers] == false
23 23  
  24 + # Disable mailer for spinach tests
  25 + disable_mailer if opts[:mailer] == false
  26 +
  27 +
24 28 # Use tmp dir for FS manipulations
25 29 repos_path = Rails.root.join('tmp', 'test-git-base-path')
26 30 Gitlab.config.gitlab_shell.stub(repos_path: repos_path)
... ... @@ -76,4 +80,8 @@ module TestEnv
76 80 def disable_observers
77 81 ActiveRecord::Base.observers.disable(:all)
78 82 end
  83 +
  84 + def disable_mailer
  85 + ActionMailer::Base.perform_deliveries = false
  86 + end
79 87 end
... ...