Class: Quickdraw::Runner
- Inherits:
-
Object
- Object
- Quickdraw::Runner
- Defined in:
- lib/quickdraw/runner.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#failures ⇒ Object
readonly
Returns the value of attribute failures.
-
#successes ⇒ Object
readonly
Returns the value of attribute successes.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
- #failure!(path, &message) ⇒ Object
-
#initialize(tests = nil) ⇒ Runner
constructor
A new instance of Runner.
- #success!(name) ⇒ Object
Constructor Details
#initialize(tests = nil) ⇒ Runner
Returns a new instance of Runner.
18 19 20 21 22 23 |
# File 'lib/quickdraw/runner.rb', line 18 def initialize(tests = nil) @tests = tests @successes = [] @failures = [] end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
25 26 27 |
# File 'lib/quickdraw/runner.rb', line 25 def duration @duration end |
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
25 26 27 |
# File 'lib/quickdraw/runner.rb', line 25 def failures @failures end |
#successes ⇒ Object (readonly)
Returns the value of attribute successes.
25 26 27 |
# File 'lib/quickdraw/runner.rb', line 25 def successes @successes end |
Class Method Details
Instance Method Details
#call ⇒ Object
27 28 29 30 31 |
# File 'lib/quickdraw/runner.rb', line 27 def call @duration = Quickdraw::Timer.time do @tests.each { |(f, t)| t.run(self, [f]) } end end |
#failure!(path, &message) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/quickdraw/runner.rb', line 40 def failure!(path, &) location = caller_locations.drop_while { |l| !l.path.include?(".test.rb") } @failures << [, location, path] Kernel.print "🔴 " # ::Kernel.print "\e[31m⚬\e[0m" end |
#success!(name) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/quickdraw/runner.rb', line 33 def success!(name) @successes << [name] Kernel.print "🟢 " # ::Kernel.print "\e[32m⚬\e[0m" end |