Class: Teaspoon::Console
- Inherits:
-
Object
- Object
- Teaspoon::Console
- Defined in:
- lib/teaspoon/console.rb
Instance Method Summary collapse
- #execute(options = {}) ⇒ Object
- #execute_without_handling(execute_options = {}) ⇒ Object
- #export(suite) ⇒ Object
- #failures? ⇒ Boolean
-
#initialize(options = {}) ⇒ Console
constructor
A new instance of Console.
- #options ⇒ Object
- #run_specs(suite) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Console
Returns a new instance of Console.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/teaspoon/console.rb', line 6 def initialize( = {}) @default_options = @suites = {} Teaspoon::Environment.check_env!([:environment]) Teaspoon::Environment.load() @server = start_server rescue Teaspoon::ServerError => e Teaspoon.abort(e.) end |
Instance Method Details
#execute(options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/teaspoon/console.rb', line 27 def execute( = {}) execute_without_handling() rescue Teaspoon::Failure false rescue Teaspoon::RunnerError => e log(e.) false rescue Teaspoon::Error => e Teaspoon.abort(e.) end |
#execute_without_handling(execute_options = {}) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/teaspoon/console.rb', line 38 def execute_without_handling( = {}) @execute_options = @suites = {} resolve([:files]) 0 == suites.inject(0) do |failures, suite| export(suite) if .include?(:export) failures += run_specs(suite) log("") # empty line for space failures end end |
#export(suite) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/teaspoon/console.rb', line 61 def export(suite) raise Teaspoon::UnknownSuite.new(name: 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), [:export]).export end |
#failures? ⇒ Boolean
23 24 25 |
# File 'lib/teaspoon/console.rb', line 23 def failures? !execute end |
#options ⇒ Object
17 18 19 20 21 |
# File 'lib/teaspoon/console.rb', line 17 def @execute_options ||= {} @default_options ||= {} @default_options.merge(@execute_options) end |
#run_specs(suite) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/teaspoon/console.rb', line 51 def run_specs(suite) raise Teaspoon::UnknownSuite.new(name: 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 |