diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-09 15:08:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-09 15:08:03 +0300 |
commit | cddaddb86bf6d4d277d206c42a9138a2d660ea56 (patch) | |
tree | 92da110e04602b7ea62835e41327e552150279f5 /spec/lib/gitlab/patch | |
parent | 5afd8575506372dd64c238203bd05b4826f3ae2e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/patch')
-rw-r--r-- | spec/lib/gitlab/patch/action_dispatch_journey_formatter_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/gitlab/patch/action_dispatch_journey_formatter_spec.rb b/spec/lib/gitlab/patch/action_dispatch_journey_formatter_spec.rb new file mode 100644 index 00000000000..5f0e1f40231 --- /dev/null +++ b/spec/lib/gitlab/patch/action_dispatch_journey_formatter_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::Patch::ActionDispatchJourneyFormatter do + let(:group) { create(:group) } + let(:project) { create(:project, namespace: group) } + let(:pipeline) { create(:ci_empty_pipeline, project: project) } + let(:url) { Gitlab::Routing.url_helpers.project_pipeline_url(project, pipeline) } + let(:expected_path) { "#{project.full_path}/pipelines/#{pipeline.id}" } + + context 'custom implementation of #missing_keys' do + before do + expect_any_instance_of(Gitlab::Patch::ActionDispatchJourneyFormatter).to receive(:missing_keys) + end + + it 'generates correct url' do + expect(url).to end_with(expected_path) + end + end + + context 'original implementation of #missing_keys' do + before do + allow_any_instance_of(Gitlab::Patch::ActionDispatchJourneyFormatter).to receive(:missing_keys) do |instance, route, parts| + instance.send(:old_missing_keys, route, parts) # test the old implementation + end + end + + it 'generates correct url' do + expect(url).to end_with(expected_path) + end + end +end |