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:
authorRobert Speicher <rspeicher@gmail.com>2015-05-03 06:11:21 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-05-26 22:48:30 +0300
commitc0faf91ff23815404a95cf4510b43dcf5e331c4f (patch)
tree81769f125569dd6ea012920544ada1e8666ba4e5 /spec/models/external_issue_spec.rb
parentb06dc74d611192744d34acda944d7ed9e554342a (diff)
Add `to_reference` for models that support references
Now there is a single source of information for which attribute a model uses to be referenced, and its special character.
Diffstat (limited to 'spec/models/external_issue_spec.rb')
-rw-r--r--spec/models/external_issue_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/external_issue_spec.rb b/spec/models/external_issue_spec.rb
new file mode 100644
index 00000000000..7744610db78
--- /dev/null
+++ b/spec/models/external_issue_spec.rb
@@ -0,0 +1,24 @@
+require 'spec_helper'
+
+describe ExternalIssue do
+ let(:project) { double('project', to_reference: 'namespace1/project1') }
+ let(:issue) { described_class.new('EXT-1234', project) }
+
+ describe 'modules' do
+ subject { described_class }
+
+ it { is_expected.to include_module(Referable) }
+ end
+
+ describe '#to_reference' do
+ it 'returns a String reference to the object' do
+ expect(issue.to_reference).to eq issue.id
+ end
+ end
+
+ describe '#title' do
+ it 'returns a title' do
+ expect(issue.title).to eq "External Issue #{issue}"
+ end
+ end
+end