rspec testing a controller post changing my params from symbols to strings and breaking my tests
Posted
by ssmithstone
on Stack Overflow
See other posts from Stack Overflow
or by ssmithstone
Published on 2010-02-02T10:47:37Z
Indexed on
2010/05/01
4:07 UTC
Read the original article
Hit count: 594
rspec
|ruby-on-rails
In my controller spec I am doing this:
it "should create new message" do
Client.should_receive(:create).with({:title => 'Mr'})
post 'create' , :client => {:title => "Mr" }
end
... and in my controller I am doing ...
def create
client = Client.create(params[:client])
end
However this is failing with the following error message :
expected: ({:title=>"Mr"})
got: ({"title"=>"Mr"})
I'm wondering why this is happening and how to get it to work
© Stack Overflow or respective owner