Commit 6dcbd646ddc629258b017b2d08f2b98c076eb1c3
1 parent
b8ba0b75
Exists in
master
and in
4 other branches
disable mailer for Spinach
Showing
2 changed files
with
9 additions
and
1 deletions
Show diff stats
features/support/env.rb
@@ -35,7 +35,7 @@ Capybara.ignore_hidden_elements = false | @@ -35,7 +35,7 @@ Capybara.ignore_hidden_elements = false | ||
35 | DatabaseCleaner.strategy = :truncation | 35 | DatabaseCleaner.strategy = :truncation |
36 | 36 | ||
37 | Spinach.hooks.before_scenario do | 37 | Spinach.hooks.before_scenario do |
38 | - TestEnv.init | 38 | + TestEnv.init(mailer: false) |
39 | 39 | ||
40 | DatabaseCleaner.start | 40 | DatabaseCleaner.start |
41 | end | 41 | end |
spec/support/test_env.rb
@@ -21,6 +21,10 @@ module TestEnv | @@ -21,6 +21,10 @@ module TestEnv | ||
21 | # | 21 | # |
22 | disable_observers if opts[:observers] == false | 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 | # Use tmp dir for FS manipulations | 28 | # Use tmp dir for FS manipulations |
25 | repos_path = Rails.root.join('tmp', 'test-git-base-path') | 29 | repos_path = Rails.root.join('tmp', 'test-git-base-path') |
26 | Gitlab.config.gitlab_shell.stub(repos_path: repos_path) | 30 | Gitlab.config.gitlab_shell.stub(repos_path: repos_path) |
@@ -76,4 +80,8 @@ module TestEnv | @@ -76,4 +80,8 @@ module TestEnv | ||
76 | def disable_observers | 80 | def disable_observers |
77 | ActiveRecord::Base.observers.disable(:all) | 81 | ActiveRecord::Base.observers.disable(:all) |
78 | end | 82 | end |
83 | + | ||
84 | + def disable_mailer | ||
85 | + ActionMailer::Base.perform_deliveries = false | ||
86 | + end | ||
79 | end | 87 | end |