Class: CypressRails::LaunchesCypress
- Inherits:
-
Object
- Object
- CypressRails::LaunchesCypress
- Defined in:
- lib/cypress-rails/launches_cypress.rb
Instance Method Summary collapse
- #call(command, config) ⇒ Object
-
#initialize ⇒ LaunchesCypress
constructor
A new instance of LaunchesCypress.
Constructor Details
#initialize ⇒ LaunchesCypress
Returns a new instance of LaunchesCypress.
9 10 11 12 13 14 |
# File 'lib/cypress-rails/launches_cypress.rb', line 9 def initialize @initializer_hooks = InitializerHooks.instance @manages_transactions = ManagesTransactions.instance @starts_rails_server = StartsRailsServer.new @finds_bin = FindsBin.new end |
Instance Method Details
#call(command, config) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cypress-rails/launches_cypress.rb', line 16 def call(command, config) puts config.to_s @initializer_hooks.run(:before_server_start) if config.transactional_server @manages_transactions.begin_transaction end server = @starts_rails_server.call( host: config.host, port: config.port, transactional_server: config.transactional_server ) bin = @finds_bin.call(config.cypress_dir) set_exit_hooks!(config) command = <<~EXEC CYPRESS_BASE_URL="http://#{server.host}:#{server.port}#{config.base_path}" "#{bin}" #{command} --project "#{config.cypress_dir}" #{config.cypress_cli_opts} EXEC puts "\nLaunching Cypress…\n$ #{command}\n" system command end |