[rspec-users] Getting Class in Shared Behaviours

Daniel N has.sox at gmail.com
Wed Nov 21 16:18:49 EST 2007


yep

should == User
expected: User,
     got: #<Class:0x25d0ce4> (using ==)

On Nov 22, 2007 8:15 AM, Nathan Sutton <nathan.sutton at gmail.com> wrote:

> Did you try self.class
>
> ??
> Nathan Sutton
> fowlduck at gmail.com
> rspec edge revision 2910
> rspec_on_rails edge revision 2909
> rails edge revision 8175
>
>
>
> On Nov 21, 2007, at 3:14 PM, Daniel N wrote:
>
> > Hi,
> >
> > I want to be able to get at the described class in my shared
> > behaviour.  I'm sure an example will say it better than my words
> >
> > describe "my shared", :shared => true do
> >
> >   it "should tell me what the class is its describing" do
> >     how_do_i_get_the_user_class_here
> >  end
> >
> > end
> >
> > describe User do
> >   it_should_behave_like "my shared"
> >
> >   #...
> > end
> >
> > So in my shared behaviour, how do I get access to the User class?
> >
> > Cheers
> > Daniel
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071122/fbf63a2a/attachment.html 


More information about the rspec-users mailing list