Commit 136324658fc0e4f55b52323d4cb33e9ebde950f6
1 parent
9bfda843
Exists in
master
and in
28 other branches
ActionItem158: adapting related tests
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1860 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
13 additions
and
12 deletions
Show diff stats
test/integration/manage_documents_test.rb
| @@ -29,12 +29,12 @@ class ManageDocumentsTest < ActionController::IntegrationTest | @@ -29,12 +29,12 @@ class ManageDocumentsTest < ActionController::IntegrationTest | ||
| 29 | assert_response :redirect | 29 | assert_response :redirect |
| 30 | follow_redirect! | 30 | follow_redirect! |
| 31 | a = Article.find_by_path('my-article') | 31 | a = Article.find_by_path('my-article') |
| 32 | - assert_equal "/myprofile/myuser/cms/view/#{a.id}", path | 32 | + assert_equal "/myprofile/myuser/cms", path |
| 33 | end | 33 | end |
| 34 | 34 | ||
| 35 | def test_update_of_an_existing_article | 35 | def test_update_of_an_existing_article |
| 36 | profile = create_user('myuser').person | 36 | profile = create_user('myuser').person |
| 37 | - article = profile.articles.build(:name => 'my-article') | 37 | + article = create_article(profile, :name => 'my-article') |
| 38 | article.save! | 38 | article.save! |
| 39 | 39 | ||
| 40 | login('myuser', 'myuser') | 40 | login('myuser', 'myuser') |
| @@ -46,10 +46,6 @@ class ManageDocumentsTest < ActionController::IntegrationTest | @@ -46,10 +46,6 @@ class ManageDocumentsTest < ActionController::IntegrationTest | ||
| 46 | 46 | ||
| 47 | get '/myprofile/myuser/cms' | 47 | get '/myprofile/myuser/cms' |
| 48 | assert_response :success | 48 | assert_response :success |
| 49 | - assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/view/#{article.id}"} | ||
| 50 | - | ||
| 51 | - get "/myprofile/myuser/cms/view/#{article.id}" | ||
| 52 | - assert_response :success | ||
| 53 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/edit/#{article.id}"} | 49 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/edit/#{article.id}"} |
| 54 | 50 | ||
| 55 | get "/myprofile/myuser/cms/edit/#{article.id}" | 51 | get "/myprofile/myuser/cms/edit/#{article.id}" |
| @@ -66,12 +62,12 @@ class ManageDocumentsTest < ActionController::IntegrationTest | @@ -66,12 +62,12 @@ class ManageDocumentsTest < ActionController::IntegrationTest | ||
| 66 | assert_response :redirect | 62 | assert_response :redirect |
| 67 | follow_redirect! | 63 | follow_redirect! |
| 68 | a = Article.find_by_path('my-article') | 64 | a = Article.find_by_path('my-article') |
| 69 | - assert_equal "/myprofile/myuser/cms/view/#{a.id}", path | 65 | + assert_equal "/myprofile/myuser/cms", path |
| 70 | end | 66 | end |
| 71 | 67 | ||
| 72 | def test_removing_an_article | 68 | def test_removing_an_article |
| 73 | profile = create_user('myuser').person | 69 | profile = create_user('myuser').person |
| 74 | - article = profile.articles.build(:name => 'my-article') | 70 | + article = create_article(profile, :name => 'my-article') |
| 75 | article.save! | 71 | article.save! |
| 76 | 72 | ||
| 77 | login('myuser', 'myuser') | 73 | login('myuser', 'myuser') |
| @@ -84,10 +80,6 @@ class ManageDocumentsTest < ActionController::IntegrationTest | @@ -84,10 +80,6 @@ class ManageDocumentsTest < ActionController::IntegrationTest | ||
| 84 | get '/myprofile/myuser/cms' | 80 | get '/myprofile/myuser/cms' |
| 85 | assert_response :success | 81 | assert_response :success |
| 86 | 82 | ||
| 87 | - assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/view/#{article.id}"} | ||
| 88 | - get "/myprofile/myuser/cms/view/#{article.id}" | ||
| 89 | - assert_response :success | ||
| 90 | - | ||
| 91 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/destroy/#{article.id}", :onclick => /confirm/ } | 83 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/destroy/#{article.id}", :onclick => /confirm/ } |
| 92 | post "/myprofile/myuser/cms/destroy/#{article.id}" | 84 | post "/myprofile/myuser/cms/destroy/#{article.id}" |
| 93 | 85 | ||
| @@ -101,4 +93,13 @@ class ManageDocumentsTest < ActionController::IntegrationTest | @@ -101,4 +93,13 @@ class ManageDocumentsTest < ActionController::IntegrationTest | ||
| 101 | end | 93 | end |
| 102 | end | 94 | end |
| 103 | 95 | ||
| 96 | + protected | ||
| 97 | + | ||
| 98 | + def create_article(profile, options) | ||
| 99 | + a = TinyMceArticle.new(options) | ||
| 100 | + a.profile = profile | ||
| 101 | + a.save! | ||
| 102 | + a | ||
| 103 | + end | ||
| 104 | + | ||
| 104 | end | 105 | end |