File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change
1
+ # Has to be the first file required so that all other files show coverage information
2
+ require 'simplecov'
3
+
1
4
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
5
# It is recommended to regenerate this file in the future when you upgrade to a
3
6
# newer version of cucumber-rails. Consider adding your own code to a new file
Original file line number Diff line number Diff line change 2
2
set_env ( 'MSF_DATBASE_CONFIG' , Rails . configuration . paths [ 'config/database' ] . existent . first )
3
3
set_env ( 'RAILS_ENV' , 'test' )
4
4
@aruba_timeout_seconds = 4 . minutes
5
- end
5
+ end
6
+
7
+ Before do |scenario |
8
+ command_name = case scenario
9
+ when Cucumber ::Ast ::Scenario , Cucumber ::Ast ::ScenarioOutline
10
+ "#{ scenario . feature . title } #{ scenario . name } "
11
+ when Cucumber ::Ast ::OutlineTable ::ExampleRow
12
+ scenario_outline = scenario . scenario_outline
13
+
14
+ "#{ scenario_outline . feature . title } #{ scenario_outline . name } #{ scenario . name } "
15
+ else
16
+ raise TypeError , "Don't know how to extract command name from #{ scenario . class } "
17
+ end
18
+
19
+ # Used in simplecov_setup so that each scenario has a different name and their coverage results are merged instead
20
+ # of overwriting each other as 'Cucumber Features'
21
+ set_env ( 'SIMPLECOV_COMMAND_NAME' , command_name )
22
+
23
+ simplecov_setup_pathname = Pathname . new ( __FILE__ ) . expand_path . parent . join ( 'simplecov_setup' )
24
+ # set environment variable so child processes will merge their coverage data with parent process's coverage data.
25
+ set_env ( 'RUBYOPT' , "-r#{ simplecov_setup_pathname } #{ ENV [ 'RUBYOPT' ] } " )
26
+ end
Original file line number Diff line number Diff line change
1
+ # @note this file is loaded in env.rb to setup simplecov using RUBYOPTs for child processes
2
+
3
+ require 'simplecov'
4
+
5
+ require 'pathname'
6
+
7
+ root = Pathname ( __FILE__ ) . expand_path . parent . parent . parent
8
+
9
+ SimpleCov . command_name ( ENV [ 'SIMPLECOV_COMMAND_NAME' ] )
10
+ SimpleCov . root ( root )
11
+ load root . join ( '.simplecov' )
You can’t perform that action at this time.
0 commit comments