[rspec-users] Options Hash explanation ?

David Chelimsky dchelimsky at gmail.com
Wed May 27 04:38:25 EDT 2009


On Wed, May 13, 2009 at 3:36 PM, mortench <mortench at gmail.com> wrote:
> On 13 Maj, 07:28, David Chelimsky <dchelim... at gmail.com> wrote:
>> You can access the group and example options from within an example:
>>
>> describe "group options hash", :defined_in => :group do
>>   it "is available in examples via self.class.options" do
>>     self.class.options[:defined_in].should == :group
>>   end
>> end
>
> Yes, I got this to work too but not for nested describes as below:
>
> describe "group options hash", :defined_in => :group do
>   ..
>   describe "nested describe wont work"
>    it "is available in examples via self.class.options" do
>     self.class.options[:defined_in].should == :group # WONT work
>    end
>   end
>
> end
>
> BTW. I am actually accessing the hash from within a common helper
> files in a before action setup by Spec::Runner.configure. Hence it is
> important that accessing the Hash work regardless of how the describes
> are nested.

Just catching up on some old mail here - would you please add a
feature request for this? http://rspec.lighthouseapp.com


More information about the rspec-users mailing list