Class: Teaspoon::Console
- Inherits:
-
Object
- Object
- Teaspoon::Console
- Defined in:
- lib/teaspoon/console.rb
Instance Method Summary collapse
- #execute(options = {}) ⇒ Object
- #execute_without_handling(options = {}) ⇒ Object
- #export(suite) ⇒ Object
- #failures? ⇒ Boolean
-
#initialize(options = {}) ⇒ Console
constructor
A new instance of Console.
- #run_specs(suite) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Console
Returns a new instance of Console.
6 7 8 9 10 11 12 13 14 |
# File 'lib/teaspoon/console.rb', line 6 def initialize( = {}) @options = @suites = {} Teaspoon::Environment.load(@options) @server = start_server rescue Teaspoon::ServerException => e abort(e.) end |
Instance Method Details
#execute(options = {}) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/teaspoon/console.rb', line 20 def execute( = {}) execute_without_handling() rescue Teaspoon::Failure false rescue Teaspoon::Error => e abort(e.) end |
#execute_without_handling(options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/teaspoon/console.rb', line 28 def execute_without_handling( = {}) @options.merge!() @suites = {} resolve(@options[:files]) 0 == suites.inject(0) do |failures, suite| export(suite) if @options.include?(:export) failures += run_specs(suite) log("") # empty line for space failures end end |
#export(suite) ⇒ Object
50 51 52 53 54 |
# File 'lib/teaspoon/console.rb', line 50 def export(suite) raise Teaspoon::UnknownSuite, "Unknown suite: \"#{suite}\"" unless Teaspoon.configuration.suite_configs[suite.to_s] log("Teaspoon exporting #{suite} suite at #{base_url_for(suite)}") Teaspoon::Exporter.new(suite, url_for(suite, false), @options[:export]).export end |
#failures? ⇒ Boolean
16 17 18 |
# File 'lib/teaspoon/console.rb', line 16 def failures? !execute end |
#run_specs(suite) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/teaspoon/console.rb', line 41 def run_specs(suite) raise Teaspoon::UnknownSuite, "Unknown suite: \"#{suite}\"" unless Teaspoon.configuration.suite_configs[suite.to_s] log("Teaspoon running #{suite} suite at #{base_url_for(suite)}") runner = Teaspoon::Runner.new(suite) driver.run_specs(runner, url_for(suite)) raise Teaspoon::Failure if Teaspoon.configuration.fail_fast && runner.failure_count > 0 runner.failure_count end |