From 3a0b9e06e1dd5f6141a6f04dd2b39dbb803c07f1 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 24 Jul 2017 19:26:15 +0300 Subject: [PATCH] Adjust tests to work with latest shoulda gem Signed-off-by: Dmitriy Zaporozhets --- spec/models/list_spec.rb | 6 ------ spec/models/notification_setting_spec.rb | 4 +++- spec/models/user_spec.rb | 4 +++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb index db2c2619968..a6cc01bea5f 100644 --- a/spec/models/list_spec.rb +++ b/spec/models/list_spec.rb @@ -13,12 +13,6 @@ describe List do it { is_expected.to validate_presence_of(:position) } it { is_expected.to validate_numericality_of(:position).only_integer.is_greater_than_or_equal_to(0) } - it 'validates uniqueness of label scoped to board_id' do - create(:list) - - expect(subject).to validate_uniqueness_of(:label_id).scoped_to(:board_id) - end - context 'when list_type is set to closed' do subject { described_class.new(list_type: :closed) } diff --git a/spec/models/notification_setting_spec.rb b/spec/models/notification_setting_spec.rb index 74fa1c1f926..76a7b07949f 100644 --- a/spec/models/notification_setting_spec.rb +++ b/spec/models/notification_setting_spec.rb @@ -13,7 +13,9 @@ RSpec.describe NotificationSetting, type: :model do it { is_expected.to validate_presence_of(:level) } describe 'user_id' do - before { subject.user = create(:user) } + before do + subject.user = create(:user) + end it { is_expected.to validate_uniqueness_of(:user_id).scoped_to([:source_type, :source_id]).with_message(/already exists in source/) } end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index a1d6d7e6e0b..20bdb7e37da 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -114,7 +114,9 @@ describe User, models: true do end it 'validates uniqueness' do - expect(subject).to validate_uniqueness_of(:username).case_insensitive + user = build(:user) + + expect(user).to validate_uniqueness_of(:username).case_insensitive end end -- GitLab