Class: StartRspec
- Inherits:
-
RspecStarterTask
- Object
- RspecStarterStep
- RspecStarterTask
- StartRspec
- Defined in:
- lib/rspec_starter/tasks/start_rspec.rb
Overview
The step that actually starts the RSpec.
Instance Attribute Summary
Attributes inherited from RspecStarterStep
#exit_status, #id, #name, #options, #quiet, #run_time, #runner, #successful
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(id, runner, options) ⇒ StartRspec
constructor
A new instance of StartRspec.
- #starting_message ⇒ Object
Methods inherited from RspecStarterTask
name_for_class, register_option
Methods inherited from RspecStarterStep
default_stop_on_problem, #failed?, #helpers, provide_options_to, #quiet?, #run, #should_skip?, #stop_on_problem?, #verbose?
Constructor Details
#initialize(id, runner, options) ⇒ StartRspec
Returns a new instance of StartRspec.
19 20 21 22 23 24 25 26 27 |
# File 'lib/rspec_starter/tasks/start_rspec.rb', line 19 def initialize(id, runner, ) super # Updated once task executes @command = nil @status = nil @stdout = nil @stderr = nil end |
Class Method Details
.default_quiet ⇒ Object
15 16 17 |
# File 'lib/rspec_starter/tasks/start_rspec.rb', line 15 def self.default_quiet false end |
.description ⇒ Object
3 4 5 |
# File 'lib/rspec_starter/tasks/start_rspec.rb', line 3 def self.description "Start RSpec." end |
.register_options ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/rspec_starter/tasks/start_rspec.rb', line 7 def self. register_option name: "skip_display_server", default: false, switch: '--skip-display-server', switch_description: "DO NOT check for a display server", description: "true/false to enable/disable starting the display server" register_option name: "command", default: "bundle exec rspec", description: "A command string that is used to start RSpec." end |
Instance Method Details
#execute ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rspec_starter/tasks/start_rspec.rb', line 33 def execute if quiet? print @stdout, @stderr, @status = Open3.capture3(@command) else puts "\n\n" @verbose_command_passed = system @command @status = $CHILD_STATUS print end problem(exit_status: @status.exitstatus) if rspec_failed? end |
#starting_message ⇒ Object
29 30 31 |
# File 'lib/rspec_starter/tasks/start_rspec.rb', line 29 def "Running specs with '#{command.colorize(:light_blue)}'" end |