Commit 136324658fc0e4f55b52323d4cb33e9ebde950f6
1 parent
9bfda843
Exists in
master
and in
22 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 | 29 | assert_response :redirect |
30 | 30 | follow_redirect! |
31 | 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 | 33 | end |
34 | 34 | |
35 | 35 | def test_update_of_an_existing_article |
36 | 36 | profile = create_user('myuser').person |
37 | - article = profile.articles.build(:name => 'my-article') | |
37 | + article = create_article(profile, :name => 'my-article') | |
38 | 38 | article.save! |
39 | 39 | |
40 | 40 | login('myuser', 'myuser') |
... | ... | @@ -46,10 +46,6 @@ class ManageDocumentsTest < ActionController::IntegrationTest |
46 | 46 | |
47 | 47 | get '/myprofile/myuser/cms' |
48 | 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 | 49 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/edit/#{article.id}"} |
54 | 50 | |
55 | 51 | get "/myprofile/myuser/cms/edit/#{article.id}" |
... | ... | @@ -66,12 +62,12 @@ class ManageDocumentsTest < ActionController::IntegrationTest |
66 | 62 | assert_response :redirect |
67 | 63 | follow_redirect! |
68 | 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 | 66 | end |
71 | 67 | |
72 | 68 | def test_removing_an_article |
73 | 69 | profile = create_user('myuser').person |
74 | - article = profile.articles.build(:name => 'my-article') | |
70 | + article = create_article(profile, :name => 'my-article') | |
75 | 71 | article.save! |
76 | 72 | |
77 | 73 | login('myuser', 'myuser') |
... | ... | @@ -84,10 +80,6 @@ class ManageDocumentsTest < ActionController::IntegrationTest |
84 | 80 | get '/myprofile/myuser/cms' |
85 | 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 | 83 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/myuser/cms/destroy/#{article.id}", :onclick => /confirm/ } |
92 | 84 | post "/myprofile/myuser/cms/destroy/#{article.id}" |
93 | 85 | |
... | ... | @@ -101,4 +93,13 @@ class ManageDocumentsTest < ActionController::IntegrationTest |
101 | 93 | end |
102 | 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 | 105 | end | ... | ... |