cheers for the response , seem that attributes is missing from hash on my system <br><br>all i did was the blueprint with a standard hash<br><br>client = { :title =&gt; &quot;Mr }<br><br>client.attributes<br><br>NoMethodError: undefined method `attributes&#39; for {:title=&gt;&quot;Mr&quot;}:Hash<br>
<br>is attributes added on by rails ?<br><br>if so my setup must be wrong<br><br><div class="gmail_quote">On 2 February 2010 12:07, J. B. Rainsberger <span dir="ltr">&lt;<a href="mailto:jbrainsberger@gmail.com">jbrainsberger@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Tue, Feb 2, 2010 at 04:24, Stephen Smithstone &lt;<a href="mailto:ssmithstone@me.com">ssmithstone@me.com</a>&gt; wrote:<br>

<br>
&gt; A bit stuck here being new to ruby and rspec<br>
<br>
</div>Welcome. I hope you like the experience. Good news: we&#39;ve seen what<br>
you&#39;ve done a thousand times and so it&#39;s quite easy to explain.<br>
<div><div></div><div class="h5"><br>
&gt; it &quot;should create new client&quot; do<br>
&gt;     // creates me a hash of generated values using Foregey<br>
&gt;     client = Client.plan<br>
&gt;     // specify that I should be creating a new client with the hash values<br>
&gt; from client<br>
&gt;     Client.should_receive(:new).with(client)<br>
&gt;     //post to the server<br>
&gt;     post &#39;create&#39; , :client =&gt; client<br>
&gt; end<br>
&gt;<br>
&gt; in my controller<br>
&gt;<br>
&gt; def create<br>
&gt;     client = Client.new(params[:client])<br>
&gt; end<br>
&gt;<br>
&gt; now this is failing with<br>
&gt;<br>
&gt; Spec::Mocks::MockExpectationError: &lt;Client(id: integer, created_at:<br>
&gt; datetime, updated_at: datetime, title: string, lastname: string, firstname:<br>
&gt; string, email: string) (class)&gt; received :new with unexpected arguments<br>
&gt;   expected: ({:title=&gt;&quot;Mr&quot;, :firstname=&gt;&quot;Ernest&quot;, :lastname=&gt;&quot;Burke&quot;,<br>
&gt; :email=&gt;&quot;<a href="mailto:rgarrett@blogtag.info">rgarrett@blogtag.info</a>&quot;})<br>
&gt;        got: ({&quot;title&quot;=&gt;&quot;Mr&quot;, &quot;lastname&quot;=&gt;&quot;Burke&quot;, &quot;firstname&quot;=&gt;&quot;Ernest&quot;,<br>
&gt; &quot;email&quot;=&gt;&quot;<a href="mailto:rgarrett@blogtag.info">rgarrett@blogtag.info</a>&quot;})<br>
&gt;<br>
&gt; is there a way to specify to use symbols instead of the strings as keys, as<br>
&gt; I dont want to be doing<br>
&gt;<br>
&gt; :client =&gt; { &quot;title&quot; =&gt; client.title , ............ }<br>
&gt;<br>
&gt; as the client model may change over time<br>
<br>
</div></div>Try Client.should_receive(:new).with(client.attributes), because the<br>
#attributes method turns a model into a Hash of symbol to value. It<br>
uses string keys instead of symbol keys, but that shouldn&#39;t hurt you.<br>
<br>
Good luck.<br>
--<br>
J. B. (Joe) Rainsberger :: <a href="http://www.jbrains.ca" target="_blank">http://www.jbrains.ca</a> ::<br>
<a href="http://blog.thecodewhisperer.com" target="_blank">http://blog.thecodewhisperer.com</a><br>
Diaspar Software Services :: <a href="http://www.diasparsoftware.com" target="_blank">http://www.diasparsoftware.com</a><br>
Author, JUnit Recipes<br>
2005 Gordon Pask Award for contribution to Agile practice :: Agile<br>
2010: Learn. Practice. Explore.<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>
</blockquote></div><br>