Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion spec/models/custom_org_link_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
it { is_expected.to validate_presence_of :text }
it { is_expected.to validate_presence_of :url }
it { is_expected.to validate_length_of(:text).is_at_most described_class::TEXT_MAX_LENGTH }
it { is_expected.to validate_inclusion_of(:active).in_array [true, false] }

describe "#trim_name" do
let(:casa_org) { create(:casa_org) }
Expand All @@ -27,4 +26,14 @@
it { is_expected.not_to allow_value("example.com").for(:url) }
it { is_expected.not_to allow_value("some arbitrary string").for(:url) }
end

describe "#active" do
it "only allows true or false" do
casa_org = build(:casa_org)

expect(build(:custom_org_link, casa_org: casa_org, active: false)).to be_valid
expect(build(:custom_org_link, casa_org: casa_org, active: true)).to be_valid
expect(build(:custom_org_link, casa_org: casa_org, active: nil)).to be_invalid
end
end
end
Loading