Class: CypressOnRails::Server
- Inherits:
-
Object
- Object
- CypressOnRails::Server
- Defined in:
- lib/cypress_on_rails/server.rb
Instance Attribute Summary collapse
-
#framework ⇒ Object
readonly
Returns the value of attribute framework.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#install_folder ⇒ Object
readonly
Returns the value of attribute install_folder.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #init ⇒ Object
-
#initialize(options = {}) ⇒ Server
constructor
A new instance of Server.
- #open ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Server
Returns a new instance of Server.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cypress_on_rails/server.rb', line 11 def initialize( = {}) config = CypressOnRails.configuration @framework = [:framework] || :cypress @host = [:host] || config.server_host @port = [:port] || config.server_port || find_available_port @port = @port.to_i if @port @install_folder = [:install_folder] || config.install_folder || detect_install_folder @transactional = .fetch(:transactional, config.transactional_server) # Process management: track PID and process group for proper cleanup @server_pid = nil @server_pgid = nil end |
Instance Attribute Details
#framework ⇒ Object (readonly)
Returns the value of attribute framework.
9 10 11 |
# File 'lib/cypress_on_rails/server.rb', line 9 def framework @framework end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
9 10 11 |
# File 'lib/cypress_on_rails/server.rb', line 9 def host @host end |
#install_folder ⇒ Object (readonly)
Returns the value of attribute install_folder.
9 10 11 |
# File 'lib/cypress_on_rails/server.rb', line 9 def install_folder @install_folder end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
9 10 11 |
# File 'lib/cypress_on_rails/server.rb', line 9 def port @port end |
Instance Method Details
#init ⇒ Object
38 39 40 41 |
# File 'lib/cypress_on_rails/server.rb', line 38 def init ensure_install_folder_exists puts "#{framework.to_s.capitalize} configuration initialized at #{install_folder}" end |
#open ⇒ Object
25 26 27 28 29 |
# File 'lib/cypress_on_rails/server.rb', line 25 def open start_server do run_command(open_command, "Opening #{framework} test runner") end end |
#run ⇒ Object
31 32 33 34 35 36 |
# File 'lib/cypress_on_rails/server.rb', line 31 def run start_server do result = run_command(run_command_args, "Running #{framework} tests") exit(result ? 0 : 1) end end |