2016-02-22 03:20:04 -05:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
feature 'Start new branch from an issue', feature: true do
|
|
|
|
let!(:project) { create(:project) }
|
|
|
|
let!(:issue) { create(:issue, project: project) }
|
|
|
|
let!(:user) { create(:user)}
|
|
|
|
|
|
|
|
context "for team members" do
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
login_as(user)
|
|
|
|
end
|
|
|
|
|
2016-04-21 10:34:00 -04:00
|
|
|
it 'shows the new branch button', js: true do
|
2016-02-22 03:20:04 -05:00
|
|
|
visit namespace_project_issue_path(project.namespace, project, issue)
|
|
|
|
|
2016-04-21 10:34:00 -04:00
|
|
|
expect(page).to have_css('#new-branch .available')
|
2016-02-22 03:20:04 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
context "when there is a referenced merge request" do
|
2016-03-15 15:17:51 -04:00
|
|
|
let(:note) do
|
2016-02-22 03:20:04 -05:00
|
|
|
create(:note, :on_issue, :system, project: project,
|
2016-08-25 11:47:40 -04:00
|
|
|
note: "Mentioned in !#{referenced_mr.iid}")
|
2016-02-22 03:20:04 -05:00
|
|
|
end
|
2016-03-15 15:17:51 -04:00
|
|
|
let(:referenced_mr) do
|
|
|
|
create(:merge_request, :simple, source_project: project, target_project: project,
|
2016-03-17 16:39:50 -04:00
|
|
|
description: "Fixes ##{issue.iid}", author: user)
|
2016-02-22 03:20:04 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
issue.notes << note
|
|
|
|
|
|
|
|
visit namespace_project_issue_path(project.namespace, project, issue)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "hides the new branch button", js: true do
|
2016-04-21 10:34:00 -04:00
|
|
|
expect(page).not_to have_css('#new-branch .available')
|
2016-02-22 03:20:04 -05:00
|
|
|
expect(page).to have_content /1 Related Merge Request/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "for visiters" do
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'shows no buttons', js: true do
|
2016-02-22 03:20:04 -05:00
|
|
|
visit namespace_project_issue_path(project.namespace, project, issue)
|
2016-04-21 10:34:00 -04:00
|
|
|
|
|
|
|
expect(page).not_to have_css('#new-branch')
|
2016-02-22 03:20:04 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|