Commit 92832855 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'mc/bug/trigger-project-subscriptions-frontend-form' into 'master'

Correct project subscriptions form action path

See merge request gitlab-org/gitlab!27678
parents f8625b8c ced9cc38
.row.prepend-top-default.append-bottom-default
.col-lg-12
= form_for project_subscriptions_path(@project), method: :post, authenticity_token: true do |f|
= form_with url: project_subscriptions_path(@project), id: 'pipeline-subscriptions-form', method: :post, authenticity_token: true do |f|
%fieldset
.form-group
= f.label :upstream_project_id do
= f.label :upstream_project_path do
= _("Project path")
= f.text_field :upstream_project_id, class: "form-control"
= f.text_field :upstream_project_path, class: "form-control"
= f.submit _('Subscribe'), class: "btn btn-success float-right"
.row.prepend-top-default.append-bottom-default
......
......@@ -2,5 +2,5 @@
%td
= project.name
%td
= user_avatar_without_link(user: project.user, size: 32)
= project.user.name
= user_avatar_without_link(user: project.owner, size: 32)
= project.owner.name
# frozen_string_literal: true
require 'spec_helper'
describe 'Project Subscriptions', :js do
let(:project) { create(:project, :public, :repository) }
let(:upstream_project) { create(:project, :public, :repository) }
let(:user) { create(:user) }
before do
project.add_maintainer(user)
upstream_project.add_maintainer(user)
stub_licensed_features(ci_project_subscriptions: true)
sign_in(user)
visit project_settings_ci_cd_path(project)
end
it 'renders the correct path for the form action' do
within '#pipeline-subscriptions' do
form_action = find('#pipeline-subscriptions-form')['action']
expect(form_action).to end_with("/#{project.full_path}/-/subscriptions")
end
end
it 'successfully creates new pipeline subscription' do
within '#pipeline-subscriptions' do
within 'form' do
fill_in 'upstream_project_path', with: upstream_project.full_path
click_on 'Subscribe'
end
expect(find('.badge-pill').text).to eq '1'
expect(page).to have_content(upstream_project.name)
expect(page).to have_content(upstream_project.owner.name)
end
expect(page).to have_content('Subscription successfully created.')
end
it 'shows flash warning when unsuccesful in creating a pipeline subscription' do
within '#pipeline-subscriptions' do
within 'form' do
fill_in 'upstream_project_path', with: 'wrong/path'
click_on 'Subscribe'
end
expect(find('.badge-pill').text).to eq '0'
expect(all('tbody tr').count).to eq(0)
end
expect(page).to have_content('This project path either does not exist or you do not have access.')
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment