Commit 9844ddd43f20e84754759688fea39e1a0241bb06

Authored by Dmitriy Zaporozhets
Committed by randx
1 parent 1281c122

Comments cucumber. More refactoring. Cucumber -> branches, tags

features/projects/commits/branches.feature
@@ -2,9 +2,19 @@ Feature: Browse branches @@ -2,9 +2,19 @@ Feature: Browse branches
2 Background: 2 Background:
3 Given I signin as a user 3 Given I signin as a user
4 And I own project "Shop" 4 And I own project "Shop"
  5 + And project "Shop" has protected branches
5 Given I visit project branches page 6 Given I visit project branches page
6 7
7 - Scenario: I can see all git branches 8 + Scenario: I can see project recent git branches
  9 + Then I should see "Shop" recent branches list
  10 +
  11 + Scenario: I can see project all git branches
  12 + Given I click link "All"
  13 + Then I should see "Shop" all branches list
  14 +
  15 + Scenario: I can see project protected git branches
  16 + Given I click link "Protected"
  17 + Then I should see "Shop" protected branches list
8 18
9 Scenario: I can download project by branch 19 Scenario: I can download project by branch
10 20
features/projects/commits/commit_comments.feature
@@ -4,4 +4,7 @@ Feature: Comment commit @@ -4,4 +4,7 @@ Feature: Comment commit
4 And I own project "Shop" 4 And I own project "Shop"
5 Given I visit project commit page 5 Given I visit project commit page
6 6
7 - Scenario: I leave a comment for commit 7 + @javascript
  8 + Scenario: I comment commit
  9 + Given I leave a comment like "XML attached"
  10 + Then I should see comment "XML attached"
features/projects/commits/tags.feature
@@ -5,7 +5,6 @@ Feature: Browse tags @@ -5,7 +5,6 @@ Feature: Browse tags
5 Given I visit project tags page 5 Given I visit project tags page
6 6
7 Scenario: I can see all git tags 7 Scenario: I can see all git tags
  8 + Then I should see "Shop" all tags list
8 9
9 Scenario: I can download project by tag 10 Scenario: I can download project by tag
10 -  
11 -  
features/projects/issues/issues.feature
@@ -35,4 +35,4 @@ Feature: Issues @@ -35,4 +35,4 @@ Feature: Issues
35 Scenario: I comment issue 35 Scenario: I comment issue
36 Given I visit issue page "Release 0.4" 36 Given I visit issue page "Release 0.4"
37 And I leave a comment like "XML attached" 37 And I leave a comment like "XML attached"
38 - Then I should see commetn "XML attached" 38 + Then I should see comment "XML attached"
features/projects/project.feature 0 → 100644
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +Feature: Project
  2 + Background:
  3 + Given I signin as a user
  4 + And I own project "Shop"
  5 + And I visit project "Shop" page
  6 +
  7 + Scenario: I should see project activity
  8 +
  9 + Scenario: I edit project
  10 +
  11 + Scenario: I visit attachments
features/projects/wiki.feature
@@ -7,3 +7,9 @@ Feature: Wiki @@ -7,3 +7,9 @@ Feature: Wiki
7 Scenario: Add new page 7 Scenario: Add new page
8 Given I create Wiki page 8 Given I create Wiki page
9 Then I should see newly created wiki page 9 Then I should see newly created wiki page
  10 +
  11 + @javascript
  12 + Scenario: I comment wiki page
  13 + Given I create Wiki page
  14 + And I leave a comment like "XML attached"
  15 + Then I should see comment "XML attached"
features/step_definitions/project/project_commits_steps.rb
@@ -59,3 +59,30 @@ end @@ -59,3 +59,30 @@ end
59 Given /^I visit project tags page$/ do 59 Given /^I visit project tags page$/ do
60 visit tags_project_repository_path(@project) 60 visit tags_project_repository_path(@project)
61 end 61 end
  62 +
  63 +Then /^I should see "(.*?)" recent branches list$/ do |arg1|
  64 + page.should have_content("Branches")
  65 + page.should have_content("master")
  66 +end
  67 +
  68 +Then /^I should see "(.*?)" all branches list$/ do |arg1|
  69 + page.should have_content("Branches")
  70 + page.should have_content("master")
  71 +end
  72 +
  73 +Then /^I should see "(.*?)" all tags list$/ do |arg1|
  74 + page.should have_content("Tags")
  75 + page.should have_content("v1.2.1")
  76 +end
  77 +
  78 +Then /^I should see "(.*?)" protected branches list$/ do |arg1|
  79 + within "table" do
  80 + page.should have_content "stable"
  81 + page.should_not have_content "master"
  82 + end
  83 +end
  84 +
  85 +Given /^project "(.*?)" has protected branches$/ do |arg1|
  86 + project = Project.find_by_name(arg1)
  87 + project.protected_branches.create(:name => "stable")
  88 +end
features/step_definitions/project/project_issues_steps.rb
@@ -32,15 +32,6 @@ Given /^I visit issue page "(.*?)"$/ do |arg1| @@ -32,15 +32,6 @@ Given /^I visit issue page "(.*?)"$/ do |arg1|
32 visit project_issue_path(issue.project, issue) 32 visit project_issue_path(issue.project, issue)
33 end 33 end
34 34
35 -Given /^I leave a comment like "(.*?)"$/ do |arg1|  
36 - fill_in "note_note", :with => arg1  
37 - click_button "Add Comment"  
38 -end  
39 -  
40 -Then /^I should see commetn "(.*?)"$/ do |arg1|  
41 - page.should have_content(arg1)  
42 -end  
43 -  
44 Given /^I submit new issue "(.*?)"$/ do |arg1| 35 Given /^I submit new issue "(.*?)"$/ do |arg1|
45 fill_in "issue_title", :with => arg1 36 fill_in "issue_title", :with => arg1
46 click_button "Submit new issue" 37 click_button "Submit new issue"
features/step_definitions/project/projects_steps.rb
@@ -50,6 +50,11 @@ Given /^I write new comment "(.*?)"$/ do |arg1| @@ -50,6 +50,11 @@ Given /^I write new comment "(.*?)"$/ do |arg1|
50 click_button "Add Comment" 50 click_button "Add Comment"
51 end 51 end
52 52
  53 +Given /^I visit project "(.*?)" page$/ do |arg1|
  54 + project = Project.find_by_name(arg1)
  55 + visit project_path(project)
  56 +end
  57 +
53 Given /^I visit project "(.*?)" network page$/ do |arg1| 58 Given /^I visit project "(.*?)" network page$/ do |arg1|
54 project = Project.find_by_name(arg1) 59 project = Project.find_by_name(arg1)
55 visit graph_project_path(project) 60 visit graph_project_path(project)
@@ -66,3 +71,12 @@ Given /^page should have network graph$/ do @@ -66,3 +71,12 @@ Given /^page should have network graph$/ do
66 page.should have_content "notes_refacto..." 71 page.should have_content "notes_refacto..."
67 end 72 end
68 end 73 end
  74 +
  75 +Given /^I leave a comment like "(.*?)"$/ do |arg1|
  76 + fill_in "note_note", :with => arg1
  77 + click_button "Add Comment"
  78 +end
  79 +
  80 +Then /^I should see comment "(.*?)"$/ do |arg1|
  81 + page.should have_content(arg1)
  82 +end
spec/monkeypatch.rb
@@ -44,4 +44,8 @@ class FakeSatellite @@ -44,4 +44,8 @@ class FakeSatellite
44 end 44 end
45 end 45 end
46 46
47 - 47 +class ProtectedBranch
  48 + def update_repository
  49 + true
  50 + end
  51 +end
spec/requests/access_spec.rb
@@ -1,187 +0,0 @@ @@ -1,187 +0,0 @@
1 -require 'spec_helper'  
2 -  
3 -describe "Application access" do  
4 - describe "GET /" do  
5 - it { root_path.should be_allowed_for :admin }  
6 - it { root_path.should be_allowed_for :user }  
7 - it { root_path.should be_denied_for :visitor }  
8 - end  
9 -  
10 - describe "GET /projects/new" do  
11 - it { new_project_path.should be_allowed_for :admin }  
12 - it { new_project_path.should be_allowed_for :user }  
13 - it { new_project_path.should be_denied_for :visitor }  
14 - end  
15 -  
16 - describe "Project" do  
17 - before do  
18 - @project = Factory :project  
19 - @u1 = Factory :user  
20 - @u2 = Factory :user  
21 - @u3 = Factory :user  
22 - # full access  
23 - @project.users_projects.create(:user => @u1, :project_access => UsersProject::MASTER)  
24 - # readonly  
25 - @project.users_projects.create(:user => @u3, :project_access => UsersProject::REPORTER)  
26 - end  
27 -  
28 - describe "GET /project_code" do  
29 - it { project_path(@project).should be_allowed_for @u1 }  
30 - it { project_path(@project).should be_allowed_for @u3 }  
31 - it { project_path(@project).should be_denied_for :admin }  
32 - it { project_path(@project).should be_denied_for @u2 }  
33 - it { project_path(@project).should be_denied_for :user }  
34 - it { project_path(@project).should be_denied_for :visitor }  
35 - end  
36 -  
37 - describe "GET /project_code/master/tree" do  
38 - it { tree_project_ref_path(@project, @project.root_ref).should be_allowed_for @u1 }  
39 - it { tree_project_ref_path(@project, @project.root_ref).should be_allowed_for @u3 }  
40 - it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :admin }  
41 - it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for @u2 }  
42 - it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :user }  
43 - it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :visitor }  
44 - end  
45 -  
46 - describe "GET /project_code/commits" do  
47 - it { project_commits_path(@project).should be_allowed_for @u1 }  
48 - it { project_commits_path(@project).should be_allowed_for @u3 }  
49 - it { project_commits_path(@project).should be_denied_for :admin }  
50 - it { project_commits_path(@project).should be_denied_for @u2 }  
51 - it { project_commits_path(@project).should be_denied_for :user }  
52 - it { project_commits_path(@project).should be_denied_for :visitor }  
53 - end  
54 -  
55 - describe "GET /project_code/commit" do  
56 - it { project_commit_path(@project, @project.commit.id).should be_allowed_for @u1 }  
57 - it { project_commit_path(@project, @project.commit.id).should be_allowed_for @u3 }  
58 - it { project_commit_path(@project, @project.commit.id).should be_denied_for :admin }  
59 - it { project_commit_path(@project, @project.commit.id).should be_denied_for @u2 }  
60 - it { project_commit_path(@project, @project.commit.id).should be_denied_for :user }  
61 - it { project_commit_path(@project, @project.commit.id).should be_denied_for :visitor }  
62 - end  
63 -  
64 - describe "GET /project_code/team" do  
65 - it { team_project_path(@project).should be_allowed_for @u1 }  
66 - it { team_project_path(@project).should be_allowed_for @u3 }  
67 - it { team_project_path(@project).should be_denied_for :admin }  
68 - it { team_project_path(@project).should be_denied_for @u2 }  
69 - it { team_project_path(@project).should be_denied_for :user }  
70 - it { team_project_path(@project).should be_denied_for :visitor }  
71 - end  
72 -  
73 - describe "GET /project_code/wall" do  
74 - it { wall_project_path(@project).should be_allowed_for @u1 }  
75 - it { wall_project_path(@project).should be_allowed_for @u3 }  
76 - it { wall_project_path(@project).should be_denied_for :admin }  
77 - it { wall_project_path(@project).should be_denied_for @u2 }  
78 - it { wall_project_path(@project).should be_denied_for :user }  
79 - it { wall_project_path(@project).should be_denied_for :visitor }  
80 - end  
81 -  
82 - describe "GET /project_code/blob" do  
83 - before do  
84 - @commit = @project.commit  
85 - @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name  
86 - @blob_path = blob_project_ref_path(@project, @commit.id, :path => @path)  
87 - end  
88 -  
89 - it { @blob_path.should be_allowed_for @u1 }  
90 - it { @blob_path.should be_allowed_for @u3 }  
91 - it { @blob_path.should be_denied_for :admin }  
92 - it { @blob_path.should be_denied_for @u2 }  
93 - it { @blob_path.should be_denied_for :user }  
94 - it { @blob_path.should be_denied_for :visitor }  
95 - end  
96 -  
97 - describe "GET /project_code/edit" do  
98 - it { edit_project_path(@project).should be_allowed_for @u1 }  
99 - it { edit_project_path(@project).should be_denied_for @u3 }  
100 - it { edit_project_path(@project).should be_denied_for :admin }  
101 - it { edit_project_path(@project).should be_denied_for @u2 }  
102 - it { edit_project_path(@project).should be_denied_for :user }  
103 - it { edit_project_path(@project).should be_denied_for :visitor }  
104 - end  
105 -  
106 - describe "GET /project_code/deploy_keys" do  
107 - it { project_deploy_keys_path(@project).should be_allowed_for @u1 }  
108 - it { project_deploy_keys_path(@project).should be_denied_for @u3 }  
109 - it { project_deploy_keys_path(@project).should be_denied_for :admin }  
110 - it { project_deploy_keys_path(@project).should be_denied_for @u2 }  
111 - it { project_deploy_keys_path(@project).should be_denied_for :user }  
112 - it { project_deploy_keys_path(@project).should be_denied_for :visitor }  
113 - end  
114 -  
115 - describe "GET /project_code/issues" do  
116 - it { project_issues_path(@project).should be_allowed_for @u1 }  
117 - it { project_issues_path(@project).should be_allowed_for @u3 }  
118 - it { project_issues_path(@project).should be_denied_for :admin }  
119 - it { project_issues_path(@project).should be_denied_for @u2 }  
120 - it { project_issues_path(@project).should be_denied_for :user }  
121 - it { project_issues_path(@project).should be_denied_for :visitor }  
122 - end  
123 -  
124 - describe "GET /project_code/snippets" do  
125 - it { project_snippets_path(@project).should be_allowed_for @u1 }  
126 - it { project_snippets_path(@project).should be_allowed_for @u3 }  
127 - it { project_snippets_path(@project).should be_denied_for :admin }  
128 - it { project_snippets_path(@project).should be_denied_for @u2 }  
129 - it { project_snippets_path(@project).should be_denied_for :user }  
130 - it { project_snippets_path(@project).should be_denied_for :visitor }  
131 - end  
132 -  
133 - describe "GET /project_code/merge_requests" do  
134 - it { project_merge_requests_path(@project).should be_allowed_for @u1 }  
135 - it { project_merge_requests_path(@project).should be_allowed_for @u3 }  
136 - it { project_merge_requests_path(@project).should be_denied_for :admin }  
137 - it { project_merge_requests_path(@project).should be_denied_for @u2 }  
138 - it { project_merge_requests_path(@project).should be_denied_for :user }  
139 - it { project_merge_requests_path(@project).should be_denied_for :visitor }  
140 - end  
141 -  
142 - describe "GET /project_code/repository" do  
143 - it { project_repository_path(@project).should be_allowed_for @u1 }  
144 - it { project_repository_path(@project).should be_allowed_for @u3 }  
145 - it { project_repository_path(@project).should be_denied_for :admin }  
146 - it { project_repository_path(@project).should be_denied_for @u2 }  
147 - it { project_repository_path(@project).should be_denied_for :user }  
148 - it { project_repository_path(@project).should be_denied_for :visitor }  
149 - end  
150 -  
151 - describe "GET /project_code/repository/branches" do  
152 - it { branches_project_repository_path(@project).should be_allowed_for @u1 }  
153 - it { branches_project_repository_path(@project).should be_allowed_for @u3 }  
154 - it { branches_project_repository_path(@project).should be_denied_for :admin }  
155 - it { branches_project_repository_path(@project).should be_denied_for @u2 }  
156 - it { branches_project_repository_path(@project).should be_denied_for :user }  
157 - it { branches_project_repository_path(@project).should be_denied_for :visitor }  
158 - end  
159 -  
160 - describe "GET /project_code/repository/tags" do  
161 - it { tags_project_repository_path(@project).should be_allowed_for @u1 }  
162 - it { tags_project_repository_path(@project).should be_allowed_for @u3 }  
163 - it { tags_project_repository_path(@project).should be_denied_for :admin }  
164 - it { tags_project_repository_path(@project).should be_denied_for @u2 }  
165 - it { tags_project_repository_path(@project).should be_denied_for :user }  
166 - it { tags_project_repository_path(@project).should be_denied_for :visitor }  
167 - end  
168 -  
169 - describe "GET /project_code/hooks" do  
170 - it { project_hooks_path(@project).should be_allowed_for @u1 }  
171 - it { project_hooks_path(@project).should be_allowed_for @u3 }  
172 - it { project_hooks_path(@project).should be_denied_for :admin }  
173 - it { project_hooks_path(@project).should be_denied_for @u2 }  
174 - it { project_hooks_path(@project).should be_denied_for :user }  
175 - it { project_hooks_path(@project).should be_denied_for :visitor }  
176 - end  
177 -  
178 - describe "GET /project_code/files" do  
179 - it { files_project_path(@project).should be_allowed_for @u1 }  
180 - it { files_project_path(@project).should be_allowed_for @u3 }  
181 - it { files_project_path(@project).should be_denied_for :admin }  
182 - it { files_project_path(@project).should be_denied_for @u2 }  
183 - it { files_project_path(@project).should be_denied_for :user }  
184 - it { files_project_path(@project).should be_denied_for :visitor }  
185 - end  
186 - end  
187 -end  
spec/requests/commits_notes_spec.rb
@@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
1 -require 'spec_helper'  
2 -  
3 -describe "Issues" do  
4 - let(:project) { Factory :project }  
5 - let!(:commit) { project.repo.commits.first }  
6 -  
7 - before do  
8 - login_as :user  
9 - project.add_access(@user, :read, :write)  
10 - end  
11 -  
12 - describe "add new note", :js => true do  
13 - before do  
14 - visit project_commit_path(project, commit)  
15 - fill_in "note_note", :with => "I commented this commit"  
16 - click_button "Add Comment"  
17 - end  
18 -  
19 - it "should conatin new note" do  
20 - page.should have_content("I commented this commit")  
21 - end  
22 -  
23 - it "should be displayed when i visit this commit again" do  
24 - visit project_commit_path(project, commit)  
25 - page.should have_content("I commented this commit")  
26 - end  
27 - end  
28 -end  
spec/requests/repositories_spec.rb
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -require 'spec_helper'  
2 -  
3 -describe "Repository" do  
4 -  
5 - before do  
6 - @user = Factory :user  
7 - @project = Factory :project  
8 - @project.add_access(@user, :read, :write)  
9 - login_with @user  
10 - end  
11 -  
12 - describe "GET /:project_name/repository" do  
13 - before do  
14 - visit project_repository_path(@project)  
15 - end  
16 -  
17 - it "should be on projects page" do  
18 - current_path.should == project_repository_path(@project)  
19 - end  
20 -  
21 - it "should have link to last commit for activities tab" do  
22 - page.should have_content(@project.commit.safe_message[0..20])  
23 - end  
24 - end  
25 -  
26 - describe "GET /:project_name/repository/branches" do  
27 - before do  
28 - visit branches_project_repository_path(@project)  
29 - end  
30 -  
31 - it "should have link to repo activities" do  
32 - page.should have_content("Branches")  
33 - page.should have_content("master")  
34 - end  
35 - end  
36 -  
37 - # TODO: Add new repo to seeds with tags list  
38 - describe "GET /:project_name/repository/tags" do  
39 - before do  
40 - visit tags_project_repository_path(@project)  
41 - end  
42 -  
43 - it "should have link to repo activities" do  
44 - page.should have_content("Tags")  
45 - page.should have_content("v1.2.1")  
46 - end  
47 - end  
48 -end  
49 -  
spec/requests/security/profile_access_spec.rb 0 → 100644
@@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
  1 +require 'spec_helper'
  2 +
  3 +describe "Users Security" do
  4 + describe "Project" do
  5 + before do
  6 + @u1 = Factory :user
  7 + end
  8 +
  9 + describe "GET /login" do
  10 + it { new_user_session_path.should_not be_404_for :visitor }
  11 + end
  12 +
  13 + describe "GET /keys" do
  14 + it { keys_path.should be_allowed_for @u1 }
  15 + it { keys_path.should be_allowed_for :admin }
  16 + it { keys_path.should be_allowed_for :user }
  17 + it { keys_path.should be_denied_for :visitor }
  18 + end
  19 +
  20 + describe "GET /profile" do
  21 + it { profile_path.should be_allowed_for @u1 }
  22 + it { profile_path.should be_allowed_for :admin }
  23 + it { profile_path.should be_allowed_for :user }
  24 + it { profile_path.should be_denied_for :visitor }
  25 + end
  26 +
  27 + describe "GET /profile/password" do
  28 + it { profile_password_path.should be_allowed_for @u1 }
  29 + it { profile_password_path.should be_allowed_for :admin }
  30 + it { profile_password_path.should be_allowed_for :user }
  31 + it { profile_password_path.should be_denied_for :visitor }
  32 + end
  33 + end
  34 +end
spec/requests/security/project_access_spec.rb 0 → 100644
@@ -0,0 +1,187 @@ @@ -0,0 +1,187 @@
  1 +require 'spec_helper'
  2 +
  3 +describe "Application access" do
  4 + describe "GET /" do
  5 + it { root_path.should be_allowed_for :admin }
  6 + it { root_path.should be_allowed_for :user }
  7 + it { root_path.should be_denied_for :visitor }
  8 + end
  9 +
  10 + describe "GET /projects/new" do
  11 + it { new_project_path.should be_allowed_for :admin }
  12 + it { new_project_path.should be_allowed_for :user }
  13 + it { new_project_path.should be_denied_for :visitor }
  14 + end
  15 +
  16 + describe "Project" do
  17 + before do
  18 + @project = Factory :project
  19 + @u1 = Factory :user
  20 + @u2 = Factory :user
  21 + @u3 = Factory :user
  22 + # full access
  23 + @project.users_projects.create(:user => @u1, :project_access => UsersProject::MASTER)
  24 + # readonly
  25 + @project.users_projects.create(:user => @u3, :project_access => UsersProject::REPORTER)
  26 + end
  27 +
  28 + describe "GET /project_code" do
  29 + it { project_path(@project).should be_allowed_for @u1 }
  30 + it { project_path(@project).should be_allowed_for @u3 }
  31 + it { project_path(@project).should be_denied_for :admin }
  32 + it { project_path(@project).should be_denied_for @u2 }
  33 + it { project_path(@project).should be_denied_for :user }
  34 + it { project_path(@project).should be_denied_for :visitor }
  35 + end
  36 +
  37 + describe "GET /project_code/master/tree" do
  38 + it { tree_project_ref_path(@project, @project.root_ref).should be_allowed_for @u1 }
  39 + it { tree_project_ref_path(@project, @project.root_ref).should be_allowed_for @u3 }
  40 + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :admin }
  41 + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for @u2 }
  42 + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :user }
  43 + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :visitor }
  44 + end
  45 +
  46 + describe "GET /project_code/commits" do
  47 + it { project_commits_path(@project).should be_allowed_for @u1 }
  48 + it { project_commits_path(@project).should be_allowed_for @u3 }
  49 + it { project_commits_path(@project).should be_denied_for :admin }
  50 + it { project_commits_path(@project).should be_denied_for @u2 }
  51 + it { project_commits_path(@project).should be_denied_for :user }
  52 + it { project_commits_path(@project).should be_denied_for :visitor }
  53 + end
  54 +
  55 + describe "GET /project_code/commit" do
  56 + it { project_commit_path(@project, @project.commit.id).should be_allowed_for @u1 }
  57 + it { project_commit_path(@project, @project.commit.id).should be_allowed_for @u3 }
  58 + it { project_commit_path(@project, @project.commit.id).should be_denied_for :admin }
  59 + it { project_commit_path(@project, @project.commit.id).should be_denied_for @u2 }
  60 + it { project_commit_path(@project, @project.commit.id).should be_denied_for :user }
  61 + it { project_commit_path(@project, @project.commit.id).should be_denied_for :visitor }
  62 + end
  63 +
  64 + describe "GET /project_code/team" do
  65 + it { team_project_path(@project).should be_allowed_for @u1 }
  66 + it { team_project_path(@project).should be_allowed_for @u3 }
  67 + it { team_project_path(@project).should be_denied_for :admin }
  68 + it { team_project_path(@project).should be_denied_for @u2 }
  69 + it { team_project_path(@project).should be_denied_for :user }
  70 + it { team_project_path(@project).should be_denied_for :visitor }
  71 + end
  72 +
  73 + describe "GET /project_code/wall" do
  74 + it { wall_project_path(@project).should be_allowed_for @u1 }
  75 + it { wall_project_path(@project).should be_allowed_for @u3 }
  76 + it { wall_project_path(@project).should be_denied_for :admin }
  77 + it { wall_project_path(@project).should be_denied_for @u2 }
  78 + it { wall_project_path(@project).should be_denied_for :user }
  79 + it { wall_project_path(@project).should be_denied_for :visitor }
  80 + end
  81 +
  82 + describe "GET /project_code/blob" do
  83 + before do
  84 + @commit = @project.commit
  85 + @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name
  86 + @blob_path = blob_project_ref_path(@project, @commit.id, :path => @path)
  87 + end
  88 +
  89 + it { @blob_path.should be_allowed_for @u1 }
  90 + it { @blob_path.should be_allowed_for @u3 }
  91 + it { @blob_path.should be_denied_for :admin }
  92 + it { @blob_path.should be_denied_for @u2 }
  93 + it { @blob_path.should be_denied_for :user }
  94 + it { @blob_path.should be_denied_for :visitor }
  95 + end
  96 +
  97 + describe "GET /project_code/edit" do
  98 + it { edit_project_path(@project).should be_allowed_for @u1 }
  99 + it { edit_project_path(@project).should be_denied_for @u3 }
  100 + it { edit_project_path(@project).should be_denied_for :admin }
  101 + it { edit_project_path(@project).should be_denied_for @u2 }
  102 + it { edit_project_path(@project).should be_denied_for :user }
  103 + it { edit_project_path(@project).should be_denied_for :visitor }
  104 + end
  105 +
  106 + describe "GET /project_code/deploy_keys" do
  107 + it { project_deploy_keys_path(@project).should be_allowed_for @u1 }
  108 + it { project_deploy_keys_path(@project).should be_denied_for @u3 }
  109 + it { project_deploy_keys_path(@project).should be_denied_for :admin }
  110 + it { project_deploy_keys_path(@project).should be_denied_for @u2 }
  111 + it { project_deploy_keys_path(@project).should be_denied_for :user }
  112 + it { project_deploy_keys_path(@project).should be_denied_for :visitor }
  113 + end
  114 +
  115 + describe "GET /project_code/issues" do
  116 + it { project_issues_path(@project).should be_allowed_for @u1 }
  117 + it { project_issues_path(@project).should be_allowed_for @u3 }
  118 + it { project_issues_path(@project).should be_denied_for :admin }
  119 + it { project_issues_path(@project).should be_denied_for @u2 }
  120 + it { project_issues_path(@project).should be_denied_for :user }
  121 + it { project_issues_path(@project).should be_denied_for :visitor }
  122 + end
  123 +
  124 + describe "GET /project_code/snippets" do
  125 + it { project_snippets_path(@project).should be_allowed_for @u1 }
  126 + it { project_snippets_path(@project).should be_allowed_for @u3 }
  127 + it { project_snippets_path(@project).should be_denied_for :admin }
  128 + it { project_snippets_path(@project).should be_denied_for @u2 }
  129 + it { project_snippets_path(@project).should be_denied_for :user }
  130 + it { project_snippets_path(@project).should be_denied_for :visitor }
  131 + end
  132 +
  133 + describe "GET /project_code/merge_requests" do
  134 + it { project_merge_requests_path(@project).should be_allowed_for @u1 }
  135 + it { project_merge_requests_path(@project).should be_allowed_for @u3 }
  136 + it { project_merge_requests_path(@project).should be_denied_for :admin }
  137 + it { project_merge_requests_path(@project).should be_denied_for @u2 }
  138 + it { project_merge_requests_path(@project).should be_denied_for :user }
  139 + it { project_merge_requests_path(@project).should be_denied_for :visitor }
  140 + end
  141 +
  142 + describe "GET /project_code/repository" do
  143 + it { project_repository_path(@project).should be_allowed_for @u1 }
  144 + it { project_repository_path(@project).should be_allowed_for @u3 }
  145 + it { project_repository_path(@project).should be_denied_for :admin }
  146 + it { project_repository_path(@project).should be_denied_for @u2 }
  147 + it { project_repository_path(@project).should be_denied_for :user }
  148 + it { project_repository_path(@project).should be_denied_for :visitor }
  149 + end
  150 +
  151 + describe "GET /project_code/repository/branches" do
  152 + it { branches_project_repository_path(@project).should be_allowed_for @u1 }
  153 + it { branches_project_repository_path(@project).should be_allowed_for @u3 }
  154 + it { branches_project_repository_path(@project).should be_denied_for :admin }
  155 + it { branches_project_repository_path(@project).should be_denied_for @u2 }
  156 + it { branches_project_repository_path(@project).should be_denied_for :user }
  157 + it { branches_project_repository_path(@project).should be_denied_for :visitor }
  158 + end
  159 +
  160 + describe "GET /project_code/repository/tags" do
  161 + it { tags_project_repository_path(@project).should be_allowed_for @u1 }
  162 + it { tags_project_repository_path(@project).should be_allowed_for @u3 }
  163 + it { tags_project_repository_path(@project).should be_denied_for :admin }
  164 + it { tags_project_repository_path(@project).should be_denied_for @u2 }
  165 + it { tags_project_repository_path(@project).should be_denied_for :user }
  166 + it { tags_project_repository_path(@project).should be_denied_for :visitor }
  167 + end
  168 +
  169 + describe "GET /project_code/hooks" do
  170 + it { project_hooks_path(@project).should be_allowed_for @u1 }
  171 + it { project_hooks_path(@project).should be_allowed_for @u3 }
  172 + it { project_hooks_path(@project).should be_denied_for :admin }
  173 + it { project_hooks_path(@project).should be_denied_for @u2 }
  174 + it { project_hooks_path(@project).should be_denied_for :user }
  175 + it { project_hooks_path(@project).should be_denied_for :visitor }
  176 + end
  177 +
  178 + describe "GET /project_code/files" do
  179 + it { files_project_path(@project).should be_allowed_for @u1 }
  180 + it { files_project_path(@project).should be_allowed_for @u3 }
  181 + it { files_project_path(@project).should be_denied_for :admin }
  182 + it { files_project_path(@project).should be_denied_for @u2 }
  183 + it { files_project_path(@project).should be_denied_for :user }
  184 + it { files_project_path(@project).should be_denied_for :visitor }
  185 + end
  186 + end
  187 +end
spec/requests/team_members_spec.rb
@@ -1,68 +0,0 @@ @@ -1,68 +0,0 @@
1 -require 'spec_helper'  
2 -  
3 -describe "TeamMembers" do  
4 - before do  
5 - login_as :user  
6 - @project = Factory :project  
7 - @project.add_access(@user, :read, :admin)  
8 - end  
9 -  
10 - describe "Update profile", :js => true do  
11 - it "should update user role" do  
12 - @project.master_access_for?(@user).should be_true  
13 - visit team_project_path(@project)  
14 - select "Developer", :from => "team_member_project_access"  
15 - @project.master_access_for?(@user).should be_false  
16 - @project.dev_access_for?(@user).should be_true  
17 - end  
18 - end  
19 -  
20 - describe "View profile" do  
21 - it "should be available" do  
22 - visit(team_project_path(@project))  
23 - click_link(@user.name)  
24 - page.should have_content @user.skype  
25 - page.should_not have_content 'Twitter'  
26 - end  
27 - end  
28 -  
29 - describe "New Team member" do  
30 - before do  
31 - @user_1 = Factory :user  
32 - visit team_project_path(@project)  
33 - click_link "New Team Member"  
34 - end  
35 -  
36 - it "should open new team member popup" do  
37 - page.should have_content("New Team member")  
38 - end  
39 -  
40 - describe "fill in" do  
41 - before do  
42 - within "#new_team_member" do  
43 - select @user_1.name, :from => "team_member_user_id"  
44 - select "Reporter", :from => "team_member_project_access"  
45 - end  
46 - end  
47 -  
48 - it { expect { click_button "Save";sleep(1) }.to change {UsersProject.count}.by(1) }  
49 -  
50 - it "should add new member to table" do  
51 - click_button "Save"  
52 - @member = UsersProject.last  
53 -  
54 - page.should have_content @user_1.name  
55 -  
56 - @member.reload  
57 - @member.project_access.should == UsersProject::REPORTER  
58 - end  
59 - end  
60 - end  
61 -  
62 - describe "Cancel membership" do  
63 - it "should cancel membership" do  
64 - visit project_team_member_path(@project, @project.users_projects.last)  
65 - expect { click_link "Remove from team" }.to change { UsersProject.count }.by(-1)  
66 - end  
67 - end  
68 -end  
spec/requests/user_security_spec.rb
@@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
1 -require 'spec_helper'  
2 -  
3 -describe "Users Security" do  
4 - describe "Project" do  
5 - before do  
6 - @u1 = Factory :user  
7 - end  
8 -  
9 - describe "GET /login" do  
10 - #it { new_user_session_path.should be_denied_for @u1 }  
11 - #it { new_user_session_path.should be_denied_for :admin }  
12 - #it { new_user_session_path.should be_denied_for :user }  
13 - it { new_user_session_path.should_not be_404_for :visitor }  
14 - end  
15 -  
16 - describe "GET /keys" do  
17 - it { keys_path.should be_allowed_for @u1 }  
18 - it { keys_path.should be_allowed_for :admin }  
19 - it { keys_path.should be_allowed_for :user }  
20 - it { keys_path.should be_denied_for :visitor }  
21 - end  
22 -  
23 - describe "GET /profile" do  
24 - it { profile_path.should be_allowed_for @u1 }  
25 - it { profile_path.should be_allowed_for :admin }  
26 - it { profile_path.should be_allowed_for :user }  
27 - it { profile_path.should be_denied_for :visitor }  
28 - end  
29 -  
30 - describe "GET /profile/password" do  
31 - it { profile_password_path.should be_allowed_for @u1 }  
32 - it { profile_password_path.should be_allowed_for :admin }  
33 - it { profile_password_path.should be_allowed_for :user }  
34 - it { profile_password_path.should be_denied_for :visitor }  
35 - end  
36 - end  
37 -end  
spec/requests/wikis_notes_spec.rb
@@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
1 -require 'spec_helper'  
2 -  
3 -describe "Wikis" do  
4 - let(:project) { Factory :project }  
5 -  
6 - before do  
7 - login_as :user  
8 - project.add_access(@user, :read, :write)  
9 - end  
10 -  
11 - describe "add new note", :js => true do  
12 - before do  
13 - visit project_wiki_path(project, :index)  
14 -  
15 - fill_in "Title", :with => 'Test title'  
16 - fill_in "Content", :with => '[link test](test)'  
17 - click_on "Save"  
18 -  
19 - page.should have_content("Test title")  
20 -  
21 - fill_in "note_note", :with => "Comment on wiki!"  
22 - click_button "Add Comment"  
23 - end  
24 -  
25 - it "should contain the new note" do  
26 - page.should have_content("Comment on wiki!")  
27 - end  
28 - end  
29 -end