Skip to content

Commit a566210

Browse files
authored
Merge pull request #6407 from nizam12khan/feature/6404-add-trim-name-spec
Add spec for trim_name method in CustomOrgLink model
2 parents 27afdcf + 1e35b0f commit a566210

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

spec/models/custom_org_link_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77
it { is_expected.to validate_length_of(:text).is_at_most described_class::TEXT_MAX_LENGTH }
88
it { is_expected.to validate_inclusion_of(:active).in_array [true, false] }
99

10+
describe "#trim_name" do
11+
let(:casa_org) { create(:casa_org) }
12+
13+
context "when text is present" do
14+
it "trims leading and trailing whitespace from text" do
15+
custom_link = build(:custom_org_link, casa_org: casa_org, text: " Example Text ")
16+
custom_link.save
17+
expect(custom_link.text).to eq("Example Text")
18+
end
19+
end
20+
end
21+
1022
describe "url validation - only allow http or https schemes" do
1123
it { is_expected.to allow_value("http://example.com").for(:url) }
1224
it { is_expected.to allow_value("https://example.com").for(:url) }

0 commit comments

Comments
 (0)