* Use constant for type_of_user * Add comment for clarity * Remove legacy inline styles * Move comment above the render
13 lines
545 B
Ruby
13 lines
545 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe OrganizationMembership, type: :model do
|
|
describe "validations" do
|
|
subject { build(:organization_membership) }
|
|
|
|
it { is_expected.to validate_presence_of(:user_id) }
|
|
it { is_expected.to validate_presence_of(:organization_id) }
|
|
it { is_expected.to validate_presence_of(:type_of_user) }
|
|
it { is_expected.to validate_uniqueness_of(:user_id).scoped_to(:organization_id) }
|
|
it { is_expected.to validate_inclusion_of(:type_of_user).in_array(OrganizationMembership::USER_TYPES) }
|
|
end
|
|
end
|