Ruby 2. I have an API realised as a module. It defines a class as simply as
class Foo
include API
end
but it's also used to extend another module via
module Bar
class << self
include API
end
end
I want to test the behaviour both of an instance of Foo (e.g., Foo.new.methname) but also the module functions (e.g., Bar.methname).
One of my Before hooks defines @exemplar as the default object against tests should be applied. So, the question: how can my Before hook tell whether it should use @exemplar = Bar or @exemplar = Foo.new ?
Alternatively, after playing with tags a bit, let me try a different approach. If a scenario is tagged with @a and @b, and I have Around('@a') and Around('@b') hooks, and cucumber is invoked with -t @a, both hooks get invoked. Is there a way the hook code can tell
- What the
Around('...')argument is (i.e., the value of the'...'), and - What tags are actually in the set being applied?
I.e., is there any way the Around('@b') hook can tell that it's for the @b tag expression, and that @b is not in the list of tags being applied?
Thanks!
Aucun commentaire:
Enregistrer un commentaire