Still having trouble ='(
def create
@user = User.find(params[:user_id])
@ticket = @user.tickets.build(params[:ticket])
if @ticket.save
redirect_to tickets_path
else
render new_usr_ticket_path(params[:user_id])
end
end
describe TicketsController, "handling POST /tickets" do
before do
@ticket = mock_model(Ticket, :save => true)
@user = mock_model(User)
@user.stub!(:tickets).and_return(@user_tickets_association)
@params = {}
end
def do_post
post :create, :ticket => @params, :user_id => "user_id"
end
it "should find the user" do
User.should_receive(:find).with("user_id").and_return(@user)
do_post
end
8)
Spec::Mocks::MockExpectationError in 'TicketsController handling POST
/tickets should find the user'
Mock 'Class' expected :find with ("user_id") once, but received it 0 times
./spec/controllers/tickets_controller_spec.rb:19:
script/spec:4:
That really looks like it should pass.
On 8/17/07, Rupert Voelcker <[EMAIL PROTECTED]> wrote:
>
> > thats pretty much what I thought, I'll give it a push around and e-
> > mail back the results
>
> cool - good luck ...I'm off to bed as it's 1am here in the UK but I'm
> sure one of the useful chaps round here 'll help you out with any probs
>
> btw, I just noticed I've put @ticket_params = {} in the before
> declaration and it needs to be @params = {}
>
> Cheers
>
>
>
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users