Module: RSpecAtoms::Run
- Defined in:
- lib/rspec_atoms/run.rb
Constant Summary collapse
- DEFAULT_JUNIT_OUTPUT =
"tmp/rspec.xml"
Class Method Summary collapse
- .call(arguments, junit_output: DEFAULT_JUNIT_OUTPUT, output: $stdout, error: $stderr) ⇒ Object
- .ensure_output_directory(junit_output) ⇒ Object
- .inject_formatters(arguments, junit_output) ⇒ Object
Class Method Details
.call(arguments, junit_output: DEFAULT_JUNIT_OUTPUT, output: $stdout, error: $stderr) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rspec_atoms/run.rb', line 14 def call( arguments, junit_output: DEFAULT_JUNIT_OUTPUT, output: $stdout, error: $stderr ) ensure_output_directory(junit_output) RSpec::Core::Runner.run( inject_formatters(arguments, junit_output), error, output ) end |
.ensure_output_directory(junit_output) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/rspec_atoms/run.rb', line 46 def ensure_output_directory(junit_output) directory = File.dirname(junit_output) return if directory == "." FileUtils.mkdir_p(directory) end |
.inject_formatters(arguments, junit_output) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rspec_atoms/run.rb', line 29 def inject_formatters(arguments, junit_output) separator_index = arguments.index("--") || arguments.length = arguments[0...separator_index] selectors = arguments[separator_index..] || [] [ *, "--format", "progress", "--format", "RSpecAtoms::JunitFormatter", "--out", junit_output, *selectors ] end |