diff --git a/spec/factories/courses.rb b/spec/factories/courses.rb index 32ad472441..60ceba9bad 100644 --- a/spec/factories/courses.rb +++ b/spec/factories/courses.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :course do transient do - prefix { "Course " } + prefix { 'Course ' } end sequence(:title) do |n| timestamp = Time.zone.now.to_i.to_s diff --git a/spec/factories/instance_users.rb b/spec/factories/instance_users.rb index 48c690e716..177ce7d2f3 100644 --- a/spec/factories/instance_users.rb +++ b/spec/factories/instance_users.rb @@ -8,11 +8,11 @@ role { :normal } after(:build) do |instance_user, evaluator| - if evaluator.user_name - instance_user.user ||= build(:user, name: evaluator.user_name, instance_users: [instance_user]) - else - instance_user.user ||= build(:user, instance_users: [instance_user]) - end + instance_user.user ||= if evaluator.user_name + build(:user, name: evaluator.user_name, instance_users: [instance_user]) + else + instance_user.user ||= build(:user, instance_users: [instance_user]) + end end trait :instructor do diff --git a/spec/features/system/admin/instance/user_management_spec.rb b/spec/features/system/admin/instance/user_management_spec.rb index f91247d69c..1c489f06a9 100644 --- a/spec/features/system/admin/instance/user_management_spec.rb +++ b/spec/features/system/admin/instance/user_management_spec.rb @@ -8,7 +8,7 @@ let(:instance_admin) { create(:instance_user, role: :administrator).user } let!(:prefix) { "admtest-#{rand(36**12).to_s(36)}-usr-" } let!(:instance_users) do - (1..2).collect do |i| + (1..2).map do |i| create(:instance_user, user_name: "#{prefix}#{i}") end end diff --git a/spec/support/authentication_performers.rb b/spec/support/authentication_performers.rb index 8681453390..a853739f1e 100644 --- a/spec/support/authentication_performers.rb +++ b/spec/support/authentication_performers.rb @@ -16,16 +16,15 @@ def login_as(user, _ = {}) fill_in 'Password', with: password_for(user) click_button 'Sign In' - # We expect all pages should have a user menu button. + # We expect all authenticated pages should have a user menu button. expect(page).to have_css('div[data-testid="user-menu-button"]') end def logout(*_) find('div[data-testid="user-menu-button"]').click find('li', text: 'Sign out').click - click_button 'Logout' - - wait_for_page + click_button('Logout', wait: 10) + expect(page).to_not have_css('div[data-testid="user-menu-button"]') end private