On Tuesday, August 13, 2013 10:11:10 PM UTC-7, Myron Marston wrote:
>
> On Tuesday, August 13, 2013 11:00:00 AM UTC-7, Hongli Lai wrote:
>
>> I have tests that basically look like this:
>>
>> module Foo
>>   shared_examples_for "foo" do
>>     it "works" do
>>       true
>>     end
>>   end
>>
>>   describe "bar" do
>>     it_behaves_like "foo"
>>   end
>> end
>>
>> The reason why the RSpec commands are inside "module Foo" is because my 
>> namespace name is very long ("PhusionPassenger"), and I want to avoid 
>> prepending the namespace name to every class I refer to. Since a recent 
>> RSpec version, I'm getting a "Accessing shared_examples defined across 
>> contexts is deprecated" warning. How do I avoid this warning while still 
>> avoiding prepending my namespace before every class reference?
>>
>> I cannot just "include PhusionPassenger" in the global context. That will 
>> pollute the global namespace with all sorts of classes, potentially 
>> overwriting existing ones.
>>
>
> Hey Hongli,
>
> In RSpec 2.14 we added a feature that allows users to scope shared example 
> groups to the context they are declared in:
>
>
> http://myronmars.to/n/dev-blog/2013/07/rspec-2-14-is-released#core_shared_example_groups_are_scoped_to_the_context_they_are_defined_in
>
> For backwards compatibility with other 2.x releases, it still supports 
> using a shared example group from outside the scope if it cannot find it in 
> the current scope, and prints a deprecation warning in this case. 
>  Unfortunately, there was a slight bug in this that caused the warning to 
> be wrongly printed in your case.  This was reported a bit ago and we have a 
> fix ready:
>
> https://github.com/rspec/rspec-core/pull/1023
>
> I plan to cut another 2.14.x patch release soon (probably in the next day 
> or two) with this fix in it.  Sorry for the trouble.
>
> Myron
>

I just released rspec-core 2.14.5 with this fix. 

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/62c4e705-e946-4653-a201-e2dbdfb441d6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to