Hi,
I am facing a problem while trying to test a method that updates an
attribute. The attribute format should be converted to YAML format
before storing in the table which is excatly what is going on. But when
testing it using expectations in rspec it returns an error.
*** below is the error message :
Spec::Mocks::MockExpectationError in ‘InteractController (submit) -
saving a form to use later should update costumer details using the form
params’
Mock ‘Instance_1039’ expected :update_attributes with
({:customer_details=>"— !map:HashWithIndifferentAccess \ntitle:
Hola\n"}) but received it with ({:customer_details=>"—
!map:HashWithIndifferentAccess \ntitle: Hola\n"})
C:/webapps/interact/branches/interact_new_features/app/controllers/interact_controller.rb:74:in
`submit’
./spec/controllers/interact_controller_spec.rb:200:
script/spec:4:
*** here’s how i am testing it:
@instance.should_receive(:update_attributes).with(:customer_details=>
‘— map:HashWithIndifferentAccess \ntitle: Hola\n’)
post :submit, { :id => ‘7770’ , :perform => ‘Save this form’, :form => {
:title => ‘Hola’ } }
Any tips pls?