From 136324658fc0e4f55b52323d4cb33e9ebde950f6 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Wed, 4 Jun 2008 17:04:55 +0000 Subject: [PATCH] ActionItem158: adapting related tests --- test/integration/manage_documents_test.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/test/integration/manage_documents_test.rb b/test/integration/manage_documents_test.rb index 3f2ed8a..77587dd 100644 --- a/test/integration/manage_documents_test.rb +++ b/test/integration/manage_documents_test.rb @@ -29,12 +29,12 @@ class ManageDocumentsTest < ActionController::IntegrationTest assert_response :redirect follow_redirect! a = Article.find_by_path('my-article') - assert_equal "/myprofile/myuser/cms/view/#{a.id}", path + assert_equal "/myprofile/myuser/cms", path end def test_update_of_an_existing_article profile = create_user('myuser').person - article = profile.articles.build(:name => 'my-article') + article = create_article(profile, :name => 'my-article') article.save! login('myuser', 'myuser') @@ -46,10 +46,6 @@ class ManageDocumentsTest < ActionController::IntegrationTest get '/myprofile/myuser/cms' assert_response :success - assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/view/#{article.id}"} - - get "/myprofile/myuser/cms/view/#{article.id}" - assert_response :success assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/edit/#{article.id}"} get "/myprofile/myuser/cms/edit/#{article.id}" @@ -66,12 +62,12 @@ class ManageDocumentsTest < ActionController::IntegrationTest assert_response :redirect follow_redirect! a = Article.find_by_path('my-article') - assert_equal "/myprofile/myuser/cms/view/#{a.id}", path + assert_equal "/myprofile/myuser/cms", path end def test_removing_an_article profile = create_user('myuser').person - article = profile.articles.build(:name => 'my-article') + article = create_article(profile, :name => 'my-article') article.save! login('myuser', 'myuser') @@ -84,10 +80,6 @@ class ManageDocumentsTest < ActionController::IntegrationTest get '/myprofile/myuser/cms' assert_response :success - assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/view/#{article.id}"} - get "/myprofile/myuser/cms/view/#{article.id}" - assert_response :success - assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/destroy/#{article.id}", :onclick => /confirm/ } post "/myprofile/myuser/cms/destroy/#{article.id}" @@ -101,4 +93,13 @@ class ManageDocumentsTest < ActionController::IntegrationTest end end + protected + + def create_article(profile, options) + a = TinyMceArticle.new(options) + a.profile = profile + a.save! + a + end + end -- libgit2 0.21.2