Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/label_spec.rb')
-rw-r--r--spec/models/label_spec.rb19
1 files changed, 14 insertions, 5 deletions
diff --git a/spec/models/label_spec.rb b/spec/models/label_spec.rb
index a13f9ac926c..6518213d71c 100644
--- a/spec/models/label_spec.rb
+++ b/spec/models/label_spec.rb
@@ -55,13 +55,22 @@ describe Label do
end
describe '#to_reference' do
- it 'returns a String reference to the object' do
- expect(label.to_reference).to eq "~#{label.id}"
- expect(label.to_reference(double)).to eq "~#{label.id}"
+ context 'using id' do
+ it 'returns a String reference to the object' do
+ expect(label.to_reference).to eq "~#{label.id}"
+ expect(label.to_reference(double('project'))).to eq "~#{label.id}"
+ end
end
- it 'returns a String reference to the object using its name' do
- expect(label.to_reference(:name)).to eq %(~"#{label.name}")
+ context 'using name' do
+ it 'returns a String reference to the object' do
+ expect(label.to_reference(:name)).to eq %(~"#{label.name}")
+ end
+
+ it 'uses id when name contains double quote' do
+ label = create(:label, name: %q{"irony"})
+ expect(label.to_reference(:name)).to eq "~#{label.id}"
+ end
end
end
end