module Cucumber::RbSupport::RbWorld
def __cucumber_invoke(name, multiline_argument=nil) #:nodoc:
the same i18n as RbDsl.
Call a step from within a step definition. This method is aliased to
def __cucumber_invoke(name, multiline_argument=nil) #:nodoc: begin step_match = @__cucumber_step_mother.step_match(name) step_match.invoke(multiline_argument) rescue Exception => e e.nested! if Undefined === e raise e end end
def alias_adverb(adverb)
def alias_adverb(adverb) alias_method adverb, :__cucumber_invoke end
def announce(announcement)
step. This is because the step itself will not be printed until
Beware that the output will be printed *before* the corresponding
nicer, and in all outputs (in case you use several formatters)
This is an alternative to using Kernel#puts - it will display
Output +announcement+ alongside the formatted output.
def announce(announcement) @__cucumber_step_mother.announce(announcement) end
def inspect #:nodoc:
such errors in World we define it to just return a simple String.
or frameworks (Rails), so to avoid long waiting times on
A World object can have many references created by the user
object that raises a NoMethodError. (JRuby does not do this).
occur. For example, MRI internally invokes #inspect on an
This can cause unnecessary delays when certain exceptions
This can be time consuming if the object graph is large.
traverses all instance variables and invokes inspect.
The default implementation of Object#inspect recursively
def inspect #:nodoc: sprintf("#<%s:0x%x>", self.class, self.object_id) end
def pending(message = "TODO")
def pending(message = "TODO") if block_given? begin yield rescue Exception => e raise Pending.new(message) end raise Pending.new("Expected pending '#{message}' to fail. No Error was raised. No longer pending?") else raise Pending.new(message) end end
def table(text_or_table, file=nil, line_offset=0)
])
%w{ CUC-101 Peeler 22 }
%w{ INT-100 Taxi 114 },
%w{ account description amount },
table([
or a 2D Array:
})
| CUC-101 | Peeler | 22 |
| INT-100 | Taxi | 114 |
| account | description | amount |
table(%{
be a String:
Returns a Cucumber::Ast::Table for +text_or_table+, which can either
def table(text_or_table, file=nil, line_offset=0) if Array === text_or_table Ast::Table.new(text_or_table) else @table_parser ||= Parser::TableParser.new @table_parser.parse_or_fail(text_or_table.strip, file, line_offset) end end