diff options
author | rpereira2 <rpereira@gitlab.com> | 2019-02-01 16:17:59 +0530 |
---|---|---|
committer | rpereira2 <rpereira@gitlab.com> | 2019-02-07 10:37:06 +0530 |
commit | 0bb9e3d550f4ce0b29a23cc0c377dde327fa7d2a (patch) | |
tree | 500cd8ff6277310ca1e41797c511601f0d9d0b16 | |
parent | 03aa8731d984b63a0c8e15699dba22b1175fd705 (diff) | |
download | gitlab-ce-0bb9e3d550f4ce0b29a23cc0c377dde327fa7d2a.tar.gz |
Refactor model and spec
- Move some specs into contexts
- Let get_slugs method take a parameter and return a specific slug.
- Add rescues when using Addressable::URI.
-rw-r--r-- | spec/models/error_tracking/project_error_tracking_setting_spec.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/spec/models/error_tracking/project_error_tracking_setting_spec.rb b/spec/models/error_tracking/project_error_tracking_setting_spec.rb index 85d0e30d748..4012a3819f4 100644 --- a/spec/models/error_tracking/project_error_tracking_setting_spec.rb +++ b/spec/models/error_tracking/project_error_tracking_setting_spec.rb @@ -229,11 +229,9 @@ describe ErrorTracking::ProjectErrorTrackingSetting do context 'names from api_url' do shared_examples_for 'name from api_url' do |name, titleized_slug| - let(:name_with_equals) { :"#{name}=" } - context 'name is present in DB' do it 'returns name from DB' do - subject.public_send(name_with_equals, 'Sentry name') + subject[name] = 'Sentry name' subject.api_url = 'http://gitlab.com/api/0/projects/org-slug/project-slug' expect(subject.public_send(name)).to eq('Sentry name') @@ -242,21 +240,21 @@ describe ErrorTracking::ProjectErrorTrackingSetting do context 'name is null in DB' do it 'titleizes and returns slug from api_url' do - subject.public_send(name_with_equals, nil) + subject[name] = nil subject.api_url = 'http://gitlab.com/api/0/projects/org-slug/project-slug' expect(subject.public_send(name)).to eq(titleized_slug) end it 'returns nil when api_url is incorrect' do - subject.public_send(name_with_equals, nil) + subject[name] = nil subject.api_url = 'http://gitlab.com/api/0/projects/' expect(subject.public_send(name)).to be_nil end it 'returns nil when api_url is blank' do - subject.public_send(name_with_equals, nil) + subject[name] = nil subject.api_url = nil expect(subject.public_send(name)).to be_nil |