diff --git a/spec/unit/entitlements/data/groups/calculated/text_spec.rb b/spec/unit/entitlements/data/groups/calculated/text_spec.rb index 538fd09..d1f5913 100644 --- a/spec/unit/entitlements/data/groups/calculated/text_spec.rb +++ b/spec/unit/entitlements/data/groups/calculated/text_spec.rb @@ -60,6 +60,24 @@ subject.description end.to raise_error(RuntimeError, /description cannot use '!=' operator in .+not-equals-description.txt!/) end + + it "preserves semicolons in a free-form narrative description" do + filename = fixture("ldap-config/text/description-with-semicolon-narrative.txt") + subject = described_class.new(filename: filename) + expect(subject.description).to eq("This group manages auth; it also handles access control for the team") + end + + it "does not parse semicolons in description as predicates" do + filename = fixture("ldap-config/text/semicolons-in-description.txt") + subject = described_class.new(filename: filename) + expect(subject.description).to eq("the; description; can; have; semicolons") + end + + it "does not treat predicate-like text after semicolons in description as predicates" do + filename = fixture("ldap-config/text/description-with-predicate-like-semicolon.txt") + subject = described_class.new(filename: filename) + expect(subject.description).to eq("This group provides access to resources; expiration = 2099-12-31 is not a predicate here") + end end describe "#initialize_filters" do diff --git a/spec/unit/fixtures/ldap-config/text/description-with-predicate-like-semicolon.txt b/spec/unit/fixtures/ldap-config/text/description-with-predicate-like-semicolon.txt new file mode 100644 index 0000000..1267771 --- /dev/null +++ b/spec/unit/fixtures/ldap-config/text/description-with-predicate-like-semicolon.txt @@ -0,0 +1,2 @@ +description = This group provides access to resources; expiration = 2099-12-31 is not a predicate here +username = mainecoon diff --git a/spec/unit/fixtures/ldap-config/text/description-with-semicolon-narrative.txt b/spec/unit/fixtures/ldap-config/text/description-with-semicolon-narrative.txt new file mode 100644 index 0000000..31944c5 --- /dev/null +++ b/spec/unit/fixtures/ldap-config/text/description-with-semicolon-narrative.txt @@ -0,0 +1,2 @@ +description = This group manages auth; it also handles access control for the team +username = mainecoon