Class: Snapdragon::CliApplication
- Inherits:
-
Object
- Object
- Snapdragon::CliApplication
- Defined in:
- lib/snapdragon/cli_application.rb
Instance Method Summary collapse
-
#initialize(options, paths) ⇒ CliApplication
constructor
A new instance of CliApplication.
- #run ⇒ Object
- #serve ⇒ Object
Constructor Details
#initialize(options, paths) ⇒ CliApplication
Returns a new instance of CliApplication.
16 17 18 |
# File 'lib/snapdragon/cli_application.rb', line 16 def initialize(, paths) @suite = Snapdragon::Suite.new(, paths) end |
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/snapdragon/cli_application.rb', line 20 def run session = Capybara::Session.new(:poltergeist, Snapdragon::WebApplication.new(nil, @suite)) if @suite.filtered? session.visit("/run?spec=#{@suite.spec_query_param}") else session.visit("/run") end session.find("#testscomplete") return 0 end |
#serve ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/snapdragon/cli_application.rb', line 31 def serve server = Capybara::Server.new(Snapdragon::WebApplication.new(nil, @suite), 9292) server.boot if @suite.filtered? Launchy.open("http://localhost:9292/run?spec=#{@suite.spec_query_param}") else Launchy.open('http://localhost:9292/run') end trap('SIGINT') { puts "Shutting down..."; exit 0 } sleep end |