Re: undefined method `post'' and ''assigns''

Yennie
2011-07-06T19:28:03Z

On Jul 6, 3:19 pm, Yennie
<joanne0...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> Hi,
>
> I have an error of undefined method.
> can anyone help me to solve it.
> I follow the tutorial to practicing testing controller of rails, and
> now i got stuck with the error.. plz help
>
> error:
> undefined method `post'' for
> #<Spec::Example::ExampleGroup::Subclass_1:0xb7754114>
> undefined method `assigns'' for
> #<Spec::Example::ExampleGroup::Subclass_1:0xb785d1b4>
>
> Test file
>
> describe "GET Index" do
>   def mock_product(stubs={})
>   @mock_user ||= mock_model(User, stubs).as_null_object
>   end
>
>   def setup
>     @user = User.new
>   end
>
>     it "assigns all users as @users" do
>     @user.stub(:all){[mock_user]}
>     post ''index''
I change it as get ''index''
it still gives me undefined method
>     assigns(:users).should eq([mock_user])
>     end
> end
>
> please give me some help ..
>
> thanks
> Yennie