Commit 3a0b9e06 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Adjust tests to work with latest shoulda gem

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent cc577b89
...@@ -13,12 +13,6 @@ describe List do ...@@ -13,12 +13,6 @@ describe List do
it { is_expected.to validate_presence_of(:position) } 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 { 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 context 'when list_type is set to closed' do
subject { described_class.new(list_type: :closed) } subject { described_class.new(list_type: :closed) }
......
...@@ -13,7 +13,9 @@ RSpec.describe NotificationSetting, type: :model do ...@@ -13,7 +13,9 @@ RSpec.describe NotificationSetting, type: :model do
it { is_expected.to validate_presence_of(:level) } it { is_expected.to validate_presence_of(:level) }
describe 'user_id' do 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/) } it { is_expected.to validate_uniqueness_of(:user_id).scoped_to([:source_type, :source_id]).with_message(/already exists in source/) }
end end
......
...@@ -114,7 +114,9 @@ describe User, models: true do ...@@ -114,7 +114,9 @@ describe User, models: true do
end end
it 'validates uniqueness' do 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
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment