Commit 3a8dd51e639b6a1676ff04707927d1d6c9db251c
1 parent
25342dc3
Exists in
master
and in
23 other branches
ActionItem21: adding article removal test
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1018 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
29 additions
and
1 deletions
Show diff stats
test/integration/manage_documents_test.rb
| ... | ... | @@ -66,7 +66,35 @@ class ManageDocumentsTest < ActionController::IntegrationTest |
| 66 | 66 | end |
| 67 | 67 | |
| 68 | 68 | def test_removing_an_article |
| 69 | - flunk 'pending' | |
| 69 | + profile = create_user('myuser').person | |
| 70 | + article = profile.articles.build(:name => 'my-article') | |
| 71 | + article.save! | |
| 72 | + | |
| 73 | + login('myuser', 'myuser') | |
| 74 | + | |
| 75 | + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/myuser' } | |
| 76 | + get '/myprofile/myuser' | |
| 77 | + assert_response :success | |
| 78 | + | |
| 79 | + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/myuser/cms' } | |
| 80 | + get '/myprofile/myuser/cms' | |
| 81 | + assert_response :success | |
| 82 | + | |
| 83 | + assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/view/#{article.id}"} | |
| 84 | + get "/myprofile/myuser/cms/view/#{article.id}" | |
| 85 | + assert_response :success | |
| 86 | + | |
| 87 | + assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/destroy/#{article.id}", :onclick => /confirm/ } | |
| 88 | + post "/myprofile/myuser/cms/destroy/#{article.id}" | |
| 89 | + | |
| 90 | + assert_response :redirect | |
| 91 | + follow_redirect! | |
| 92 | + assert_equal "/myprofile/myuser/cms", path | |
| 93 | + | |
| 94 | + # the article was actually deleted | |
| 95 | + assert_raise ActiveRecord::RecordNotFound do | |
| 96 | + Article.find(article.id) | |
| 97 | + end | |
| 70 | 98 | end |
| 71 | 99 | |
| 72 | 100 | end | ... | ... |