blob: 52c860bfe366242a6e44aaabdadba4cdf3153f24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# frozen_string_literal: true
require "spec_helper"
RSpec.describe "User creates branch", :js do
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
branch_name = "deploy_keys".freeze
create_branch(branch_name)
expect(page).to have_content(branch_name)
end
context "when branch name is invalid" do
it "does not create new branch" do
invalid_branch_name = "1.0 stable".freeze
fill_in("branch_name", with: invalid_branch_name)
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
|