We were using the following style of setting up a world:
World do
def a_helper
…
end
end
I don’t know where I came up with that. I now realise we should have
been returning a world class here, but the above style seems to be
supported. Is it?
Anyway, we got away with it so far. And it still works after upgrading
cucumber to 0.2+, but when an exception is raised from a step that is
called by another step, we don’t get a full backtrace through the step
definitions, but instead get this cryptic message:
undefined method `exception=’ for nil:NilClass (NoMethodError)
I suspect this solution is wrong because we weren’t doing the right
thing. Obviously we can just return a world class like the wiki
suggests. If returning nil from the World block is unsupported, maybe
it should be caught early?
That doesn’t really solve the problem. It shouldn’t be allowed to use
the
nil singleton as a World since lots of modules would get mixed into it
and
mess things up.
I suspect this solution is wrong because we weren’t doing the right
thing. Obviously we can just return a world class like the wiki
suggests. If returning nil from the World block is unsupported, maybe
it should be caught early?