12737: Fix controller tests
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Thu, 17 May 2018 17:47:37 +0000 (14:47 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Thu, 17 May 2018 17:47:37 +0000 (14:47 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

apps/workbench/test/controllers/application_controller_test.rb
apps/workbench/test/controllers/collections_controller_test.rb
apps/workbench/test/controllers/projects_controller_test.rb
apps/workbench/test/controllers/repositories_controller_test.rb
apps/workbench/test/controllers/users_controller_test.rb

index 0bcf7a19fba5a7b22de2e5100098da1b1d2c189b..45952ceba3ef46fa14378c8e3351fc79d7031df0 100644 (file)
@@ -381,7 +381,7 @@ class ApplicationControllerTest < ActionController::TestCase
       get(:show, {id: test_uuid})
       login_link = css_select(css_selector).first
       assert_not_nil(login_link, "failed to select login link")
-      login_href = URI.unescape(login_link.attributes["href"])
+      login_href = URI.unescape(login_link.attributes["href"].value)
       # The parameter needs to include the full URL to work.
       assert_includes(login_href, "://")
       assert_match(/[\?&]return_to=[^&]*\/projects\/#{test_uuid}(&|$)/,
index abe7f6af453f1c72070251ba90a889407469097a..4f3e098d5c57875a29667b7d88fcda805505c725 100644 (file)
@@ -409,7 +409,7 @@ class CollectionsControllerTest < ActionController::TestCase
     assert_equal true, files.length>0, "Expected one or more files in collection"
 
     disabled = css_select('[disabled="disabled"]').collect do |el|
-      el.attributes['title'].split[-1]
+      el.attributes['title'].value.split[-1]
     end
 
     assert_equal files.sort, disabled.sort, "Expected to see all collection files in disabled list of files"
index 61c882d9f9908ae83e22aaa6a220bfc28e8fb1f0..ada0e33e70ab5f41221389f39cce1e9e2fdf32b3 100644 (file)
@@ -32,7 +32,7 @@ class ProjectsControllerTest < ActionController::TestCase
         id: readonly_project_uuid
       }, session_for(which_user)
       buttons = css_select('[data-method=post]').select do |el|
-        el.attributes['data-remote-href'].match /project.*owner_uuid.*#{readonly_project_uuid}/
+        el.attributes['data-remote-href'].value.match /project.*owner_uuid.*#{readonly_project_uuid}/
       end
       if should_show
         assert_not_empty(buttons, "did not offer to create a subproject")
index 99e7285b3ba150eaa05d0ba0adc5809a744c832c..b81e2384c98db7975349e0ea4a4c387f95223a2a 100644 (file)
@@ -63,7 +63,7 @@ class RepositoriesControllerTest < ActionController::TestCase
       assert_response :success
 
       panes = css_select('[data-toggle=tab]').each do |pane|
-        pane_name = pane.attributes['href']
+        pane_name = pane.attributes['href'].value
         assert_includes expected_panes, pane_name
       end
     end
@@ -96,7 +96,7 @@ class RepositoriesControllerTest < ActionController::TestCase
         commit: sha1,
       }, session_for(user)
       assert_response :success
-      assert_select 'pre', h(commit)
+      assert_select 'pre', commit
     end
 
     test "show blob to #{user}" do
@@ -108,7 +108,7 @@ class RepositoriesControllerTest < ActionController::TestCase
         path: 'COPYING',
       }, session_for(user)
       assert_response :success
-      assert_select 'pre', h(filedata)
+      assert_select 'pre', filedata
     end
   end
 
index ce9282ff77d1e69450c864d8a09f70ec2d8637e7..50b35021c093f23facb414667e74b84890f311b0 100644 (file)
@@ -69,14 +69,14 @@ class UsersControllerTest < ActionController::TestCase
       if username == 'admin'
         assert_match /<a href="\/projects\/#{admin_user['uuid']}">Home<\/a>/, @response.body
         assert_match /<a href="\/projects\/#{active_user['uuid']}">Home<\/a>/, @response.body
-        assert_match /href="\/users\/#{admin_user['uuid']}" title="show user"><i class="fa fa-fw fa-user"><\/i> Show<\/a/, @response.body
-        assert_match /href="\/users\/#{active_user['uuid']}" title="show user"><i class="fa fa-fw fa-user"><\/i> Show<\/a/, @response.body
+        assert_match /href="\/users\/#{admin_user['uuid']}"><i class="fa fa-fw fa-user"><\/i> Show<\/a/, @response.body
+        assert_match /href="\/users\/#{active_user['uuid']}"><i class="fa fa-fw fa-user"><\/i> Show<\/a/, @response.body
         assert_includes @response.body, admin_user['email']
         assert_includes @response.body, active_user['email']
       else
         refute_match  /Home<\/a>/, @response.body
-        refute_match /href="\/users\/#{admin_user['uuid']}" title="show user"><i class="fa fa-fw fa-user"><\/i> Show<\/a/, @response.body
-        assert_match /href="\/users\/#{active_user['uuid']}" title="show user"><i class="fa fa-fw fa-user"><\/i> Show<\/a/, @response.body
+        refute_match /href="\/users\/#{admin_user['uuid']}"><i class="fa fa-fw fa-user"><\/i> Show<\/a/, @response.body
+        assert_match /href="\/users\/#{active_user['uuid']}"><i class="fa fa-fw fa-user"><\/i> Show<\/a/, @response.body
         assert_includes @response.body, active_user['email']
       end
     end