[ARVADOS] updated: 7a5a843993ad8502bfe1a290d0b0a5f3d9692bf3

git at public.curoverse.com git at public.curoverse.com
Fri Aug 8 21:47:57 EDT 2014


Summary of changes:
 .../workbench/app/controllers/application_controller.rb |  5 +++--
 apps/workbench/app/views/users/profile.html.erb         | 10 ++++------
 .../test/integration/application_layout_test.rb         | 17 ++++++++---------
 3 files changed, 15 insertions(+), 17 deletions(-)

       via  7a5a843993ad8502bfe1a290d0b0a5f3d9692bf3 (commit)
      from  e5e0835b2d374b88e686bf06be0607e10f616e34 (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 7a5a843993ad8502bfe1a290d0b0a5f3d9692bf3
Author: radhika <radhika at curoverse.com>
Date:   Fri Aug 8 21:47:25 2014 -0400

    3296: update tests

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 2113eba..cd74dff 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -529,8 +529,9 @@ class ApplicationController < ActionController::Base
     if current_user && profile_config
       missing_required_profile = false
 
-      user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs
-      user_prefs = current_user.prefs if !user_prefs[:profile]
+      user_prefs = current_user.prefs
+      current_user.reload if !user_prefs[:profile]
+      user_prefs = current_user.prefs
       current_user_profile = user_prefs[:profile] if user_prefs
 
       profile_config.kind_of?(Array) && profile_config.andand.each do |entry|
diff --git a/apps/workbench/app/views/users/profile.html.erb b/apps/workbench/app/views/users/profile.html.erb
index 620b3ee..193c8b5 100644
--- a/apps/workbench/app/views/users/profile.html.erb
+++ b/apps/workbench/app/views/users/profile.html.erb
@@ -1,8 +1,6 @@
 <%
     profile_config = Rails.configuration.user_profile_form_fields
-    this_user = User.limit(1).where(uuid: current_user.uuid).first
-    user_prefs = User.limit(1).where(uuid: current_user.uuid).first.prefs
-    current_user_profile = user_prefs[:profile] if user_prefs
+    current_user_profile = current_user.prefs[:profile]
     show_save_button = false
 %>
 
@@ -49,7 +47,7 @@
               <div class="form-group">
                   <label for="identity_url" class="col-sm-3 control-label"> Identity URL </label>
                   <div class="col-sm-9">
-                    <p class="form-control-static" id="identity_url" name="identity_url"><%=this_user.andand.identity_url%></p>
+                    <p class="form-control-static" id="identity_url" name="identity_url"><%=current_user.andand.identity_url%></p>
                   </div>
               </div>
 
@@ -68,7 +66,7 @@
                     </label>
                     <% if entry['type'] == 'select' %>
                       <div class="col-sm-9">
-                        <select class="form-control" id="user[prefs][:profile][:<%=entry['key']%>]" name="user[prefs][:profile][:<%=entry['key']%>]">
+                        <select class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]">
                           <% entry['options'].each do |option| %>
                             <option value="<%=option%>" <%='selected' if option==value%>><%=option%></option>
                           <% end %>
@@ -76,7 +74,7 @@
                       </div>
                     <% else %>
                       <div class="col-sm-9">
-                        <input type="text" class="form-control" id="user[prefs][:profile][:<%=entry['key']%>]" name="user[prefs][:profile][:<%=entry['key']%>]" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
+                        <input type="text" class="form-control" name="user[prefs][:profile][:<%=entry['key']%>]" placeholder="<%=entry['form_field_description']%>" value="<%=value%>" ></input>
                       </div>
                     <% end %>
                   </div>
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index f4a56a2..f4b9880 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -200,8 +200,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
     assert page.has_text? profile_message
     assert page.has_text? required_field_title
-
-    page.find_field(required_field_key).set 'value to fill required field'
+    page.find_field('user[prefs][:profile][:'+required_field_key+']').set 'value to fill required field'
 
     click_button "Save profile"
 
@@ -245,11 +244,11 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
   end
 
   [
-#    [nil, nil, false, false],
-#    ['inactive', api_fixture('users')['inactive'], true, false],
-#    ['inactive_uninvited', api_fixture('users')['inactive_uninvited'], false, false],
-#    ['active', api_fixture('users')['active'], true, true],
-#    ['admin', api_fixture('users')['admin'], true, true],
+    [nil, nil, false, false],
+    ['inactive', api_fixture('users')['inactive'], true, false],
+    ['inactive_uninvited', api_fixture('users')['inactive_uninvited'], false, false],
+    ['active', api_fixture('users')['active'], true, true],
+    ['admin', api_fixture('users')['admin'], true, true],
     ['active_no_prefs', api_fixture('users')['active_no_prefs'], true, false],
   ].each do |token, user, invited, has_profile|
       test "visit home page when profile is configured for user #{token}" do
@@ -263,7 +262,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       verify_homepage_with_profile user, invited, has_profile
     end
   end
-=begin
+
   [
     [nil, nil, false, false],
     ['inactive', api_fixture('users')['inactive'], true, false],
@@ -284,5 +283,5 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       verify_homepage_with_profile user, invited, has_profile
     end
   end
-=end
+
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list