[rspec-users] Dealing with nested/namespaced classes w/ describe
Scott Taylor
mailing_lists at railsnewbie.com
Tue Jul 24 00:12:36 EDT 2007
Ah. Thank you. That is just a wonderful solution. Much better than
the solution of redefining a new constant.
Best,
Scott
On Jul 23, 2007, at 10:15 PM, Kyle Hargraves wrote:
> Scott Taylor wrote:
>> Hi all,
>>
>> Just wondering about this: I've been dealing with classes/modules
>> nested in several layers of namespaces. Here would be an example of
>> a describe block:
>>
>> describe ClassOne::ClassTwo::ClassThree, "description here" do
>> ...
>> end
>>
>> What would be the easiest way to write something a little more terse,
>> like:
>>
>> describe ClassThree, "description here" do
>> ...
>> end
>>
>> If this has come up before, just tell me to google.
>>
>> Thanks for your time,
>>
>> Scott Taylor
>
> You can put the descriptions inside of modules. AFAICT, this has no
> effect on how anything functions, it just lets you drop the
> namespacing
> ugliness from your code:
>
> module SomeProject
> class SomeClass
> end
> end
>
> module SomeProject
>
> describe SomeClass, "something or other" do
> end
>
> end
>
> Kyle
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
More information about the rspec-users
mailing list