On Jun 29, 12:16 pm, David Zhang <dzhan...@gmail.com> wrote:
> Thank you very much! So I guess it was a simple issue.
>
> But what would I do for the form_for @user_session? I tried...
>
> before(:each) do
> assign(:user_session, mock_model("UserSession").as_new_record)
> end
>
> But that returns the error:
>
> Failure/Error: assign(:user_session,
> mock_model("UserSession").as_new_record)
> ArgumentError:
> The mock_model method can only accept as its first argument:
> * A String representing a Class that does not exist
> * A String representing a Class that extends ActiveModel::Naming
> * A Class that extends ActiveModel::Naming
>
> It received UserSession
>
> Is this because I'm using Authlogic and the UserSession model
> extends Authlogic::Session::Base? How would I work around this?
Don't use mock_model :) You can use a standard test double:
assign(:user_session, double("UserSession"))
or a real UserSession object if it's not complicated to set up.
HTH,
David
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment