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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
require 'spec_helper'
describe "Projects" do
before { login_as :user }
describe "GET /projects/new" do
before do
visit root_path
click_link "New Project"
end
it "should be correct path" do
current_path.should == new_project_path
end
it "should have labels for new project" do
page.should have_content("Project name is")
end
end
describe "POST /projects" do
before do
visit new_project_path
fill_in 'project_name', :with => 'NewProject'
fill_in 'project_code', :with => 'NPR'
fill_in 'project_path', :with => 'newproject'
expect { click_button "Create project" }.to change { Project.count }.by(1)
@project = Project.last
end
it "should be correct path" do
current_path.should == project_path(@project)
end
it "should show project" do
page.should have_content(@project.name)
page.should have_content(@project.path)
page.should have_content(@project.description)
end
it "should init repo instructions" do
page.should have_content("git remote")
page.should have_content(@project.url_to_repo)
end
end
describe "GET /projects/show" do
before do
@project = Factory :project, :owner => @user
@project.add_access(@user, :read)
visit project_path(@project)
end
it "should be correct path" do
current_path.should == project_path(@project)
end
end
describe "GET /projects/graph" do
before do
@project = Factory :project
@project.add_access(@user, :read)
visit graph_project_path(@project)
end
it "should be correct path" do
current_path.should == graph_project_path(@project)
end
it "should have as as team member" do
page.should have_content("master")
end
end
describe "GET /projects/team" do
before do
@project = Factory :project
@project.add_access(@user, :read)
visit team_project_path(@project,
:path => ValidCommit::BLOB_FILE_PATH,
:commit_id => ValidCommit::ID)
end
it "should be correct path" do
current_path.should == team_project_path(@project)
end
it "should have as as team member" do
page.should have_content(@user.name)
end
end
describe "GET /projects/:id/edit" do
before do
@project = Factory :project
@project.add_access(@user, :admin, :read)
visit edit_project_path(@project)
end
it "should be correct path" do
current_path.should == edit_project_path(@project)
end
it "should have labels for new project" do
page.should have_content("Project name is")
page.should have_content("Advanced settings:")
page.should have_content("Features:")
end
end
describe "PUT /projects/:id" do
before do
@project = Factory :project, :owner => @user
@project.add_access(@user, :admin, :read)
visit edit_project_path(@project)
fill_in 'project_name', :with => 'Awesome'
fill_in 'project_code', :with => 'gitlabhq'
click_button "Save"
@project = @project.reload
end
it "should be correct path" do
current_path.should == edit_project_path(@project)
end
it "should show project" do
page.should have_content("Awesome")
end
end
describe "DELETE /projects/:id" do
before do
@project = Factory :project
@project.add_access(@user, :read, :admin)
visit edit_project_path(@project)
end
it "should be correct path" do
expect { click_link "Remove" }.to change {Project.count}.by(-1)
end
end
end
|