ruby on rails - rspec testing a controller post changing my params from symbols to strings and breaking my tests -


In my controller device, I am doing this:

  make this a new message " "Client. Should_receive (: create) .with ({: title = & gt; 'Mr.'}) Post 'Create', Client = & gt; {: Title = & gt; "Mr."} end  

... and in my controller I am ...

  def client = client .create (params [client] ]  

Although this failed with the following error message:

  Expected: ({title = & gt; "Mr."}) found: ({"Title" = & gt; "Mr."})  

I am wondering why this is happening and how it works

That's because you are not going to a mark and it's not a string to fix it. Ran needs to:

  this should "create a new message" client. Should_receive (create) .with ({: title = & gt; 'Shree'}) 'create' post, client = & gt; {"Title" = & gt; "Mr."} End  

Here is a blog post: ""


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -