From d73458bbc51acf98bc2a2d4d86e10136ab75ca31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Wed, 14 Feb 2018 18:14:40 +0100 Subject: [PATCH] Port some changes from gitlab-ee!4532 back to CE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- features/support/env.rb | 7 ++++--- spec/support/{factory_girl.rb => factory_bot.rb} | 0 spec/support/fixture_helpers.rb | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) rename spec/support/{factory_girl.rb => factory_bot.rb} (100%) diff --git a/features/support/env.rb b/features/support/env.rb index 7f5b4c1c11b..15211995918 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -20,15 +20,16 @@ Dir["#{Rails.root}/features/steps/shared/*.rb"].each { |file| require file } Spinach.hooks.before_run do include RSpec::Mocks::ExampleMethods + include ActiveJob::TestHelper + include FactoryBot::Syntax::Methods + include GitlabRoutingHelper + RSpec::Mocks.setup TestEnv.init(mailer: false) # skip pre-receive hook check so we can use # web editor and merge TestEnv.disable_pre_receive - - include FactoryBot::Syntax::Methods - include GitlabRoutingHelper end Spinach.hooks.after_scenario do |scenario_data, step_definitions| diff --git a/spec/support/factory_girl.rb b/spec/support/factory_bot.rb similarity index 100% rename from spec/support/factory_girl.rb rename to spec/support/factory_bot.rb diff --git a/spec/support/fixture_helpers.rb b/spec/support/fixture_helpers.rb index 128aaaf25fe..8854382dc6b 100644 --- a/spec/support/fixture_helpers.rb +++ b/spec/support/fixture_helpers.rb @@ -1,12 +1,12 @@ module FixtureHelpers - def fixture_file(filename) + def fixture_file(filename, dir: '') return '' if filename.blank? - File.read(expand_fixture_path(filename)) + File.read(expand_fixture_path(filename, dir: dir)) end - def expand_fixture_path(filename) - File.expand_path(Rails.root.join('spec/fixtures/', filename)) + def expand_fixture_path(filename, dir: '') + File.expand_path(Rails.root.join(dir, 'spec', 'fixtures', filename)) end end