Class: VerifyDisplayServer
- Inherits:
-
RspecStarterTask
- Object
- RspecStarterStep
- RspecStarterTask
- VerifyDisplayServer
- Defined in:
- lib/rspec_starter/tasks/verify_display_server.rb
Overview
VerifyDisplayServer run tests on the display server. When feature tests run, they need a display server available to execute the feature tests. MacOS provides its own display server that always runs. Linux needs one installed and activated. This task is currently focused on the XVFB display server.
Instance Attribute Summary
Attributes inherited from RspecStarterStep
#exit_status, #id, #name, #options, #quiet, #run_time, #runner, #successful
Class Method Summary collapse
-
.default_stop_on_problem ⇒ Object
Let subsequent steps run if this task runs into a problem checking the display server.
- .description ⇒ Object
- .register_options ⇒ Object
Instance Method Summary collapse
-
#execute ⇒ Object
rubocop:disable Style/IfUnlessModifier, Style/GuardClause.
-
#should_skip? ⇒ Boolean
The app’s bin/start_rspec file might define this task, but the user can specific –skip-display-server at run time to dynamically disable the check.
- #starting_message ⇒ Object
Methods inherited from RspecStarterTask
name_for_class, register_option
Methods inherited from RspecStarterStep
default_quiet, #failed?, #helpers, #initialize, provide_options_to, #quiet?, #run, #stop_on_problem?, #verbose?
Constructor Details
This class inherits a constructor from RspecStarterStep
Class Method Details
.default_stop_on_problem ⇒ Object
Let subsequent steps run if this task runs into a problem checking the display server. This value can be overridden in the applications bin/start_rspec file if the user adds ‘stop_on_problem: true’ to the task line.
15 16 17 |
# File 'lib/rspec_starter/tasks/verify_display_server.rb', line 15 def self.default_stop_on_problem false end |
.description ⇒ Object
5 6 7 |
# File 'lib/rspec_starter/tasks/verify_display_server.rb', line 5 def self.description "Test the installation of XVFB on Linux and ensure it is not installed on Macs." end |
.register_options ⇒ Object
9 10 11 |
# File 'lib/rspec_starter/tasks/verify_display_server.rb', line 9 def self. register_option default: false, switch: '--skip-display-server', switch_description: "DO NOT check for a display server" end |
Instance Method Details
#execute ⇒ Object
rubocop:disable Style/IfUnlessModifier, Style/GuardClause
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rspec_starter/tasks/verify_display_server.rb', line 30 def execute # Check if a Linux user is missing XVFB. XVFB is needed to run RSpec feature tests on Linux. if helpers.is_linux? && helpers.xvfb_not_installed? problem "XVFB isn't installed; feature specs will fail." end # Check if a Mac user has XVFB installed. Macs have their own display server so xvfb is not needed. A dev might have # mistakenly installed it so we can check just in case.. if helpers.is_mac? && helpers.xvfb_installed? problem "XVFB is installed. (It's not needed on a Mac and may cause specs to fail.)" end end |
#should_skip? ⇒ Boolean
The app’s bin/start_rspec file might define this task, but the user can specific –skip-display-server at run time to dynamically disable the check.
21 22 23 |
# File 'lib/rspec_starter/tasks/verify_display_server.rb', line 21 def should_skip? .skip_display_server end |
#starting_message ⇒ Object
25 26 27 |
# File 'lib/rspec_starter/tasks/verify_display_server.rb', line 25 def "Verifying display server" end |