debian-mirror-gitlab/spec/features/projects/branches/user_creates_branch_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.1 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-10-15 14:42:47 +05:30
require "spec_helper"
2020-06-23 00:09:42 +05:30
RSpec.describe "User creates branch", :js do
2018-10-15 14:42:47 +05:30
include Spec::Support::Helpers::Features::BranchesHelpers
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
before do
project.add_developer(user)
sign_in(user)
visit(new_project_branch_path(project))
end
it "creates new branch" do
2021-04-29 21:17:54 +05:30
branch_name = "deploy_keys"
2018-10-15 14:42:47 +05:30
2020-05-24 23:13:21 +05:30
create_branch(branch_name)
2018-10-15 14:42:47 +05:30
2020-05-24 23:13:21 +05:30
expect(page).to have_content(branch_name)
2018-10-15 14:42:47 +05:30
end
context "when branch name is invalid" do
it "does not create new branch" do
2021-04-29 21:17:54 +05:30
invalid_branch_name = "1.0 stable"
2018-10-15 14:42:47 +05:30
2020-05-24 23:13:21 +05:30
fill_in("branch_name", with: invalid_branch_name)
2018-10-15 14:42:47 +05:30
page.find("body").click # defocus the branch_name input
select_branch("master")
click_button("Create branch")
expect(page).to have_content("Branch name is invalid")
expect(page).to have_content("can't contain spaces")
end
end
context "when branch name already exists" do
it "does not create new branch" do
create_branch("master")
expect(page).to have_content("Branch already exists")
end
end
end