The before block and the macro declaration get run in different
contexts.  In the before block, self is an instance of the example
group.  Your macro declaration runs with self set to the example group
itself.

It's the difference between an instance variable of a Class instance
(since Classes are objects, too), and an instance variable of an
instance of a class.

Myron

On Aug 5, 7:32 am, Gudleik Rasch <gudl...@gmail.com> wrote:
> Hi,
>
> I'm trying to create an rspec macro (for rspec2) but it cannot access
> variables defined in a before-block.
> Am I missing something or is it supposed to be like that?
>
> Here's a full example:http://gist.github.com/509802
>
> --
> gudleik
> _______________________________________________
> rspec-users mailing list
> rspec-us...@rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to