[rspec-users] Getting Class in Shared Behaviours

Nathan Sutton nathan.sutton at gmail.com
Thu Nov 22 20:45:58 EST 2007


Bah, I won't have time to do this anytime soon, you can feel free,  
Scott.

Nathan Sutton
fowlduck at gmail.com
rspec edge revision 2944
rspec_on_rails edge revision 2944
rails edge revision 8186



On Nov 21, 2007, at 10:25 PM, Scott Taylor wrote:

>
> On Nov 21, 2007, at 11:14 PM, Ben Mabey wrote:
>
>> I like what Scott suggested.
>>
>> it_should_behave_like "a foo", :with => { ... }
>>
>> Might read a little better.  But I like the idea of it just taking
>> a hash.
>>
>
> The obvious problem with this approach is that it will crowd the
> namespace (declaring methods in the shared example object might lead
> to some hard to track down bugs).
>
>
> The other suggestion, as proposed in IRC (for those who may not have
> been in the room).
>
> [11:06pm] smtlaissezfaire: So I was thinking of another way to do
> this - with the shared specs
> [11:06pm] fowlduck: elaborate
> [11:06pm] smtlaissezfaire: It could be block/lambda based
> [11:06pm] fowlduck: that's actually what I was going to suggest
> [11:06pm] smtlaissezfaire: So you might say it_should_behave_like
> "foo", var1, var2 and so on
> [11:07pm] fowlduck: *args, &proc
> [11:07pm] fowlduck: or something
> [11:07pm] smtlaissezfaire: and then describe "a shared
> example", :shared => true do |var1, var2|
>
> I'm interested in other's opinions (or other suggestions).
>
> Scott
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list