Class: Cucumber::Core::Test::Mapping

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/core/test/mapping.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Mapping

Returns a new instance of Mapping.

Raises:

  • (ArgumentError)


10
11
12
13
14
# File 'lib/cucumber/core/test/mapping.rb', line 10

def initialize(&block)
  raise ArgumentError, "Passing a block to execute the mapping is mandatory." unless block
  @block = block
  @timer = Timer.new
end

Instance Method Details

#executeObject



20
21
22
23
24
25
26
27
28
# File 'lib/cucumber/core/test/mapping.rb', line 20

def execute
  @timer.start
  @block.call
  passed
rescue Result::Pending => exception
  pending(exception)
rescue Exception => exception
  failed(exception)
end

#skipObject



16
17
18
# File 'lib/cucumber/core/test/mapping.rb', line 16

def skip
  skipped
end