Class: Cypress::Server
- Inherits:
-
Object
- Object
- Cypress::Server
- Defined in:
- lib/cypress/server.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Server
constructor
A new instance of Server.
- #mode ⇒ Object
- #run ⇒ Object
- #run_command(command) ⇒ Object
Constructor Details
#initialize(args) ⇒ Server
Returns a new instance of Server.
6 7 8 9 10 11 |
# File 'lib/cypress/server.rb', line 6 def initialize(args) @args = args @callback_server = CallbackServer.new(self) @runner = Runner.new self, @callback_server.callback_url @scenario_bank = ScenarioBank.new end |
Instance Method Details
#mode ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/cypress/server.rb', line 13 def mode if @args.first == 'run' 'run' else 'open' end end |
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cypress/server.rb', line 21 def run load_cypress_helper server_port = boot_rails @scenario_bank.boot @callback_thread = Thread.new { @callback_server.start } @runner_thread = Thread.new { @runner.run server_port } @runner_thread.join @callback_server.shutdown end |
#run_command(command) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cypress/server.rb', line 33 def run_command(command) @scenario_bank.load if command['scenario'] and (block = @scenario_bank[command['scenario']]) reset_rspec if configuration.test_framework == :rspec call_database_cleaner if configuration.db_resetter == :database_cleaner configuration.before.call block.call end end |