From 6dcbd646ddc629258b017b2d08f2b98c076eb1c3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 11 Apr 2013 11:50:58 +0300 Subject: [PATCH] disable mailer for Spinach --- features/support/env.rb | 2 +- spec/support/test_env.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/features/support/env.rb b/features/support/env.rb index 7c8a4aa..1693a58 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -35,7 +35,7 @@ Capybara.ignore_hidden_elements = false DatabaseCleaner.strategy = :truncation Spinach.hooks.before_scenario do - TestEnv.init + TestEnv.init(mailer: false) DatabaseCleaner.start end diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index 5358143..175698a 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -21,6 +21,10 @@ module TestEnv # disable_observers if opts[:observers] == false + # Disable mailer for spinach tests + disable_mailer if opts[:mailer] == false + + # Use tmp dir for FS manipulations repos_path = Rails.root.join('tmp', 'test-git-base-path') Gitlab.config.gitlab_shell.stub(repos_path: repos_path) @@ -76,4 +80,8 @@ module TestEnv def disable_observers ActiveRecord::Base.observers.disable(:all) end + + def disable_mailer + ActionMailer::Base.perform_deliveries = false + end end -- libgit2 0.21.2