Open begedin opened 8 years ago
Shoulda triggers an AssociationTypeMismatch when asserting for uniqueness on associations
https://github.com/thoughtbot/shoulda-matchers/issues/535
We currently have the following spec for ensuring uniqueness validation
it "validates uniqueness of volunteer scoped to campaign" do campaign_1 = create(:campaign) campaign_2 = create(:campaign) user = create(:user) create(:campaign_volunteer, volunteer: user, campaign: campaign_1) expect(build(:campaign_volunteer, volunteer: user, campaign: campaign_1)).not_to be_valid expect(build(:campaign_volunteer, volunteer: user, campaign: campaign_2)).to be_valid end
Once the Should issue is fixed, we can write it as
it { should validate_uniqueness_of(:volunteer).scoped_to(:campaign) }
Shoulda triggers an AssociationTypeMismatch when asserting for uniqueness on associations
https://github.com/thoughtbot/shoulda-matchers/issues/535
We currently have the following spec for ensuring uniqueness validation
Once the Should issue is fixed, we can write it as