MockExpectationError

no matter how I try to stub! it still showing this error

I have the following in my spec
Profile.stub!(:new).and_return(@profile = mock_model(Profile))

Then

(rdb:1) @profile.stub!(:user)
#<Spec::Mocks::MessageExpectation:0x9fa1c94 @at_most=nil, @sym=:user,
@expected_
from="D:/Songrit/rails_apps/ului_new/app/controllers/registrations_controller.r
b:199:in `transaction’", @exception_to_raise=nil,
@actual_received_count=0, @at

least=nil, @consecutive=false, @return_block=nil,
@order_group=#<Spec::Mocks::Or
derGroup:0xa1b060c @ordering=[],
@error_generator=#<Spec::Mocks::ErrorGenerator:
0xa1b0634 @opts={}, @target=#<Profile:0x50d841e @name=“Profile_1300”>,
@name=“Pr
ofile_1300”>>,
@args_expectation=#<Spec::Mocks::ArgumentExpectation:0x9fa0c04 @c
onstraints_block=nil,
@args=[#<Spec::Mocks::ArgumentConstraints::AnyArgsConstrai
nt:0x9fa0d1c>], @match_any_args=true>, @args_to_yield=[],
@method_block=nil, @sy
mbol_to_throw=nil, @expected_received_count=:any,
@error_generator=#<Spec::Mocks
::ErrorGenerator:0xa1b0634 @opts={}, @target=#<Profile:0x50d841e
@name=“Profile_
1300”>, @name=“Profile_1300”>>

(rdb:1) @profile.user = 3
Spec::Mocks::MockExpectationError Exception: Mock ‘Profile_1300’
received unexpe
cted message :user= with (3)


Try many variations of stub!, stub!..with, should_recieve, etc nothing
works
I’m using rspec and rspec-rails version 1.1.11

On Fri, Dec 5, 2008 at 9:18 PM, Song L. [email protected] wrote:

Profile.stub!(:new).and_return(@profile = mock_model(Profile))

(rdb:1) @profile.user = 3
Spec::Mocks::MockExpectationError Exception: Mock ‘Profile_1300’
received unexpected message :user= with (3)

You’re stubbing :user when you need to stub :user=

///ark

yes indeed, thanks