4951: button_to cannot be used to submit; instead change to link_to
authorRadhika Chippada <radhika@curoverse.com>
Wed, 11 Feb 2015 23:40:23 +0000 (18:40 -0500)
committerRadhika Chippada <radhika@curoverse.com>
Wed, 11 Feb 2015 23:40:23 +0000 (18:40 -0500)
apps/workbench/app/views/users/_manage_virtual_machines.html.erb
apps/workbench/test/integration/user_manage_account_test.rb

index 1e7fb3b07e70f7815d702880d3a16f2ce9a6a0d2..df5c71a18fc74849d31380575ef2def01706b420 100644 (file)
         You may request access to a hosted virtual machine with the command line shell.
         &nbsp;&nbsp;&nbsp;
         <div style='display:inline-block'>
-          <%= button_to('Send request for shell access', request_shell_access_user_url(id: current_user.uuid),
-                         id: 'request_shell_submit', class: 'btn btn-xs btn-primary', remote: true) %>
+          <%= link_to({action: 'request_shell_access', controller: 'users', id: current_user.uuid},
+                       method: :post, remote: true, class: 'btn btn-xs btn-primary',
+                       id: 'request_shell_submit', data: {disable_with: "Sending request..."}) do %>
+              Send request for shell access
+          <% end %>
         </div>
       </div><br/>
       <div class='shell_access_requested alert alert-info'>
index a84d424d3ec730940f8fedb5c8c757da347561ae..ea4154350f87da7969e695b2743790804b4dc77d 100644 (file)
@@ -137,9 +137,10 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
   test "request shell access" do
     visit page_with_token('spectator', '/manage_account')
     assert_text 'You do not have access to any virtual machines'
-    click_button 'Send request for shell access'
+    click_link 'Send request for shell access'
     assert_text 'A request for shell access was sent.'
     assert_no_text 'You do not have access to any virtual machines.'
+    assert_no_selector 'a', text: 'Send request for shell access'
 
     # revisit the page and verify that the Request button is no longer shown
     within('.navbar-fixed-top') do
@@ -150,5 +151,6 @@ class UserManageAccountTest < ActionDispatch::IntegrationTest
     end
     assert_text 'You do not have access to any virtual machines.'
     assert_text 'A request for shell access was sent on '
+    assert_selector 'a', text: 'Send request for shell access'
   end
 end