Class: AvocadoFormatter::Cucumber
- Inherits:
-
Object
- Object
- AvocadoFormatter::Cucumber
- Defined in:
- lib/avocado_formatter/cucumber.rb
Constant Summary collapse
- CHARS =
{ :passed => '.', :failed => 'F', :undefined => 'U', :pending => 'P', :skipped => '-' }
Instance Method Summary collapse
- #after_feature(feature) ⇒ Object
- #after_features(features) ⇒ Object
- #before_feature(feature) ⇒ Object
- #done ⇒ Object
- #exception(exception, status) ⇒ Object
-
#initialize(runtime, path_or_io, options) ⇒ Cucumber
constructor
A new instance of Cucumber.
- #label(feature) ⇒ Object
- #progress(status) ⇒ Object
Constructor Details
#initialize(runtime, path_or_io, options) ⇒ Cucumber
Returns a new instance of Cucumber.
10 11 12 13 14 15 16 17 |
# File 'lib/avocado_formatter/cucumber.rb', line 10 def initialize(runtime, path_or_io, ) @runtime, @io, = runtime, ensure_io(path_or_io), @hostname = 'localhost' @port = '1336' @socket = TCPSocket.open(@hostname, @port) @socket.puts(@runtime.scenarios.length); @socket.puts(@runtime.steps.length); end |
Instance Method Details
#after_feature(feature) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/avocado_formatter/cucumber.rb', line 27 def after_feature(feature) # print_elapsed_time @io, @start_time # @io.puts # # @exceptions.each do |(exception, status)| # print_exception(exception, status, 2) # end end |
#after_features(features) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/avocado_formatter/cucumber.rb', line 41 def after_features(features) # @io.puts # print_stats(features, @options) # print_snippets(@options) # print_passing_wip(@options) end |
#before_feature(feature) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/avocado_formatter/cucumber.rb', line 19 def before_feature(feature) # @io.print "#{label(feature)} " # @io.flush # @exceptions = [] # @start_time = Time.now @socket.puts(label(feature)); end |
#done ⇒ Object
63 64 |
# File 'lib/avocado_formatter/cucumber.rb', line 63 def done end |
#exception(exception, status) ⇒ Object
36 37 38 39 |
# File 'lib/avocado_formatter/cucumber.rb', line 36 def exception(exception, status) @exceptions << [exception, status] super if defined?(super) end |
#label(feature) ⇒ Object
6 7 8 |
# File 'lib/avocado_formatter/cucumber.rb', line 6 def label(feature) feature.short_name end |
#progress(status) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/avocado_formatter/cucumber.rb', line 56 def progress(status) char = CHARS[status] @socket.puts(char); # @io.print(format_string(char, status)) # @io.flush end |