Skip to content

Commit

Permalink
Update test to have consistent naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
gms-gs committed Nov 25, 2024
1 parent 2a94374 commit 3ac4175
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions spec/lib/user_notification_preferences_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

describe '#update' do
let(:accredited_provider_one) { create(:provider, :accredited_provider) }
let(:accredited_provider2) { create(:provider, :accredited_provider) }
let(:accredited_provider_two) { create(:provider, :accredited_provider) }

let(:user) { create(:user) }
let(:other_user) { create(:user) }
Expand All @@ -84,13 +84,13 @@
)
end

let(:user_notification2) do
let(:user_notification_two) do
create(
:user_notification,
user:,
course_publish: false,
course_update: false,
provider_code: accredited_provider2.provider_code
provider_code: accredited_provider_two.provider_code
)
end

Expand All @@ -106,7 +106,7 @@

context 'user has no notifications' do
before do
user.providers << [accredited_provider_one, accredited_provider2]
user.providers << [accredited_provider_one, accredited_provider_two]
end

it 'creates user notification preference for each accredited provider' do
Expand All @@ -117,7 +117,7 @@
expect(user_notifications.count).to eq(2)
expect(user_notifications.map(&:course_publish)).to eq([true, true])
expect(user_notifications.map(&:course_update)).to eq([true, true])
expect(user_notifications.map(&:provider_code)).to contain_exactly(accredited_provider_one.provider_code, accredited_provider2.provider_code)
expect(user_notifications.map(&:provider_code)).to contain_exactly(accredited_provider_one.provider_code, accredited_provider_two.provider_code)
end

context 'when the user has duplicate provider associations' do
Expand Down Expand Up @@ -147,9 +147,9 @@
before do
user
other_user
user.providers << [accredited_provider_one, accredited_provider2]
user.providers << [accredited_provider_one, accredited_provider_two]
user_notification_one
user_notification2
user_notification_two
other_users_notification
end

Expand All @@ -162,7 +162,7 @@
expect(user_notifications.map(&:course_publish)).to eq([true, true])
expect(user_notifications.map(&:course_update)).to eq([true, true])
expect(user_notifications.map(&:provider_code))
.to contain_exactly(accredited_provider_one.provider_code, accredited_provider2.provider_code)
.to contain_exactly(accredited_provider_one.provider_code, accredited_provider_two.provider_code)
end

it 'resets enabled after update' do
Expand Down Expand Up @@ -209,7 +209,7 @@
other_user
user.providers = [accredited_provider_one]
user_notification_one
user_notification2
user_notification_two
end

it 'removes the unassociated accredited provider UserNotification' do
Expand All @@ -223,14 +223,14 @@
end

context 'accredited provider added' do
let(:accredited_provider3) { create(:provider, :accredited_provider) }
let(:accredited_provider_three) { create(:provider, :accredited_provider) }

before do
user
other_user
user.providers << [accredited_provider_one, accredited_provider2, accredited_provider3]
user.providers << [accredited_provider_one, accredited_provider_two, accredited_provider_three]
user_notification_one
user_notification2
user_notification_two
end

it 'creates a UserNotification for the new accredited provider notification' do
Expand All @@ -241,8 +241,8 @@
expect(user_notifications.map(&:provider_code))
.to contain_exactly(
accredited_provider_one.provider_code,
accredited_provider2.provider_code,
accredited_provider3.provider_code
accredited_provider_two.provider_code,
accredited_provider_three.provider_code
)
end
end
Expand Down

0 comments on commit 3ac4175

Please sign in to comment.