summaryrefslogtreecommitdiff
path: root/features/support/env.rb
diff options
context:
space:
mode:
Diffstat (limited to 'features/support/env.rb')
-rw-r--r--features/support/env.rb30
1 files changed, 25 insertions, 5 deletions
diff --git a/features/support/env.rb b/features/support/env.rb
index f394c30d52f..608d988755c 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -5,16 +5,12 @@ ENV['RAILS_ENV'] = 'test'
require './config/environment'
require 'rspec/expectations'
-require_relative 'capybara'
-require_relative 'db_cleaner'
-require_relative 'rerun'
-
if ENV['CI']
require 'knapsack'
Knapsack::Adapters::SpinachAdapter.bind
end
-%w(select2_helper test_env repo_helpers wait_for_ajax sidekiq).each do |f|
+%w(select2_helper test_env repo_helpers wait_for_requests sidekiq).each do |f|
require Rails.root.join('spec', 'support', f)
end
@@ -32,4 +28,28 @@ Spinach.hooks.before_run do
TestEnv.disable_pre_receive
include FactoryGirl::Syntax::Methods
+ include GitlabRoutingHelper
+end
+
+Spinach.hooks.after_scenario do |scenario_data, step_definitions|
+ if scenario_data.tags.include?('javascript')
+ include WaitForRequests
+ block_and_wait_for_requests_complete
+ end
end
+
+module StdoutReporterWithScenarioLocation
+ # Override the standard reporter to show filename and line number next to each
+ # scenario for easy, focused re-runs
+ def before_scenario_run(scenario, step_definitions = nil)
+ @max_step_name_length = scenario.steps.map(&:name).map(&:length).max if scenario.steps.any?
+ name = scenario.name
+
+ # This number has no significance, it's just to line things up
+ max_length = @max_step_name_length + 19
+ out.puts "\n #{'Scenario:'.green} #{name.light_green.ljust(max_length)}" \
+ " # #{scenario.feature.filename}:#{scenario.line}"
+ end
+end
+
+Spinach::Reporter::Stdout.prepend(StdoutReporterWithScenarioLocation)