From 0566aa51290d1847e3362fc2b3d997dede5129e5 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Fri, 4 Dec 2015 13:50:18 +0200 Subject: [PATCH] spinach fixes --- app/controllers/unsubscribes_controller.rb | 2 +- .../groups/group_members/index.html.haml | 13 +++++- features/steps/admin/email.rb | 44 ++++++++++--------- features/support/env.rb | 1 + 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/app/controllers/unsubscribes_controller.rb b/app/controllers/unsubscribes_controller.rb index 4da09e6fde..6af244c1ab 100644 --- a/app/controllers/unsubscribes_controller.rb +++ b/app/controllers/unsubscribes_controller.rb @@ -11,7 +11,7 @@ class UnsubscribesController < ApplicationController @user = get_user if @user @user.admin_unsubscribe! - Notify.send_unsubscribed_notification(@user).deliver_later + Notify.send_unsubscribed_notification(@user.id).deliver_later end redirect_to new_user_session_path, notice: 'You have been unsubscribed' end diff --git a/app/views/groups/group_members/index.html.haml b/app/views/groups/group_members/index.html.haml index 0075e629dd..fa54ab76da 100644 --- a/app/views/groups/group_members/index.html.haml +++ b/app/views/groups/group_members/index.html.haml @@ -3,6 +3,17 @@ - @blank_container = true .group-members-page + - if current_user && current_user.can?(:admin_group_member, @group) + .panel.panel-default + .panel-heading + Add new user to group + .panel-body + - if should_user_see_group_roles?(current_user, @group) + %p.light + Members of group have access to all group projects. + .new-group-member-holder + = render "new_group_member" + - if @group.ldap_synced? .bs-callout.bs-callout-info The members of this group are managed using LDAP and cannot be added, changed or removed here. @@ -21,7 +32,7 @@ data: { "confirm-danger-message" => clear_ldap_permission_cache_message, 'warning-message' => 'If you made manual permission tweaks for some group members they will be lost.' } - + .panel.panel-default .panel-heading %strong #{@group.name} diff --git a/features/steps/admin/email.rb b/features/steps/admin/email.rb index 4c9c70c798..c6ad957ccd 100644 --- a/features/steps/admin/email.rb +++ b/features/steps/admin/email.rb @@ -4,28 +4,30 @@ class Spinach::Features::AdminEmail < Spinach::FeatureSteps include SharedAdmin step 'I submit form with email notification info' do - ActionMailer::Base.deliveries = [] - @email_text = "Your project has been moved." - @selected_group = Group.last - # ensure there are ppl to be emailed - 2.times do - @selected_group.add_user(create(:user), Gitlab::Access::DEVELOPER) - end + perform_enqueued_jobs do + ActionMailer::Base.deliveries = [] + @email_text = "Your project has been moved." + @selected_group = Group.last + # ensure there are ppl to be emailed + 2.times do + @selected_group.add_user(create(:user), Gitlab::Access::DEVELOPER) + end - page.within('form#new-admin-email') do - fill_in :subject, with: 'my subject' - fill_in :body, with: @email_text + page.within('form#new-admin-email') do + fill_in :subject, with: 'my subject' + fill_in :body, with: @email_text - # Note: Unable to use select2 helper because - # the helper uses select2 method "val" to select the group from the dropdown - # and the method "val" requires "initSelection" to be used in the select2 call - select2_container = first("#s2id_recipients") - select2_container.find(".select2-choice").click - find(:xpath, "//body").find("input.select2-input").set(@selected_group.name) - page.execute_script(%|$("input.select2-input:visible").keyup();|) - find(:xpath, "//body").find(".group-name", text: @selected_group.name).click + # Note: Unable to use select2 helper because + # the helper uses select2 method "val" to select the group from the dropdown + # and the method "val" requires "initSelection" to be used in the select2 call + select2_container = first("#s2id_recipients") + select2_container.find(".select2-choice").click + find(:xpath, "//body").find("input.select2-input").set(@selected_group.name) + page.execute_script(%|$("input.select2-input:visible").keyup();|) + find(:xpath, "//body").find(".group-name", text: @selected_group.name).click - find('.btn-create').click + find('.btn-create').click + end end end @@ -46,7 +48,9 @@ class Spinach::Features::AdminEmail < Spinach::FeatureSteps end step 'I click unsubscribe' do - click_button 'Unsubscribe' + perform_enqueued_jobs do + click_button 'Unsubscribe' + end end step 'I get redirected to the sign in path' do diff --git a/features/support/env.rb b/features/support/env.rb index edd58451da..b5bfd1a4e2 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -25,6 +25,7 @@ WebMock.allow_net_connect! Spinach.hooks.before_run do include RSpec::Mocks::ExampleMethods + include ActiveJob::TestHelper RSpec::Mocks.setup TestEnv.init(mailer: false) TestLicense.init