I am testing my Ruby 2.6.x project with Cucumber 3.1.2.
Now I would like to include different helper modules into World, depending on the tags of the scenario, like this:
module NormalHelper
def do_something
"something"
end
end
module SpecialHelper
def do_something
"something different"
end
end
Before("~@special") do
World(NormalHelper)
end
Before("@special") do
World(SpecialHelper)
end
However, when I run cucumber
, I am told
undefined method `World' for #<Cucumber::Rails::World:0x…> (NoMethodError)
Outside of the Before
hook, calling World
works nicely.
What am I doing wrong?