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
please give me some help …
thanks
Yennie
it "assigns all users as @users" do
@user.stub(:all){[mock_user]}
assigns(:users).should eq([mock_user])
end
end