blob: 5e302da8a6339566ca4abd5c25ed08581a4c4868 (
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
49
50
51
52
53
54
55
56
57
|
require 'spec_helper'
feature 'New directory creation', feature: true, js: true do
given(:user) { create(:user) }
given(:role) { :developer }
given(:project) { create(:project) }
background do
sign_in(user)
project.team << [user, role]
visit project_tree_path(project, 'master')
open_new_directory_modal
fill_in 'dir_name', with: 'new_directory'
end
def open_new_directory_modal
first('.add-to-tree').click
click_link 'New directory'
end
def create_directory
click_button 'Create directory'
end
context 'with default target branch' do
background do
create_directory
end
scenario 'creates the directory in the default branch' do
expect(page).to have_content 'master'
expect(page).to have_content 'The directory has been successfully created'
expect(page).to have_content 'new_directory'
end
end
context 'with a new target branch' do
given(:new_branch_name) { 'new-feature' }
background do
fill_in :branch_name, with: new_branch_name
create_directory
end
scenario 'creates the directory in the new branch' do
expect(page).to have_content new_branch_name
expect(page).to have_content 'The directory has been successfully created'
end
scenario 'redirects to the merge request' do
expect(page).to have_content 'New Merge Request'
expect(page).to have_content "From #{new_branch_name} into master"
expect(page).to have_content 'Add new directory'
expect(current_path).to eq(project_new_merge_request_path(project))
end
end
end
|