[ARVADOS] updated: a77dee1d10e7e852565370ff552632f718302fd6

git at public.curoverse.com git at public.curoverse.com
Sun Aug 24 16:05:31 EDT 2014


Summary of changes:
 .../app/controllers/user_agreements_controller.rb  |  6 +++++
 .../functional/user_agreements_controller_test.rb  | 12 +++++++++
 .../test/integration/user_agreements_test.rb       | 29 ++++++++++++++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 apps/workbench/test/integration/user_agreements_test.rb

       via  a77dee1d10e7e852565370ff552632f718302fd6 (commit)
      from  3c0133882412d8dca41ccd016eedb477d6df3430 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit a77dee1d10e7e852565370ff552632f718302fd6
Author: Tom Clegg <tom at curoverse.com>
Date:   Sun Aug 24 16:05:15 2014 -0400

    Fix user agreements page when no signatures needed. Add tests. No issue #

diff --git a/apps/workbench/app/controllers/user_agreements_controller.rb b/apps/workbench/app/controllers/user_agreements_controller.rb
index 924bf44..f8c316e 100644
--- a/apps/workbench/app/controllers/user_agreements_controller.rb
+++ b/apps/workbench/app/controllers/user_agreements_controller.rb
@@ -3,6 +3,12 @@ class UserAgreementsController < ApplicationController
   skip_before_filter :find_object_by_uuid
   skip_before_filter :check_user_profile
 
+  def index
+    if unsigned_user_agreements.empty?
+      redirect_to(params[:return_to] || :back)
+    end
+  end
+
   def model_class
     Collection
   end
diff --git a/apps/workbench/test/functional/user_agreements_controller_test.rb b/apps/workbench/test/functional/user_agreements_controller_test.rb
index 898ac63..5c75ac8 100644
--- a/apps/workbench/test/functional/user_agreements_controller_test.rb
+++ b/apps/workbench/test/functional/user_agreements_controller_test.rb
@@ -1,4 +1,16 @@
 require 'test_helper'
 
 class UserAgreementsControllerTest < ActionController::TestCase
+  test 'User agreements page shows form if some user agreements are not signed' do
+    get :index, {}, session_for(:inactive)
+    assert_response 200
+  end
+
+  test 'User agreements page redirects if all user agreements signed' do
+    get :index, {return_to: root_path}, session_for(:active)
+    assert_response :redirect
+    assert_equal(root_url,
+                 @response.redirect_url,
+                 "Active user was not redirected to :return_to param")
+  end
 end
diff --git a/apps/workbench/test/integration/user_agreements_test.rb b/apps/workbench/test/integration/user_agreements_test.rb
new file mode 100644
index 0000000..dd263a2
--- /dev/null
+++ b/apps/workbench/test/integration/user_agreements_test.rb
@@ -0,0 +1,29 @@
+require 'integration_helper'
+require 'selenium-webdriver'
+require 'headless'
+
+class UserAgreementsTest < ActionDispatch::IntegrationTest
+
+  setup do
+    Capybara.current_driver = Capybara.javascript_driver
+  end
+
+  def continuebutton_selector
+    'input[type=submit][disabled][value=Continue]'
+  end
+
+  test "cannot click continue without ticking checkbox" do
+    visit page_with_token('inactive')
+    assert_selector continuebutton_selector
+  end
+
+  test "continue button is enabled after ticking checkbox" do
+    visit page_with_token('inactive')
+    assert_selector continuebutton_selector
+    find('input[type=checkbox]').click
+    assert_no_selector continuebutton_selector
+    assert_nil(find_button('Continue')[:disabled],
+               'Continue button did not become enabled')
+  end
+
+end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list