<br><br><div class="gmail_quote">On Nov 22, 2007 8:22 AM, David Chelimsky &lt;<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>&gt; 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 &lt;<a href="mailto:has.sox@gmail.com">has.sox@gmail.com</a>&gt; wrote:<br>&gt; Hi,<br>&gt;<br>&gt; I want to be able to get at the described class in my shared behaviour. &nbsp;I&#39;m
<br>&gt; sure an example will say it better than my words<br>&gt;<br>&gt; describe &quot;my shared&quot;, :shared =&gt; true do<br>&gt;<br>&gt; &nbsp; it &quot;should tell me what the class is its describing&quot; do<br>&gt; &nbsp; &nbsp; how_do_i_get_the_user_class_here
<br>&gt; &nbsp;end<br>&gt;<br>&gt; end<br>&gt;<br>&gt; describe User do<br>&gt; &nbsp; it_should_behave_like &quot;my shared&quot;<br>&gt;<br>&gt; &nbsp; #...<br>&gt; end<br>&gt;<br>&gt; So in my shared behaviour, how do I get access to the User class?
<br><br></div></div>There&#39;s no way to do this implicitly. i.e. rspec does not expose the<br>class. You&#39;d have to have a method like described_class or something:<br><div class="Ih2E3d"><br>describe &quot;my shared&quot;, :shared =&gt; true do
<br><br> &nbsp;it &quot;should tell me what the class is its describing&quot; do<br></div> &nbsp; &nbsp;described_class.should do_something_I_care_about<br><div class="Ih2E3d">&nbsp;end<br><br>end<br><br>describe User do<br></div> &nbsp;def described_class
<br> &nbsp; &nbsp;User<br> &nbsp;end<br> &nbsp;...<br>end<br><div><div></div><div class="Wj3C7c"><br></div></div></blockquote><div>&nbsp;</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>