lawl, David has been out of the loop a few e-mails.<div>I left in an extra line.</div><div><br class="webkit-block-placeholder"></div><div>Thanks for the expansion Ben, adds much more clarity,<br><br><div class="gmail_quote">
On Jan 29, 2008 8:03 PM, David Chelimsky &lt;<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On Jan 29, 2008 6:55 PM, Andrew WC Brown &lt;<a href="mailto:omen.king@gmail.com">omen.king@gmail.com</a>&gt; wrote:<br>&gt; try it, does the same thing =&#39;(<br><br>Shouldn&#39;t be the exact same thing. What&#39;s the whole error?<br>
<br>Also - what version of rspec? If trunk, do you have the latest (3268)?<br><br>&gt;<br>&gt;<br>&gt;<br>&gt; On Jan 29, 2008 7:49 PM, Shane Mingins &lt;<a href="mailto:smingins@elctech.com">smingins@elctech.com</a>&gt; wrote:<br>
&gt; &gt;<br>&gt; &gt; Are you looking for something like this<br><div class="Ih2E3d">&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; lambda { @audience.stats = &#39;Market Goblin&#39; }.should raise_error<br>&gt; &gt;<br>&gt; &gt;<br>
&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br></div>&gt; &gt; On 30/01/2008, at 1:48 PM, Andrew WC Brown wrote:<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>
&gt; &gt; Trying to spec the following but don&#39;t know if I&#39;m using the right<br>&gt; matcher.<br>&gt; &gt; How do I spec? Plz, sugar on tops.<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; Audience.stats<br>&gt; &gt; - should have a stats of 80 when passed a flux of 10<br>
&gt; &gt; - should return an error when passed a string (ERROR - 1)<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; 1)<br>&gt; &gt; TypeError in &#39;Audience.stats should return an error when passed a string&#39;<br>&gt; &gt; String can&#39;t be coerced into Fixnum<br>
&gt; &gt; ./audience.rb:11:in `*&#39;<br>&gt; &gt; ./audience.rb:11:in `stats=&#39;<br>&gt; &gt; ./audience_spec.rb:29:<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; Finished in 0.006333 seconds<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; 2 examples, 1 failure<br>
&gt; &gt; monsterbox:spec andrew_wc_brown$<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; class Audience<br>&gt; &gt;<br>&gt; &gt; &nbsp; attr_accessor :stats<br>&gt; &gt;<br>&gt; &gt; &nbsp; def initialize(name = nil,value = nil)<br>
&gt; &gt; &nbsp; &nbsp; @name ||= &#39;all&#39;<br>&gt; &gt; &nbsp; &nbsp; @value ||= value<br>&gt; &gt; &nbsp; end<br>&gt; &gt;<br>&gt; &gt; &nbsp; def stats=(flux)<br>&gt; &gt; &nbsp; &nbsp; @stats = @value * flux / 0.025<br>&gt; &gt; &nbsp; end<br>&gt; &gt;<br>&gt; &gt;<br>
&gt; &gt; &nbsp; def market_share<br>&gt; &gt; &nbsp; &nbsp; &quot;The Market share is for #{@name} at a high of #{@stats}&quot;<br>&gt; &gt; &nbsp; end<br>&gt; &gt;<br>&gt; &gt; end<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; describe &quot;Audience.stats&quot; do<br>
&gt; &gt;<br>&gt; &gt; before :all do<br>&gt; &gt; &nbsp; @audience = Audience.new(nil,20)<br>&gt; &gt; end<br>&gt; &gt;<br>&gt; &gt; &nbsp; it &nbsp;&quot;should have a stats of 80 when passed a flux of 10&quot; do<br>&gt; &gt; &nbsp; &nbsp; @audience.stats = 10<br>
&gt; &gt; &nbsp; &nbsp; @audience.stats.should == 8000<br>&gt; &gt; &nbsp; end<br><div class="Ih2E3d">&gt; &gt;<br>&gt; &gt; &nbsp; it &quot;should return an error when passed a string&quot; do<br>&gt; &gt; &nbsp; &nbsp; @audience.stats = &#39;Market Goblin&#39;<br>
</div><div class="Ih2E3d">&gt; &gt; &nbsp; &nbsp; @audience.stats.should raise_error<br></div>&gt; &gt; &nbsp; end<br>&gt; &gt; end<br><div><div></div><div class="Wj3C7c">&gt; &gt; _______________________________________________<br>&gt; &gt; rspec-users mailing list<br>
&gt; &gt; <a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>&gt; &gt; <a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; _______________________________________________<br>&gt; &gt; rspec-users mailing list<br>&gt; &gt; <a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>
&gt; &gt; <a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>&gt; &gt;<br>&gt;<br>&gt;<br>&gt; _______________________________________________<br>
&gt; rspec-users mailing list<br>&gt; <a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>&gt; <a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
&gt;<br>_______________________________________________<br>rspec-users mailing list<br><a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
</div></div></blockquote></div><br></div>