<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Geneva">A bit stuck here being new to ruby and rspec<br>
<br>
Im trying to spec out a rails controller and using machinist to
generate a model<br>
<br>
so in my spec i have<br>
<br>
<br>
<br>
it "should create new client" do<br>
&nbsp;&nbsp;&nbsp; // creates me a hash of generated values using Foregey<br>
&nbsp;&nbsp;&nbsp; client = Client.plan<br>
&nbsp;&nbsp;&nbsp; // specify that I should be creating a new client with the hash
values from client<br>
&nbsp;&nbsp;&nbsp; Client.should_receive(:new).with(client) &nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; //post to the server<br>
&nbsp;&nbsp;&nbsp; post 'create' , :client =&gt; client<br>
end<br>
<br>
in my controller<br>
<br>
def create<br>
&nbsp;&nbsp;&nbsp; client = Client.new(params[:client])<br>
end<br>
<br>
now this is failing with<br>
&nbsp;<br>
Spec::Mocks::MockExpectationError: &lt;Client(id: integer, created_at:
datetime, updated_at: datetime, title: string, lastname: string,
firstname: string, email: string) (class)&gt; received :new with
unexpected arguments<br>
&nbsp; expected: ({:title=&gt;"Mr", :firstname=&gt;"Ernest",
:lastname=&gt;"Burke", :email=&gt;<a class="moz-txt-link-rfc2396E" href="mailto:rgarrett@blogtag.info">"rgarrett@blogtag.info"</a>})<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; got: ({"title"=&gt;"Mr", "lastname"=&gt;"Burke",
"firstname"=&gt;"Ernest", "email"=&gt;<a class="moz-txt-link-rfc2396E" href="mailto:rgarrett@blogtag.info">"rgarrett@blogtag.info"</a>})<br>
<br>
<br>
is there a way to specify to use symbols instead of the strings as
keys, as I dont want to be doing<br>
<br>
:client =&gt; { "title" =&gt; client.title , ............ }<br>
<br>
as the client model may change over time<br>
<br>
Cheers<br>
<br>
<br>
<br>
</font>
</body>
</html>