<br><br><div class="gmail_quote">On Nov 22, 2007 8:22 AM, David Chelimsky <<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Nov 21, 2007 3:14 PM, Daniel N <<a href="mailto:has.sox@gmail.com">has.sox@gmail.com</a>> wrote:<br>> Hi,<br>><br>> I want to be able to get at the described class in my shared behaviour. I'm
<br>> sure an example will say it better than my words<br>><br>> describe "my shared", :shared => true do<br>><br>> it "should tell me what the class is its describing" do<br>> how_do_i_get_the_user_class_here
<br>> end<br>><br>> end<br>><br>> describe User do<br>> it_should_behave_like "my shared"<br>><br>> #...<br>> end<br>><br>> So in my shared behaviour, how do I get access to the User class?
<br><br></div></div>There's no way to do this implicitly. i.e. rspec does not expose the<br>class. You'd have to have a method like described_class or something:<br><div class="Ih2E3d"><br>describe "my shared", :shared => true do
<br><br> it "should tell me what the class is its describing" do<br></div> described_class.should do_something_I_care_about<br><div class="Ih2E3d"> end<br><br>end<br><br>describe User do<br></div> def described_class
<br> User<br> end<br> ...<br>end<br><div><div></div><div class="Wj3C7c"><br></div></div></blockquote><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div class="Wj3C7c"><br>K thanx David</div></div></blockquote></div><br>