Sha256: e5f00fb9d8477ed5a3cb2069034bba6db299cc253a4a7babfd1ec827ab92fe2c

Contents?: true

Size: 705 Bytes

Versions: 7

Compression:

Stored size: 705 Bytes

Contents

def attach_or_embed(world, data, media_type)
  # Backward compatibility as the steps are also used by cucumber-ruby 3 which does not support `attach`
  world.respond_to?(:attach) ? attach(data, media_type) : embed(data, media_type)
end

Before do
  # no-op
end

Before(name: 'A named hook') do
  # no-op
end

When('a step passes') do
  # no-op
end

When('a step throws an exception') do
  raise StandardError, 'Exception in step'
end

After do
  raise StandardError, 'Exception in hook'
end

After('@some-tag or @some-other-tag') do
  raise StandardError, 'Exception in conditional hook'
end

After('@with-attachment') do
  attach_or_embed(self, File.open("#{__dir__}/cucumber.svg"), 'image/svg+xml')
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cucumber-compatibility-kit-12.0.0 features/hooks/hooks.feature.rb
cucumber-compatibility-kit-11.3.0 features/hooks/hooks.feature.rb
cucumber-compatibility-kit-11.2.0 features/hooks/hooks.feature.rb
cucumber-compatibility-kit-11.0.1 features/hooks/hooks.feature.rb
cucumber-compatibility-kit-11.0.0 features/hooks/hooks.feature.rb
cucumber-compatibility-kit-10.0.0 features/hooks/hooks.feature.rb
cucumber-compatibility-kit-9.2.1 features/hooks/hooks.feature.rb