summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples
diff options
context:
space:
mode:
authorJarka Košanová <jarka@gitlab.com>2019-06-26 16:03:57 +0200
committerJarka Košanová <jarka@gitlab.com>2019-07-02 15:00:27 +0200
commitddbbf453c76144ac60c67e783424faf843c8efa1 (patch)
tree028cd360ebcae9582ac05a4b13ba2005621c534a /spec/support/shared_examples
parent0e8b76e1918a7ca441e9eb98819f10da24e0588a (diff)
downloadgitlab-ce-ddbbf453c76144ac60c67e783424faf843c8efa1.tar.gz
Use title and description fields for issue trackers63690-issue-trackers-title
- instead of using properties - backward compatibility has to be kept for now
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r--spec/support/shared_examples/models/services_fields_shared_examples.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/support/shared_examples/models/services_fields_shared_examples.rb b/spec/support/shared_examples/models/services_fields_shared_examples.rb
new file mode 100644
index 00000000000..6fbd0da9383
--- /dev/null
+++ b/spec/support/shared_examples/models/services_fields_shared_examples.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+shared_examples 'issue tracker fields' do
+ let(:title) { 'custom title' }
+ let(:description) { 'custom description' }
+ let(:url) { 'http://issue_tracker.example.com' }
+
+ context 'when data are stored in the properties' do
+ describe '#update' do
+ before do
+ service.update(title: 'new_title', description: 'new description')
+ end
+
+ it 'removes title and description from properties' do
+ expect(service.reload.properties).not_to include('title', 'description')
+ end
+
+ it 'stores title & description in services table' do
+ expect(service.read_attribute(:title)).to eq('new_title')
+ expect(service.read_attribute(:description)).to eq('new description')
+ end
+ end
+
+ describe 'reading fields' do
+ it 'returns correct values' do
+ expect(service.title).to eq(title)
+ expect(service.description).to eq(description)
+ end
+ end
+ end
+end