Patch #34492

Fix passing a wrong parameter to assert_select in API test for 'GET /users/:id'

Added by Go MAEDA about 1 month ago. Updated 24 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Code cleanup/refactoring
Target version:4.2.0

Description

At source:tags/4.1.1/test/integration/api_test/users_test.rb#L121, assert_select there tests the element with User.find(1).status.to_s. However, it must be User.find(2).status.to_s because the preceding get request retrieves data for user 2.

  test "GET /users/:id should return status for administrators" do
    get '/users/2.xml', :headers => credentials('admin')
    assert_response :success
    assert_select 'user status', :text => User.find(1).status.to_s
  end

The following patch fixes this issue.

diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb
index d54701ad5..bd58a39f2 100644
--- a/test/integration/api_test/users_test.rb
+++ b/test/integration/api_test/users_test.rb
@@ -158,7 +158,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
   test "GET /users/:id should return status for administrators" do
     get '/users/2.xml', :headers => credentials('admin')
     assert_response :success
-    assert_select 'user status', :text => User.find(1).status.to_s
+    assert_select 'user status', :text => User.find(2).status.to_s
   end

   test "GET /users/:id should return admin status for current user" do

Associated revisions

Revision 20700
Added by Go MAEDA 24 days ago

Fix passing a wrong parameter to assert_select in API test for 'GET /users/:id' (#34492).

Patch by Go MAEDA.

History

#1 Updated by Go MAEDA 25 days ago

  • Target version changed from Candidate for next major release to 4.2.0

Setting the target version to 4.2.0.

#2 Updated by Go MAEDA 24 days ago

  • Subject changed from API test for /users/:id tests with an incorrect user to Fix passing a wrong parameter to assert_select in API test for 'GET /users/:id'
  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Also available in: Atom PDF