diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-05-05 00:21:57 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-05-05 22:37:49 +0300 |
commit | d028863eda8b97f6e4db129ef57f0d3a2130c9b3 (patch) | |
tree | 010e2d279ef301b4fa301815c9878983ffb240cf /spec/models | |
parent | fad7b392dc633fb689e657af8b7fad346ede416e (diff) |
Sanitize milestones and label titles
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/label_spec.rb | 8 | ||||
-rw-r--r-- | spec/models/milestone_spec.rb | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/label_spec.rb b/spec/models/label_spec.rb index 0614ca1e7c9..b61c55a3f6d 100644 --- a/spec/models/label_spec.rb +++ b/spec/models/label_spec.rb @@ -55,6 +55,14 @@ describe Label, models: true do end end + describe "#title" do + let(:label) { create(:label, title: "<b>test</b>") } + + it "sanitizes title" do + expect(label.title).to eq("test") + end + end + describe '#to_reference' do context 'using id' do it 'returns a String reference to the object' do diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index 72a4ea70228..e2c89a4b3e6 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -34,6 +34,14 @@ describe Milestone, models: true do let(:issue) { create(:issue) } let(:user) { create(:user) } + describe "#title" do + let(:milestone) { create(:milestone, title: "<b>test</b>") } + + it "sanitizes title" do + expect(milestone.title).to eq("test") + end + end + describe "unique milestone title per project" do it "shouldn't accept the same title in a project twice" do new_milestone = Milestone.new(project: milestone.project, title: milestone.title) |