Sha256: 55b56d271923fc53ab51a523f215d26ee34b577faacbc66d2f171c7a40fdbf85

Contents?: true

Size: 645 Bytes

Versions: 3

Compression:

Stored size: 645 Bytes

Contents

require "rails_helper"

module Clubhouse
  describe Invitation do
    it { should validate_presence_of(:organization) }
    it { should validate_presence_of(:email) }
    it { should_not allow_value("invalid@email").for(:email) }
    it "validates uniqueness of email/organization" do
      create(:clubhouse_invitation, :with_associations)
      should validate_uniqueness_of(:email).scoped_to(:organization_id)
    end

    it "normalizes emails before validating" do
      invitation = create(:clubhouse_invitation, :with_associations, email: "eM ai l@eXample.com")
      expect(invitation.email).to eq("email@example.com")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clubhouse-0.3.0 spec/models/clubhouse/invitation_spec.rb
clubhouse-0.2.0 spec/models/clubhouse/invitation_spec.rb
clubhouse-0.1.0 spec/models/clubhouse/invitation_spec.rb