diff options
-rw-r--r-- | spec/models/notification_setting_spec.rb | 7 | ||||
-rw-r--r-- | spec/models/pages_domain_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/redirect_route_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/route_spec.rb | 2 |
4 files changed, 9 insertions, 4 deletions
diff --git a/spec/models/notification_setting_spec.rb b/spec/models/notification_setting_spec.rb index cc235ad467e..74fa1c1f926 100644 --- a/spec/models/notification_setting_spec.rb +++ b/spec/models/notification_setting_spec.rb @@ -11,7 +11,12 @@ RSpec.describe NotificationSetting, type: :model do it { is_expected.to validate_presence_of(:user) } it { is_expected.to validate_presence_of(:level) } - it { is_expected.to validate_uniqueness_of(:user_id).scoped_to([:source_id, :source_type]).with_message(/already exists in source/) } + + describe 'user_id' do + before { subject.user = create(:user) } + + it { is_expected.to validate_uniqueness_of(:user_id).scoped_to([:source_type, :source_id]).with_message(/already exists in source/) } + end context "events" do let(:user) { create(:user) } diff --git a/spec/models/pages_domain_spec.rb b/spec/models/pages_domain_spec.rb index f9d060d4e0e..d4a777a9bd9 100644 --- a/spec/models/pages_domain_spec.rb +++ b/spec/models/pages_domain_spec.rb @@ -11,7 +11,7 @@ describe PagesDomain, models: true do context 'is unique' do let(:domain) { 'my.domain.com' } - it { is_expected.to validate_uniqueness_of(:domain) } + it { is_expected.to validate_uniqueness_of(:domain).case_insensitive } end { diff --git a/spec/models/redirect_route_spec.rb b/spec/models/redirect_route_spec.rb index 71827421dd7..a97af28cb8e 100644 --- a/spec/models/redirect_route_spec.rb +++ b/spec/models/redirect_route_spec.rb @@ -11,7 +11,7 @@ describe RedirectRoute, models: true do describe 'validations' do it { is_expected.to validate_presence_of(:source) } it { is_expected.to validate_presence_of(:path) } - it { is_expected.to validate_uniqueness_of(:path) } + it { is_expected.to validate_uniqueness_of(:path).case_insensitive } end describe '.matching_path_and_descendants' do diff --git a/spec/models/route_spec.rb b/spec/models/route_spec.rb index 1754253e0f2..12f7611fb28 100644 --- a/spec/models/route_spec.rb +++ b/spec/models/route_spec.rb @@ -15,7 +15,7 @@ describe Route, models: true do it { is_expected.to validate_presence_of(:source) } it { is_expected.to validate_presence_of(:path) } - it { is_expected.to validate_uniqueness_of(:path) } + it { is_expected.to validate_uniqueness_of(:path).case_insensitive } end describe 'callbacks' do |