Commit 680a0a8e558eb8f9abb49f49458fd49ca7303c1b
1 parent
258ad139
Exists in
web_steps_improvements
and in
9 other branches
fix random failures in integration tests
Showing
5 changed files
with
16 additions
and
24 deletions
Show diff stats
test/integration/enable_disable_features_test.rb
... | ... | @@ -13,17 +13,15 @@ class EnableDisableFeaturesTest < ActionDispatch::IntegrationTest |
13 | 13 | assert_tag :tag => 'input', :attributes => { :name => 'environment[enabled_features][]', :value => 'feature2' } |
14 | 14 | assert_tag :tag => 'input', :attributes => { :name => 'environment[enabled_features][]', :value => 'feature3' } |
15 | 15 | |
16 | - post '/admin/features/update' | |
17 | - assert_response :redirect | |
16 | + post_via_redirect '/admin/features/update' | |
17 | + assert_response :success | |
18 | 18 | |
19 | - follow_redirect! | |
20 | 19 | assert_response :success |
21 | 20 | assert_equal '/admin/features', path |
22 | 21 | |
23 | - post '/admin/features/update', :environments => { :enabled_features => [ 'feature1' ], :organization_approval_method => 'region' } | |
24 | - assert_response :redirect | |
22 | + post_via_redirect '/admin/features/update', :environments => { :enabled_features => [ 'feature1' ], :organization_approval_method => 'region' } | |
23 | + assert_response :success | |
25 | 24 | |
26 | - follow_redirect! | |
27 | 25 | assert_equal '/admin/features', path |
28 | 26 | |
29 | 27 | end | ... | ... |
test/integration/enterprise_registration_test.rb
... | ... | @@ -61,10 +61,9 @@ class EnterpriseRegistrationTest < ActionDispatch::IntegrationTest |
61 | 61 | assert_response :success |
62 | 62 | assert_tag :form, :attributes => { :action => "/myprofile/myorg/enterprise_validation/approve/#{code}" } |
63 | 63 | |
64 | - post "/myprofile/myorg/enterprise_validation/approve/#{code}" | |
65 | - assert_response :redirect | |
64 | + post_via_redirect "/myprofile/myorg/enterprise_validation/approve/#{code}" | |
65 | + assert_response :success | |
66 | 66 | |
67 | - follow_redirect! | |
68 | 67 | assert_equal "/myprofile/myorg/enterprise_validation/view_processed/#{code}", path |
69 | 68 | assert_tag :span, :attributes => { :class => 'validation_approved' } |
70 | 69 | end | ... | ... |
test/integration/manage_documents_test.rb
... | ... | @@ -24,11 +24,10 @@ class ManageDocumentsTest < ActionDispatch::IntegrationTest |
24 | 24 | assert_tag :tag => 'form', :attributes => { :action => '/myprofile/myuser/cms/new', :method => /post/i } |
25 | 25 | |
26 | 26 | assert_difference 'Article.count' do |
27 | - post '/myprofile/myuser/cms/new', :type => 'TinyMceArticle', :article => { :name => 'my article', :body => 'this is the body of ther article'} | |
27 | + post_via_redirect '/myprofile/myuser/cms/new', :type => 'TinyMceArticle', :article => { :name => 'my article', :body => 'this is the body of ther article'} | |
28 | 28 | end |
29 | 29 | |
30 | - assert_response :redirect | |
31 | - follow_redirect! | |
30 | + assert_response :success | |
32 | 31 | a = Article.find_by_path('my-article') |
33 | 32 | assert_equal "/myuser/#{a.slug}", path |
34 | 33 | end |
... | ... | @@ -55,14 +54,13 @@ class ManageDocumentsTest < ActionDispatch::IntegrationTest |
55 | 54 | assert_tag :tag => 'form', :attributes => { :action => "/myprofile/myuser/cms/edit/#{article.id}", :method => /post/i } |
56 | 55 | |
57 | 56 | assert_no_difference 'Article.count' do |
58 | - post "/myprofile/myuser/cms/edit/#{article.id}", :article => { :name => 'my article', :body => 'this is the body of the article'} | |
57 | + post_via_redirect "/myprofile/myuser/cms/edit/#{article.id}", :article => { :name => 'my article', :body => 'this is the body of the article'} | |
59 | 58 | end |
60 | 59 | |
61 | 60 | article.reload |
62 | 61 | assert_equal 'this is the body of the article', article.body |
63 | 62 | |
64 | - assert_response :redirect | |
65 | - follow_redirect! | |
63 | + assert_response :success | |
66 | 64 | a = Article.find_by_path('my-article') |
67 | 65 | assert_equal "/myuser/#{a.slug}", path |
68 | 66 | end |
... | ... | @@ -84,10 +82,9 @@ class ManageDocumentsTest < ActionDispatch::IntegrationTest |
84 | 82 | assert_response :success |
85 | 83 | |
86 | 84 | assert_tag tag: 'a', attributes: { href: "/myprofile/myuser/cms/destroy/#{article.id}", 'data-confirm' => /Are you sure/ } |
87 | - post "/myprofile/myuser/cms/destroy/#{article.id}" | |
85 | + post_via_redirect "/myprofile/myuser/cms/destroy/#{article.id}" | |
88 | 86 | |
89 | - assert_response :redirect | |
90 | - follow_redirect! | |
87 | + assert_response :success | |
91 | 88 | assert_equal "/myuser", path |
92 | 89 | |
93 | 90 | # the article was actually deleted | ... | ... |
test/integration/manage_friendships_test.rb
... | ... | @@ -24,11 +24,10 @@ class ManageFriendshipsTest < ActionDispatch::IntegrationTest |
24 | 24 | get "/myprofile/#{@person.identifier}/friends/remove/#{@friend.id}" |
25 | 25 | assert_response :success |
26 | 26 | |
27 | - post "/myprofile/#{@person.identifier}/friends/remove/#{@friend.id}", | |
27 | + post_via_redirect "/myprofile/#{@person.identifier}/friends/remove/#{@friend.id}", | |
28 | 28 | :confirmation => '1' |
29 | - assert_response :redirect | |
29 | + assert_response :success | |
30 | 30 | |
31 | - follow_redirect! | |
32 | 31 | |
33 | 32 | assert assigns(:friends).empty? |
34 | 33 | refute @person.is_a_friend?(@friend) | ... | ... |
test/support/integration_test.rb
... | ... | @@ -14,9 +14,8 @@ class ActionDispatch::IntegrationTest |
14 | 14 | def login(username, password) |
15 | 15 | ActionDispatch::Integration::Session.any_instance.stubs(:https?).returns(true) |
16 | 16 | |
17 | - post '/account/login', :user => { :login => username, :password => password } | |
18 | - assert_response :redirect | |
19 | - follow_redirect! | |
17 | + post_via_redirect '/account/login', :user => { :login => username, :password => password } | |
18 | + assert_response :success | |
20 | 19 | assert_not_equal '/account/login', path |
21 | 20 | end |
22 | 21 | ... | ... |