def test_create
num_articles = Article.count
post :create, :article => {}
assert_response :redirect
assert_redirected_to :action => ''list''
assert_equal num_articles + 1, Article.count
end
def test_edit
get :edit, :id => 1
assert_response :success
assert_template ''edit''
assert_not_nil assigns(:article)
assert assigns(:article).valid?
end
1) Failure:
test_create(ArticlesControllerTest) [test/functional/
articles_controller_test.rb:99]:
Expected response to be a redirect to <http://test.host/articles/list>
but was a redirect to <http://test.host/admin/login>.
2) Failure:
test_edit(ArticlesControllerTest) [test/functional/
articles_controller_test.rb:107]:
Expected response to be a <:success>, but was <302>
how do i solve these errors?
thank you
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 8, 12:38 am, sanjanad <d_sanja...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> > 1) Failure: > test_create(ArticlesControllerTest) [test/functional/ > articles_controller_test.rb:99]: > Expected response to be a redirect to <http://test.host/articles/list> > but was a redirect to <http://test.host/admin/login>. > > 2) Failure: > test_edit(ArticlesControllerTest) [test/functional/ > articles_controller_test.rb:107]: > Expected response to be a <:success>, but was <302> > > how do i solve these errors?Looks like your controller has a before_filter that checks if the user is logged in or not. Your tests aren''t setting up the user to be logged in so they get redirected to the loging page. You need to set the session up in such a way that they will appear logged in (as you were in some of the other threads you have created recently) Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.