Class: Everqueen::Runner::TestRunner
- Inherits:
-
Object
- Object
- Everqueen::Runner::TestRunner
- Defined in:
- lib/everqueen/runner.rb
Instance Attribute Summary collapse
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
-
#test ⇒ Object
readonly
Returns the value of attribute test.
Instance Method Summary collapse
- #dots ⇒ Object
- #examples ⇒ Object
- #failed_examples ⇒ Object
- #failure_messages ⇒ Object
-
#initialize(runner, test) ⇒ TestRunner
constructor
A new instance of TestRunner.
- #io ⇒ Object
- #passed? ⇒ Boolean
- #run ⇒ Object
- #session ⇒ Object
Constructor Details
#initialize(runner, test) ⇒ TestRunner
Returns a new instance of TestRunner.
27 28 29 30 |
# File 'lib/everqueen/runner.rb', line 27 def initialize(runner, test) @runner = runner @test = test end |
Instance Attribute Details
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
25 26 27 |
# File 'lib/everqueen/runner.rb', line 25 def runner @runner end |
#test ⇒ Object (readonly)
Returns the value of attribute test.
25 26 27 |
# File 'lib/everqueen/runner.rb', line 25 def test @test end |
Instance Method Details
#dots ⇒ Object
78 79 80 |
# File 'lib/everqueen/runner.rb', line 78 def dots examples; "" end |
#examples ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/everqueen/runner.rb', line 47 def examples @results ||= begin session.visit(test.url) previous_results = "" session.wait_until(300) do dots = session.evaluate_script('Everqueen.dots') io.print dots.sub(/^#{Regexp.escape(previous_results)}/, '') io.flush previous_results = dots session.evaluate_script('Everqueen.done') end dots = session.evaluate_script('Everqueen.dots') io.print dots.sub(/^#{Regexp.escape(previous_results)}/, '') JSON.parse(session.evaluate_script('Everqueen.getResults()')).map do |row| Example.new(row) end end end |
#failed_examples ⇒ Object
70 71 72 |
# File 'lib/everqueen/runner.rb', line 70 def failed_examples examples.select { |example| not example.passed? } end |
#failure_messages ⇒ Object
82 83 84 85 86 |
# File 'lib/everqueen/runner.rb', line 82 def unless passed? examples.map { |example| example. }.compact.join("\n\n") end end |
#io ⇒ Object
36 37 38 |
# File 'lib/everqueen/runner.rb', line 36 def io runner.io end |
#passed? ⇒ Boolean
74 75 76 |
# File 'lib/everqueen/runner.rb', line 74 def passed? examples.all? { |example| example.passed? } end |
#run ⇒ Object
40 41 42 43 44 45 |
# File 'lib/everqueen/runner.rb', line 40 def run io.puts dots io.puts io.puts "\n#{examples.size} assertions, #{failed_examples.size} failures" passed? end |
#session ⇒ Object
32 33 34 |
# File 'lib/everqueen/runner.rb', line 32 def session runner.session end |