Commit 8e6a7a172eec57b56f5b460b3e041480dc8a740a
Exists in
master
and in
4 other branches
Merge branch 'master' into gitlab-flavored-markdown
Showing
70 changed files
with
990 additions
and
1701 deletions
Show diff stats
.travis.yml
@@ -4,7 +4,6 @@ env: | @@ -4,7 +4,6 @@ env: | ||
4 | before_install: | 4 | before_install: |
5 | - sudo apt-get install libicu-dev -y | 5 | - sudo apt-get install libicu-dev -y |
6 | - gem install charlock_holmes -v="0.6.8" | 6 | - gem install charlock_holmes -v="0.6.8" |
7 | - - echo "yes" | gem uninstall json ffi | ||
8 | branches: | 7 | branches: |
9 | only: | 8 | only: |
10 | - 'master' | 9 | - 'master' |
Gemfile
@@ -60,6 +60,7 @@ group :development do | @@ -60,6 +60,7 @@ group :development do | ||
60 | gem "letter_opener" | 60 | gem "letter_opener" |
61 | gem "rails-footnotes" | 61 | gem "rails-footnotes" |
62 | gem "annotate", :git => "https://github.com/ctran/annotate_models.git" | 62 | gem "annotate", :git => "https://github.com/ctran/annotate_models.git" |
63 | + gem 'rack-mini-profiler' | ||
63 | end | 64 | end |
64 | 65 | ||
65 | group :development, :test do | 66 | group :development, :test do |
Gemfile.lock
@@ -237,6 +237,8 @@ GEM | @@ -237,6 +237,8 @@ GEM | ||
237 | rack (1.4.1) | 237 | rack (1.4.1) |
238 | rack-cache (1.2) | 238 | rack-cache (1.2) |
239 | rack (>= 0.4) | 239 | rack (>= 0.4) |
240 | + rack-mini-profiler (0.1.9) | ||
241 | + rack (>= 1.1.3) | ||
240 | rack-mount (0.8.3) | 242 | rack-mount (0.8.3) |
241 | rack (>= 1.0.0) | 243 | rack (>= 1.0.0) |
242 | rack-protection (1.2.0) | 244 | rack-protection (1.2.0) |
@@ -408,6 +410,7 @@ DEPENDENCIES | @@ -408,6 +410,7 @@ DEPENDENCIES | ||
408 | omniauth-ldap! | 410 | omniauth-ldap! |
409 | pry | 411 | pry |
410 | pygments.rb! | 412 | pygments.rb! |
413 | + rack-mini-profiler | ||
411 | rails (= 3.2.5) | 414 | rails (= 3.2.5) |
412 | rails-footnotes | 415 | rails-footnotes |
413 | raphael-rails (= 1.5.2) | 416 | raphael-rails (= 1.5.2) |
app/assets/stylesheets/sections/issues.scss
@@ -51,25 +51,51 @@ | @@ -51,25 +51,51 @@ | ||
51 | 51 | ||
52 | input.check_all_issues { | 52 | input.check_all_issues { |
53 | float:left; | 53 | float:left; |
54 | - padding: 8px 0; | ||
55 | - margin: 14px 0; | 54 | + padding: 0; |
55 | + margin:0; | ||
56 | margin-right: 10px; | 56 | margin-right: 10px; |
57 | + position: relative; | ||
58 | + top: 8px; | ||
59 | + height: 22px; | ||
60 | +} | ||
61 | + | ||
62 | +.issues_content { | ||
63 | + .title { | ||
64 | + height: 40px; | ||
65 | + } | ||
57 | } | 66 | } |
58 | 67 | ||
59 | #issues-table-holder { | 68 | #issues-table-holder { |
69 | + .issues_filters { | ||
70 | + form { | ||
71 | + padding:0; | ||
72 | + margin:0; | ||
73 | + margin-top:7px | ||
74 | + } | ||
75 | + } | ||
76 | + | ||
60 | .issues_bulk_update { | 77 | .issues_bulk_update { |
61 | - padding: 0 5px; | ||
62 | margin: 0; | 78 | margin: 0; |
63 | form { | 79 | form { |
80 | + padding:0; | ||
64 | margin:0; | 81 | margin:0; |
65 | - padding-bottom:5px; | 82 | + margin-top:7px |
66 | } | 83 | } |
67 | .update_selected_issues { | 84 | .update_selected_issues { |
68 | position:relative; | 85 | position:relative; |
69 | top:-2px; | 86 | top:-2px; |
70 | - margin-left:3px; | 87 | + margin-left:4px; |
88 | + float:left; | ||
71 | } | 89 | } |
72 | - | ||
73 | 90 | ||
91 | + .update_issues_text { | ||
92 | + padding:3px; | ||
93 | + line-height: 18px; | ||
94 | + float:left; | ||
95 | + } | ||
74 | } | 96 | } |
75 | } | 97 | } |
98 | + | ||
99 | +#update_status { | ||
100 | + width:100px; | ||
101 | +} |
app/assets/stylesheets/sections/nav.scss
@@ -14,6 +14,7 @@ ul.main_menu { | @@ -14,6 +14,7 @@ ul.main_menu { | ||
14 | background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf); | 14 | background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf); |
15 | background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf); | 15 | background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf); |
16 | position:relative; | 16 | position:relative; |
17 | + overflow:hidden; | ||
17 | @include shade; | 18 | @include shade; |
18 | .count { | 19 | .count { |
19 | position: relative; | 20 | position: relative; |
app/controllers/application_controller.rb
@@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base | @@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base | ||
4 | before_filter :set_current_user_for_mailer | 4 | before_filter :set_current_user_for_mailer |
5 | before_filter :check_token_auth | 5 | before_filter :check_token_auth |
6 | before_filter :set_current_user_for_observers | 6 | before_filter :set_current_user_for_observers |
7 | + before_filter :dev_tools if Rails.env == 'development' | ||
7 | 8 | ||
8 | protect_from_forgery | 9 | protect_from_forgery |
9 | 10 | ||
@@ -142,4 +143,8 @@ class ApplicationController < ActionController::Base | @@ -142,4 +143,8 @@ class ApplicationController < ActionController::Base | ||
142 | def render_full_content | 143 | def render_full_content |
143 | @full_content = true | 144 | @full_content = true |
144 | end | 145 | end |
146 | + | ||
147 | + def dev_tools | ||
148 | + Rack::MiniProfiler.authorize_request | ||
149 | + end | ||
145 | end | 150 | end |
app/helpers/application_helper.rb
@@ -122,7 +122,7 @@ module ApplicationHelper | @@ -122,7 +122,7 @@ module ApplicationHelper | ||
122 | end | 122 | end |
123 | 123 | ||
124 | def markdown(text) | 124 | def markdown(text) |
125 | - @__renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::GitlabHTML.new(self, filter_html: true), { | 125 | + @__renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::GitlabHTML.new(self, filter_html: true, with_toc_data: true), { |
126 | no_intra_emphasis: true, | 126 | no_intra_emphasis: true, |
127 | tables: true, | 127 | tables: true, |
128 | fenced_code_blocks: true, | 128 | fenced_code_blocks: true, |
app/models/web_hook.rb
@@ -11,7 +11,16 @@ class WebHook < ActiveRecord::Base | @@ -11,7 +11,16 @@ class WebHook < ActiveRecord::Base | ||
11 | message: "should be a valid url" } | 11 | message: "should be a valid url" } |
12 | 12 | ||
13 | def execute(data) | 13 | def execute(data) |
14 | - WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" }) | 14 | + parsed_url = URI.parse(url) |
15 | + if parsed_url.userinfo.blank? | ||
16 | + WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" }) | ||
17 | + else | ||
18 | + post_url = url.gsub(parsed_url.userinfo+"@", "") | ||
19 | + WebHook.post(post_url, | ||
20 | + body: data.to_json, | ||
21 | + headers: { "Content-Type" => "application/json" }, | ||
22 | + basic_auth: {username: parsed_url.user, password: parsed_url.password}) | ||
23 | + end | ||
15 | end | 24 | end |
16 | 25 | ||
17 | end | 26 | end |
app/views/issues/_show.html.haml
1 | %li.wll{ :id => dom_id(issue), :class => issue_css_classes(issue), :url => project_issue_path(issue.project, issue) } | 1 | %li.wll{ :id => dom_id(issue), :class => issue_css_classes(issue), :url => project_issue_path(issue.project, issue) } |
2 | - .issue_check | ||
3 | - = check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, :class => "selected_issue", :disabled => !can?(current_user, :modify_issue, issue) | 2 | + - if controller.controller_name == 'issues' |
3 | + .issue_check | ||
4 | + = check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, :class => "selected_issue", :disabled => !can?(current_user, :modify_issue, issue) | ||
4 | .right | 5 | .right |
5 | - issue.labels.each do |label| | 6 | - issue.labels.each do |label| |
6 | %span.label.label-issue.grouped | 7 | %span.label.label-issue.grouped |
app/views/issues/index.html.haml
@@ -22,13 +22,13 @@ | @@ -22,13 +22,13 @@ | ||
22 | 22 | ||
23 | .issues_bulk_update.hide | 23 | .issues_bulk_update.hide |
24 | = form_tag bulk_update_project_issues_path(@project), :method => :post do | 24 | = form_tag bulk_update_project_issues_path(@project), :method => :post do |
25 | - %span Update selected issues with | ||
26 | - | ||
27 | - = select_tag('update[status]', options_for_select(['open', 'closed']), :prompt => "Status") | ||
28 | - = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), :prompt => "Assignee") | ||
29 | - = select_tag('update[milestone_id]', options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), :prompt => "Milestone") | ||
30 | - = hidden_field_tag 'update[issues_ids]', [] | ||
31 | - = hidden_field_tag :f, params[:f] | 25 | + %span.update_issues_text Update selected issues with |
26 | + .left | ||
27 | + = select_tag('update[status]', options_for_select(['open', 'closed']), :prompt => "Status") | ||
28 | + = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), :prompt => "Assignee") | ||
29 | + = select_tag('update[milestone_id]', options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), :prompt => "Milestone") | ||
30 | + = hidden_field_tag 'update[issues_ids]', [] | ||
31 | + = hidden_field_tag :f, params[:f] | ||
32 | = button_tag "Save", :class => "btn update_selected_issues" | 32 | = button_tag "Save", :class => "btn update_selected_issues" |
33 | .issues_filters | 33 | .issues_filters |
34 | .left | 34 | .left |
app/views/projects/new.html.haml
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | %div.ajax_loader.hide | 6 | %div.ajax_loader.hide |
7 | %center | 7 | %center |
8 | %div.padded= image_tag "ajax_loader.gif" | 8 | %div.padded= image_tag "ajax_loader.gif" |
9 | - %h3.prepend-top Creating project & repository. Please wait for few minutes | 9 | + %h3.prepend-top Creating project & repository. Please wait a few minutes |
10 | 10 | ||
11 | :javascript | 11 | :javascript |
12 | $(function(){ new Projects(); }); | 12 | $(function(){ new Projects(); }); |
doc/installation.md
@@ -195,6 +195,11 @@ Application can be started with next command: | @@ -195,6 +195,11 @@ Application can be started with next command: | ||
195 | # As daemon | 195 | # As daemon |
196 | sudo -u gitlab bundle exec rails s -e production -d | 196 | sudo -u gitlab bundle exec rails s -e production -d |
197 | 197 | ||
198 | +You can login via web using admin generated with setup: | ||
199 | + | ||
200 | + admin@local.host | ||
201 | + 5iveL!fe | ||
202 | + | ||
198 | # 6. Run resque process (for processing queue). | 203 | # 6. Run resque process (for processing queue). |
199 | 204 | ||
200 | # Manually | 205 | # Manually |
features/dashboard/dashboard.feature
@@ -10,7 +10,7 @@ Feature: Dashboard | @@ -10,7 +10,7 @@ Feature: Dashboard | ||
10 | Then I should see "Shop" project link | 10 | Then I should see "Shop" project link |
11 | Then I should see project "Shop" activity feed | 11 | Then I should see project "Shop" activity feed |
12 | 12 | ||
13 | - Scenario: I should see last pish widget | 13 | + Scenario: I should see last push widget |
14 | Then I should see last push widget | 14 | Then I should see last push widget |
15 | And I click "Create Merge Request" link | 15 | And I click "Create Merge Request" link |
16 | Then I see prefilled new Merge Request page | 16 | Then I see prefilled new Merge Request page |
features/profile/profile.feature
@@ -6,6 +6,11 @@ Feature: Profile | @@ -6,6 +6,11 @@ Feature: Profile | ||
6 | Given I visit profile page | 6 | Given I visit profile page |
7 | Then I should see my profile info | 7 | Then I should see my profile info |
8 | 8 | ||
9 | + Scenario: I edit profile | ||
10 | + Given I visit profile page | ||
11 | + Then I change my contact info | ||
12 | + And I should see new contact info | ||
13 | + | ||
9 | Scenario: I change my password | 14 | Scenario: I change my password |
10 | Given I visit profile password page | 15 | Given I visit profile password page |
11 | Then I change my password | 16 | Then I change my password |
@@ -15,4 +20,3 @@ Feature: Profile | @@ -15,4 +20,3 @@ Feature: Profile | ||
15 | Given I visit profile token page | 20 | Given I visit profile token page |
16 | Then I reset my token | 21 | Then I reset my token |
17 | And I should see new token | 22 | And I should see new token |
18 | - |
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
@@ -7,6 +7,32 @@ Feature: Issues | @@ -7,6 +7,32 @@ Feature: Issues | ||
7 | And I visit project "Shop" issues page | 7 | And I visit project "Shop" issues page |
8 | 8 | ||
9 | Scenario: I should see open issues | 9 | Scenario: I should see open issues |
10 | - Given I should see "Release 0.4" open issue | ||
11 | - And I should not see "Release 0.3" closed issue | 10 | + Given I should see "Release 0.4" in issues |
11 | + And I should not see "Release 0.3" in issues | ||
12 | 12 | ||
13 | + Scenario: I should see closed issues | ||
14 | + Given I click link "Closed" | ||
15 | + Then I should see "Release 0.3" in issues | ||
16 | + And I should not see "Release 0.4" in issues | ||
17 | + | ||
18 | + Scenario: I should see all issues | ||
19 | + Given I click link "All" | ||
20 | + Then I should see "Release 0.3" in issues | ||
21 | + And I should see "Release 0.4" in issues | ||
22 | + | ||
23 | + Scenario: I visit issue page | ||
24 | + Given I click link "Release 0.4" | ||
25 | + Then I should see issue "Release 0.4" | ||
26 | + | ||
27 | + @javascript | ||
28 | + Scenario: I submit new unassigned issue | ||
29 | + Given I click link "New Issue" | ||
30 | + And I submit new issue "500 error on profile" | ||
31 | + Given I click link "500 error on profile" | ||
32 | + Then I should see issue "500 error on profile" | ||
33 | + | ||
34 | + @javascript | ||
35 | + Scenario: I comment issue | ||
36 | + Given I visit issue page "Release 0.4" | ||
37 | + And I leave a comment like "XML attached" | ||
38 | + Then I should see comment "XML attached" |
features/projects/issues/milestones.feature
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +Feature: Milestones | ||
2 | + Background: | ||
3 | + Given I signin as a user | ||
4 | + And I own project "Shop" | ||
5 | + And project "Shop" has milestone "v2.2" | ||
6 | + Given I visit project "Shop" milestones page | ||
7 | + | ||
8 | + Scenario: I should see active milestones | ||
9 | + Then I should see milestone "v2.2" | ||
10 | + | ||
11 | + Scenario: I should see milestone | ||
12 | + Given I click link "v2.2" | ||
13 | + Then I should see milestone "v2.2" | ||
14 | + | ||
15 | + Scenario: I create new milestone | ||
16 | + Given I click link "New Milestone" | ||
17 | + And I submit new milestone "v2.3" | ||
18 | + Then I should see milestone "v2.3" |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +Feature: Browse git repo | ||
2 | + Background: | ||
3 | + Given I signin as a user | ||
4 | + And I own project "Shop" | ||
5 | + Given I visit project source page | ||
6 | + | ||
7 | + Scenario: I browse files from master branch | ||
8 | + Then I should see files from repository | ||
9 | + | ||
10 | + Scenario: I browse files for specific ref | ||
11 | + Given I visit project source page for "8470d70" | ||
12 | + Then I should see files from repository for "8470d70" | ||
13 | + | ||
14 | + Scenario: I browse file content | ||
15 | + Given I click on file from repo | ||
16 | + Then I should see it content | ||
17 | + | ||
18 | + Scenario: I browse raw file | ||
19 | + Given I visit blob file from repo | ||
20 | + And I click on raw button | ||
21 | + Then I should see raw file content | ||
22 | + | ||
23 | + |
features/projects/source/browse_files.feature.commented
@@ -1,23 +0,0 @@ | @@ -1,23 +0,0 @@ | ||
1 | -Feature: Browse git repo | ||
2 | - Background: | ||
3 | - Given I signin as a user | ||
4 | - And I own project "Shop" | ||
5 | - Given I visit project source page | ||
6 | - | ||
7 | - Scenario: I browse files from master branch | ||
8 | - Then I should see files from repository | ||
9 | - | ||
10 | - Scenario: I browse files for specific ref | ||
11 | - Given I visit project source page for "8470d70" | ||
12 | - Then I should see files from repository for "8470d70" | ||
13 | - | ||
14 | - Scenario: I browse file content | ||
15 | - Given I click on file from repo | ||
16 | - Then I should see it content | ||
17 | - | ||
18 | - Scenario: I browse raw file | ||
19 | - Given I visit blob file from repo | ||
20 | - And I click on raw button | ||
21 | - Then I should see raw file content | ||
22 | - | ||
23 | - |
features/projects/source/git_blame.feature
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +Feature: Browse git repo | ||
2 | + Background: | ||
3 | + Given I signin as a user | ||
4 | + And I own project "Shop" | ||
5 | + Given I visit project source page | ||
6 | + | ||
7 | + Scenario: I blame file | ||
8 | + Given I click on file from repo | ||
9 | + And I click blame button | ||
10 | + Then I should see git file blame |
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/browse_code_steps.rb
@@ -1,40 +0,0 @@ | @@ -1,40 +0,0 @@ | ||
1 | -Given /^I visit project source page$/ do | ||
2 | - visit tree_project_ref_path(@project, @project.root_ref) | ||
3 | -end | ||
4 | - | ||
5 | -Then /^I should see files from repository$/ do | ||
6 | - page.should have_content("app") | ||
7 | - page.should have_content("History") | ||
8 | - page.should have_content("Gemfile") | ||
9 | -end | ||
10 | - | ||
11 | -Given /^I visit project source page for "(.*?)"$/ do |arg1| | ||
12 | - visit tree_project_ref_path(@project, arg1) | ||
13 | -end | ||
14 | - | ||
15 | -Then /^I should see files from repository for "(.*?)"$/ do |arg1| | ||
16 | - current_path.should == tree_project_ref_path(@project, arg1) | ||
17 | - page.should have_content("app") | ||
18 | - page.should have_content("History") | ||
19 | - page.should have_content("Gemfile") | ||
20 | -end | ||
21 | - | ||
22 | -Given /^I click on file from repo$/ do | ||
23 | - click_link "Gemfile" | ||
24 | -end | ||
25 | - | ||
26 | -Then /^I should see it content$/ do | ||
27 | - page.should have_content("rubygems.org") | ||
28 | -end | ||
29 | - | ||
30 | -Given /^I click on raw button$/ do | ||
31 | - click_link "raw" | ||
32 | -end | ||
33 | - | ||
34 | -Given /^I visit blob file from repo$/ do | ||
35 | - visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) | ||
36 | -end | ||
37 | - | ||
38 | -Then /^I should see raw file content$/ do | ||
39 | - page.source.should == ValidCommit::BLOB_FILE | ||
40 | -end |
@@ -0,0 +1,34 @@ | @@ -0,0 +1,34 @@ | ||
1 | +Given /^I visit profile keys page$/ do | ||
2 | + visit keys_path | ||
3 | +end | ||
4 | + | ||
5 | +Then /^I should see my ssh keys$/ do | ||
6 | + @user.keys.each do |key| | ||
7 | + page.should have_content(key.title) | ||
8 | + end | ||
9 | +end | ||
10 | + | ||
11 | +Given /^I have ssh keys:$/ do |table| | ||
12 | + table.hashes.each do |row| | ||
13 | + Factory :key, :user => @user, :title => row[:title], :key => "jfKLJDFKSFJSHFJ#{row[:title]}" | ||
14 | + end | ||
15 | +end | ||
16 | + | ||
17 | +Given /^I submit new ssh key "(.*?)"$/ do |arg1| | ||
18 | + fill_in "key_title", :with => arg1 | ||
19 | + fill_in "key_key", :with => "publickey234=" | ||
20 | + click_button "Save" | ||
21 | +end | ||
22 | + | ||
23 | +Then /^I should see new ssh key "(.*?)"$/ do |arg1| | ||
24 | + key = Key.find_by_title(arg1) | ||
25 | + page.should have_content(key.title) | ||
26 | + page.should have_content(key.key) | ||
27 | + current_path.should == key_path(key) | ||
28 | +end | ||
29 | + | ||
30 | +Then /^I should not see "(.*?)" ssh key$/ do |arg1| | ||
31 | + within "#keys-table" do | ||
32 | + page.should_not have_content(arg1) | ||
33 | + end | ||
34 | +end |
@@ -0,0 +1,51 @@ | @@ -0,0 +1,51 @@ | ||
1 | +Given /^I visit profile page$/ do | ||
2 | + visit profile_path | ||
3 | +end | ||
4 | + | ||
5 | +Then /^I should see my profile info$/ do | ||
6 | + page.should have_content "Profile" | ||
7 | + page.should have_content @user.name | ||
8 | + page.should have_content @user.email | ||
9 | +end | ||
10 | + | ||
11 | +Given /^I visit profile password page$/ do | ||
12 | + visit profile_password_path | ||
13 | +end | ||
14 | + | ||
15 | +Then /^I change my password$/ do | ||
16 | + fill_in "user_password", :with => "222333" | ||
17 | + fill_in "user_password_confirmation", :with => "222333" | ||
18 | + click_button "Save" | ||
19 | +end | ||
20 | + | ||
21 | +Then /^I should be redirected to sign in page$/ do | ||
22 | + current_path.should == new_user_session_path | ||
23 | +end | ||
24 | + | ||
25 | +Given /^I visit profile token page$/ do | ||
26 | + visit profile_token_path | ||
27 | +end | ||
28 | + | ||
29 | +Then /^I reset my token$/ do | ||
30 | + @old_token = @user.private_token | ||
31 | + click_button "Reset" | ||
32 | +end | ||
33 | + | ||
34 | +Then /^I should see new token$/ do | ||
35 | + find("#token").value.should_not == @old_token | ||
36 | + find("#token").value.should == @user.reload.private_token | ||
37 | +end | ||
38 | + | ||
39 | +Then /^I change my contact info$/ do | ||
40 | + fill_in "user_skype", :with => "testskype" | ||
41 | + fill_in "user_linkedin", :with => "testlinkedin" | ||
42 | + fill_in "user_twitter", :with => "testtwitter" | ||
43 | + click_button "Save" | ||
44 | + @user.reload | ||
45 | +end | ||
46 | + | ||
47 | +Then /^I should see new contact info$/ do | ||
48 | + @user.skype.should == 'testskype' | ||
49 | + @user.linkedin.should == 'testlinkedin' | ||
50 | + @user.twitter.should == 'testtwitter' | ||
51 | +end |
features/step_definitions/profile_keys_steps.rb
@@ -1,34 +0,0 @@ | @@ -1,34 +0,0 @@ | ||
1 | -Given /^I visit profile keys page$/ do | ||
2 | - visit keys_path | ||
3 | -end | ||
4 | - | ||
5 | -Then /^I should see my ssh keys$/ do | ||
6 | - @user.keys.each do |key| | ||
7 | - page.should have_content(key.title) | ||
8 | - end | ||
9 | -end | ||
10 | - | ||
11 | -Given /^I have ssh keys:$/ do |table| | ||
12 | - table.hashes.each do |row| | ||
13 | - Factory :key, :user => @user, :title => row[:title], :key => "jfKLJDFKSFJSHFJ#{row[:title]}" | ||
14 | - end | ||
15 | -end | ||
16 | - | ||
17 | -Given /^I submit new ssh key "(.*?)"$/ do |arg1| | ||
18 | - fill_in "key_title", :with => arg1 | ||
19 | - fill_in "key_key", :with => "publickey234=" | ||
20 | - click_button "Save" | ||
21 | -end | ||
22 | - | ||
23 | -Then /^I should see new ssh key "(.*?)"$/ do |arg1| | ||
24 | - key = Key.find_by_title(arg1) | ||
25 | - page.should have_content(key.title) | ||
26 | - page.should have_content(key.key) | ||
27 | - current_path.should == key_path(key) | ||
28 | -end | ||
29 | - | ||
30 | -Then /^I should not see "(.*?)" ssh key$/ do |arg1| | ||
31 | - within "#keys-table" do | ||
32 | - page.should_not have_content(arg1) | ||
33 | - end | ||
34 | -end |
features/step_definitions/profile_steps.rb
@@ -1,38 +0,0 @@ | @@ -1,38 +0,0 @@ | ||
1 | -Given /^I visit profile page$/ do | ||
2 | - visit profile_path | ||
3 | -end | ||
4 | - | ||
5 | -Then /^I should see my profile info$/ do | ||
6 | - page.should have_content "Profile" | ||
7 | - page.should have_content @user.name | ||
8 | - page.should have_content @user.email | ||
9 | -end | ||
10 | - | ||
11 | -Given /^I visit profile password page$/ do | ||
12 | - visit profile_password_path | ||
13 | -end | ||
14 | - | ||
15 | -Then /^I change my password$/ do | ||
16 | - fill_in "user_password", :with => "222333" | ||
17 | - fill_in "user_password_confirmation", :with => "222333" | ||
18 | - click_button "Save" | ||
19 | -end | ||
20 | - | ||
21 | -Then /^I should be redirected to sign in page$/ do | ||
22 | - current_path.should == new_user_session_path | ||
23 | -end | ||
24 | - | ||
25 | -Given /^I visit profile token page$/ do | ||
26 | - visit profile_token_path | ||
27 | -end | ||
28 | - | ||
29 | -Then /^I reset my token$/ do | ||
30 | - @old_token = @user.private_token | ||
31 | - click_button "Reset" | ||
32 | -end | ||
33 | - | ||
34 | -Then /^I should see new token$/ do | ||
35 | - find("#token").value.should_not == @old_token | ||
36 | - find("#token").value.should == @user.reload.private_token | ||
37 | -end | ||
38 | - |
@@ -0,0 +1,50 @@ | @@ -0,0 +1,50 @@ | ||
1 | +Given /^I visit project source page$/ do | ||
2 | + visit tree_project_ref_path(@project, @project.root_ref) | ||
3 | +end | ||
4 | + | ||
5 | +Then /^I should see files from repository$/ do | ||
6 | + page.should have_content("app") | ||
7 | + page.should have_content("History") | ||
8 | + page.should have_content("Gemfile") | ||
9 | +end | ||
10 | + | ||
11 | +Given /^I visit project source page for "(.*?)"$/ do |arg1| | ||
12 | + visit tree_project_ref_path(@project, arg1) | ||
13 | +end | ||
14 | + | ||
15 | +Then /^I should see files from repository for "(.*?)"$/ do |arg1| | ||
16 | + current_path.should == tree_project_ref_path(@project, arg1) | ||
17 | + page.should have_content("app") | ||
18 | + page.should have_content("History") | ||
19 | + page.should have_content("Gemfile") | ||
20 | +end | ||
21 | + | ||
22 | +Given /^I click on file from repo$/ do | ||
23 | + click_link "Gemfile" | ||
24 | +end | ||
25 | + | ||
26 | +Then /^I should see it content$/ do | ||
27 | + page.should have_content("rubygems.org") | ||
28 | +end | ||
29 | + | ||
30 | +Given /^I click on raw button$/ do | ||
31 | + click_link "raw" | ||
32 | +end | ||
33 | + | ||
34 | +Given /^I visit blob file from repo$/ do | ||
35 | + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) | ||
36 | +end | ||
37 | + | ||
38 | +Then /^I should see raw file content$/ do | ||
39 | + page.source.should == ValidCommit::BLOB_FILE | ||
40 | +end | ||
41 | + | ||
42 | +Given /^I click blame button$/ do | ||
43 | + click_link "blame" | ||
44 | +end | ||
45 | + | ||
46 | +Then /^I should see git file blame$/ do | ||
47 | + page.should have_content("rubygems.org") | ||
48 | + page.should have_content("Dmitriy Zaporozhets") | ||
49 | + page.should have_content("bc3735004cb Moving to rails 3.2") | ||
50 | +end |
features/step_definitions/project/project_commits_steps.rb
0 → 100644
@@ -0,0 +1,88 @@ | @@ -0,0 +1,88 @@ | ||
1 | +Given /^I visit project commits page$/ do | ||
2 | + visit project_commits_path(@project) | ||
3 | +end | ||
4 | + | ||
5 | +Then /^I see project commits$/ do | ||
6 | + current_path.should == project_commits_path(@project) | ||
7 | + | ||
8 | + commit = @project.commit | ||
9 | + page.should have_content(@project.name) | ||
10 | + page.should have_content(commit.message) | ||
11 | + page.should have_content(commit.id.to_s[0..5]) | ||
12 | +end | ||
13 | + | ||
14 | +Given /^I click atom feed link$/ do | ||
15 | + click_link "Feed" | ||
16 | +end | ||
17 | + | ||
18 | +Then /^I see commits atom feed$/ do | ||
19 | + commit = CommitDecorator.decorate(@project.commit) | ||
20 | + page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
21 | + page.body.should have_selector("title", :text => "Recent commits to #{@project.name}") | ||
22 | + page.body.should have_selector("author email", :text => commit.author_email) | ||
23 | + page.body.should have_selector("entry summary", :text => commit.description) | ||
24 | +end | ||
25 | + | ||
26 | +Given /^I click on commit link$/ do | ||
27 | + visit project_commit_path(@project, ValidCommit::ID) | ||
28 | +end | ||
29 | + | ||
30 | +Then /^I see commit info$/ do | ||
31 | + page.should have_content ValidCommit::MESSAGE | ||
32 | + page.should have_content "Showing 1 changed file" | ||
33 | +end | ||
34 | + | ||
35 | +Given /^I visit compare refs page$/ do | ||
36 | + visit compare_project_commits_path(@project) | ||
37 | +end | ||
38 | + | ||
39 | +Given /^I fill compare fields with refs$/ do | ||
40 | + fill_in "from", :with => "master" | ||
41 | + fill_in "to", :with => "stable" | ||
42 | + click_button "Compare" | ||
43 | +end | ||
44 | + | ||
45 | +Given /^I see compared refs$/ do | ||
46 | + page.should have_content "Commits (27)" | ||
47 | + page.should have_content "Compare View" | ||
48 | + page.should have_content "Showing 73 changed files" | ||
49 | +end | ||
50 | + | ||
51 | +Given /^I visit project branches page$/ do | ||
52 | + visit branches_project_repository_path(@project) | ||
53 | +end | ||
54 | + | ||
55 | +Given /^I visit project commit page$/ do | ||
56 | + visit project_commit_path(@project, ValidCommit::ID) | ||
57 | +end | ||
58 | + | ||
59 | +Given /^I visit project tags page$/ do | ||
60 | + visit tags_project_repository_path(@project) | ||
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
0 → 100644
@@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
1 | +Given /^project "(.*?)" have "(.*?)" open issue$/ do |arg1, arg2| | ||
2 | + project = Project.find_by_name(arg1) | ||
3 | + Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first) | ||
4 | +end | ||
5 | + | ||
6 | +Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2| | ||
7 | + project = Project.find_by_name(arg1) | ||
8 | + Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true) | ||
9 | +end | ||
10 | + | ||
11 | +Given /^I visit project "(.*?)" issues page$/ do |arg1| | ||
12 | + visit project_issues_path(Project.find_by_name(arg1)) | ||
13 | +end | ||
14 | + | ||
15 | +Given /^I should see "(.*?)" in issues$/ do |arg1| | ||
16 | + page.should have_content arg1 | ||
17 | +end | ||
18 | + | ||
19 | +Given /^I should not see "(.*?)" in issues$/ do |arg1| | ||
20 | + page.should_not have_content arg1 | ||
21 | +end | ||
22 | + | ||
23 | +Then /^I should see issue "(.*?)"$/ do |arg1| | ||
24 | + issue = Issue.find_by_title(arg1) | ||
25 | + page.should have_content issue.title | ||
26 | + page.should have_content issue.author_name | ||
27 | + page.should have_content issue.project.name | ||
28 | +end | ||
29 | + | ||
30 | +Given /^I visit issue page "(.*?)"$/ do |arg1| | ||
31 | + issue = Issue.find_by_title(arg1) | ||
32 | + visit project_issue_path(issue.project, issue) | ||
33 | +end | ||
34 | + | ||
35 | +Given /^I submit new issue "(.*?)"$/ do |arg1| | ||
36 | + fill_in "issue_title", :with => arg1 | ||
37 | + click_button "Submit new issue" | ||
38 | +end |
features/step_definitions/project/project_merge_requests_steps.rb
0 → 100644
@@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
1 | +Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2| | ||
2 | + project = Project.find_by_name(arg1) | ||
3 | + | ||
4 | + milestone = Factory :milestone, | ||
5 | + :title => arg2, | ||
6 | + :project => project | ||
7 | + | ||
8 | + 3.times do |i| | ||
9 | + issue = Factory :issue, | ||
10 | + :project => project, | ||
11 | + :milestone => milestone | ||
12 | + end | ||
13 | +end | ||
14 | + | ||
15 | +Given /^I visit project "(.*?)" milestones page$/ do |arg1| | ||
16 | + @project = Project.find_by_name(arg1) | ||
17 | + visit project_milestones_path(@project) | ||
18 | +end | ||
19 | + | ||
20 | +Then /^I should see active milestones$/ do | ||
21 | + milestone = @project.milestones.first | ||
22 | + page.should have_content(milestone.title[0..10]) | ||
23 | + page.should have_content(milestone.expires_at) | ||
24 | + page.should have_content("Browse Issues") | ||
25 | +end | ||
26 | + | ||
27 | +Then /^I should see milestone "(.*?)"$/ do |arg1| | ||
28 | + milestone = @project.milestones.find_by_title(arg1) | ||
29 | + page.should have_content(milestone.title[0..10]) | ||
30 | + page.should have_content(milestone.expires_at) | ||
31 | + page.should have_content("Browse Issues") | ||
32 | +end | ||
33 | + | ||
34 | +Given /^I submit new milestone "(.*?)"$/ do |arg1| | ||
35 | + fill_in "milestone_title", :with => arg1 | ||
36 | + click_button "Create milestone" | ||
37 | +end | ||
38 | + |
@@ -0,0 +1,63 @@ | @@ -0,0 +1,63 @@ | ||
1 | +Given /^gitlab user "(.*?)"$/ do |arg1| | ||
2 | + Factory :user, :name => arg1 | ||
3 | +end | ||
4 | + | ||
5 | +Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2| | ||
6 | + user = User.find_by_name(arg1) | ||
7 | + project = Project.find_by_name(arg2) | ||
8 | + project.add_access(user, :write) | ||
9 | +end | ||
10 | + | ||
11 | +Given /^I visit project "(.*?)" team page$/ do |arg1| | ||
12 | + visit team_project_path(Project.find_by_name(arg1)) | ||
13 | +end | ||
14 | + | ||
15 | +Then /^I should be able to see myself in team$/ do | ||
16 | + page.should have_content(@user.name) | ||
17 | + page.should have_content(@user.email) | ||
18 | +end | ||
19 | + | ||
20 | +Then /^I should see "(.*?)" in team list$/ do |arg1| | ||
21 | + user = User.find_by_name(arg1) | ||
22 | + page.should have_content(user.name) | ||
23 | + page.should have_content(user.email) | ||
24 | +end | ||
25 | + | ||
26 | +Given /^I click link "(.*?)"$/ do |arg1| | ||
27 | + click_link arg1 | ||
28 | +end | ||
29 | + | ||
30 | +Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2| | ||
31 | + user = User.find_by_name(arg1) | ||
32 | + within "#new_team_member" do | ||
33 | + select user.name, :from => "team_member_user_id" | ||
34 | + select arg2, :from => "team_member_project_access" | ||
35 | + end | ||
36 | + click_button "Save" | ||
37 | +end | ||
38 | + | ||
39 | +Then /^I should see "(.*?)" in team list as "(.*?)"$/ do |arg1, arg2| | ||
40 | + user = User.find_by_name(arg1) | ||
41 | + role_id = find(".user_#{user.id} #team_member_project_access").value | ||
42 | + role_id.should == UsersProject.access_roles[arg2].to_s | ||
43 | +end | ||
44 | + | ||
45 | +Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2| | ||
46 | + user = User.find_by_name(arg1) | ||
47 | + within ".user_#{user.id}" do | ||
48 | + select arg2, :from => "team_member_project_access" | ||
49 | + end | ||
50 | +end | ||
51 | + | ||
52 | +Then /^I should see "(.*?)" team profile$/ do |arg1| | ||
53 | + user = User.find_by_name(arg1) | ||
54 | + page.should have_content(user.name) | ||
55 | + page.should have_content(user.email) | ||
56 | + page.should have_content("To team list") | ||
57 | +end | ||
58 | + | ||
59 | +Then /^I should not see "(.*?)" in team list$/ do |arg1| | ||
60 | + user = User.find_by_name(arg1) | ||
61 | + page.should_not have_content(user.name) | ||
62 | + page.should_not have_content(user.email) | ||
63 | +end |
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +Given /^I visit project wiki page$/ do | ||
2 | + visit project_wiki_path(@project, :index) | ||
3 | +end | ||
4 | + | ||
5 | +Given /^I create Wiki page$/ do | ||
6 | + fill_in "Title", :with => 'Test title' | ||
7 | + fill_in "Content", :with => '[link test](test)' | ||
8 | + click_on "Save" | ||
9 | +end | ||
10 | + | ||
11 | +Then /^I should see newly created wiki page$/ do | ||
12 | + page.should have_content("Test title") | ||
13 | + page.should have_content("link test") | ||
14 | + | ||
15 | + click_link "link test" | ||
16 | + | ||
17 | + page.should have_content("Editing page") | ||
18 | +end |
@@ -0,0 +1,82 @@ | @@ -0,0 +1,82 @@ | ||
1 | +include LoginMacros | ||
2 | + | ||
3 | +Given /^I signin as a user$/ do | ||
4 | + login_as :user | ||
5 | +end | ||
6 | + | ||
7 | +When /^I visit new project page$/ do | ||
8 | + visit new_project_path | ||
9 | +end | ||
10 | + | ||
11 | +When /^fill project form with valid data$/ do | ||
12 | + fill_in 'project_name', :with => 'NewProject' | ||
13 | + fill_in 'project_code', :with => 'NPR' | ||
14 | + fill_in 'project_path', :with => 'newproject' | ||
15 | + click_button "Create project" | ||
16 | +end | ||
17 | + | ||
18 | +Then /^I should see project page$/ do | ||
19 | + current_path.should == project_path(Project.last) | ||
20 | + page.should have_content('NewProject') | ||
21 | +end | ||
22 | + | ||
23 | +Then /^I should see empty project instuctions$/ do | ||
24 | + page.should have_content("git init") | ||
25 | + page.should have_content("git remote") | ||
26 | + page.should have_content(Project.last.url_to_repo) | ||
27 | +end | ||
28 | + | ||
29 | +Given /^I own project "(.*?)"$/ do |arg1| | ||
30 | + @project = Factory :project, :name => arg1 | ||
31 | + @project.add_access(@user, :admin) | ||
32 | +end | ||
33 | + | ||
34 | +Given /^I visit project "(.*?)" wall page$/ do |arg1| | ||
35 | + project = Project.find_by_name(arg1) | ||
36 | + visit wall_project_path(project) | ||
37 | +end | ||
38 | + | ||
39 | +Then /^I should see project wall note "(.*?)"$/ do |arg1| | ||
40 | + page.should have_content arg1 | ||
41 | +end | ||
42 | + | ||
43 | +Given /^project "(.*?)" has comment "(.*?)"$/ do |arg1, arg2| | ||
44 | + project = Project.find_by_name(arg1) | ||
45 | + project.notes.create(:note => arg1, :author => project.users.first) | ||
46 | +end | ||
47 | + | ||
48 | +Given /^I write new comment "(.*?)"$/ do |arg1| | ||
49 | + fill_in "note_note", :with => arg1 | ||
50 | + click_button "Add Comment" | ||
51 | +end | ||
52 | + | ||
53 | +Given /^I visit project "(.*?)" page$/ do |arg1| | ||
54 | + project = Project.find_by_name(arg1) | ||
55 | + visit project_path(project) | ||
56 | +end | ||
57 | + | ||
58 | +Given /^I visit project "(.*?)" network page$/ do |arg1| | ||
59 | + project = Project.find_by_name(arg1) | ||
60 | + visit graph_project_path(project) | ||
61 | +end | ||
62 | + | ||
63 | +Given /^show me page$/ do | ||
64 | + save_and_open_page | ||
65 | +end | ||
66 | + | ||
67 | +Given /^page should have network graph$/ do | ||
68 | + page.should have_content "Project Network Graph" | ||
69 | + within ".graph" do | ||
70 | + page.should have_content "stable" | ||
71 | + page.should have_content "notes_refacto..." | ||
72 | + 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 |
features/step_definitions/project_commits_steps.rb
@@ -1,61 +0,0 @@ | @@ -1,61 +0,0 @@ | ||
1 | -Given /^I visit project commits page$/ do | ||
2 | - visit project_commits_path(@project) | ||
3 | -end | ||
4 | - | ||
5 | -Then /^I see project commits$/ do | ||
6 | - current_path.should == project_commits_path(@project) | ||
7 | - | ||
8 | - commit = @project.commit | ||
9 | - page.should have_content(@project.name) | ||
10 | - page.should have_content(commit.message) | ||
11 | - page.should have_content(commit.id.to_s[0..5]) | ||
12 | -end | ||
13 | - | ||
14 | -Given /^I click atom feed link$/ do | ||
15 | - click_link "Feed" | ||
16 | -end | ||
17 | - | ||
18 | -Then /^I see commits atom feed$/ do | ||
19 | - commit = CommitDecorator.decorate(@project.commit) | ||
20 | - page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
21 | - page.body.should have_selector("title", :text => "Recent commits to #{@project.name}") | ||
22 | - page.body.should have_selector("author email", :text => commit.author_email) | ||
23 | - page.body.should have_selector("entry summary", :text => commit.description) | ||
24 | -end | ||
25 | - | ||
26 | -Given /^I click on commit link$/ do | ||
27 | - visit project_commit_path(@project, ValidCommit::ID) | ||
28 | -end | ||
29 | - | ||
30 | -Then /^I see commit info$/ do | ||
31 | - page.should have_content ValidCommit::MESSAGE | ||
32 | - page.should have_content "Showing 1 changed file" | ||
33 | -end | ||
34 | - | ||
35 | -Given /^I visit compare refs page$/ do | ||
36 | - visit compare_project_commits_path(@project) | ||
37 | -end | ||
38 | - | ||
39 | -Given /^I fill compare fields with refs$/ do | ||
40 | - fill_in "from", :with => "master" | ||
41 | - fill_in "to", :with => "stable" | ||
42 | - click_button "Compare" | ||
43 | -end | ||
44 | - | ||
45 | -Given /^I see compared refs$/ do | ||
46 | - page.should have_content "Commits (27)" | ||
47 | - page.should have_content "Compare View" | ||
48 | - page.should have_content "Showing 73 changed files" | ||
49 | -end | ||
50 | - | ||
51 | -Given /^I visit project branches page$/ do | ||
52 | - visit branches_project_repository_path(@project) | ||
53 | -end | ||
54 | - | ||
55 | -Given /^I visit project commit page$/ do | ||
56 | - visit project_commit_path(@project, ValidCommit::ID) | ||
57 | -end | ||
58 | - | ||
59 | -Given /^I visit project tags page$/ do | ||
60 | - visit tags_project_repository_path(@project) | ||
61 | -end |
features/step_definitions/project_issues_steps.rb
@@ -1,22 +0,0 @@ | @@ -1,22 +0,0 @@ | ||
1 | -Given /^project "(.*?)" have "(.*?)" open issue$/ do |arg1, arg2| | ||
2 | - project = Project.find_by_name(arg1) | ||
3 | - Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first) | ||
4 | -end | ||
5 | - | ||
6 | -Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2| | ||
7 | - project = Project.find_by_name(arg1) | ||
8 | - Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true) | ||
9 | -end | ||
10 | - | ||
11 | -Given /^I visit project "(.*?)" issues page$/ do |arg1| | ||
12 | - visit project_issues_path(Project.find_by_name(arg1)) | ||
13 | -end | ||
14 | - | ||
15 | -Given /^I should see "(.*?)" open issue$/ do |arg1| | ||
16 | - page.should have_content arg1 | ||
17 | -end | ||
18 | - | ||
19 | -Given /^I should not see "(.*?)" closed issue$/ do |arg1| | ||
20 | - page.should_not have_content arg1 | ||
21 | -end | ||
22 | - |
features/step_definitions/project_team_steps.rb
@@ -1,63 +0,0 @@ | @@ -1,63 +0,0 @@ | ||
1 | -Given /^gitlab user "(.*?)"$/ do |arg1| | ||
2 | - Factory :user, :name => arg1 | ||
3 | -end | ||
4 | - | ||
5 | -Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2| | ||
6 | - user = User.find_by_name(arg1) | ||
7 | - project = Project.find_by_name(arg2) | ||
8 | - project.add_access(user, :write) | ||
9 | -end | ||
10 | - | ||
11 | -Given /^I visit project "(.*?)" team page$/ do |arg1| | ||
12 | - visit team_project_path(Project.find_by_name(arg1)) | ||
13 | -end | ||
14 | - | ||
15 | -Then /^I should be able to see myself in team$/ do | ||
16 | - page.should have_content(@user.name) | ||
17 | - page.should have_content(@user.email) | ||
18 | -end | ||
19 | - | ||
20 | -Then /^I should see "(.*?)" in team list$/ do |arg1| | ||
21 | - user = User.find_by_name(arg1) | ||
22 | - page.should have_content(user.name) | ||
23 | - page.should have_content(user.email) | ||
24 | -end | ||
25 | - | ||
26 | -Given /^I click link "(.*?)"$/ do |arg1| | ||
27 | - click_link arg1 | ||
28 | -end | ||
29 | - | ||
30 | -Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2| | ||
31 | - user = User.find_by_name(arg1) | ||
32 | - within "#new_team_member" do | ||
33 | - select user.name, :from => "team_member_user_id" | ||
34 | - select arg2, :from => "team_member_project_access" | ||
35 | - end | ||
36 | - click_button "Save" | ||
37 | -end | ||
38 | - | ||
39 | -Then /^I should see "(.*?)" in team list as "(.*?)"$/ do |arg1, arg2| | ||
40 | - user = User.find_by_name(arg1) | ||
41 | - role_id = find(".user_#{user.id} #team_member_project_access").value | ||
42 | - role_id.should == UsersProject.access_roles[arg2].to_s | ||
43 | -end | ||
44 | - | ||
45 | -Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2| | ||
46 | - user = User.find_by_name(arg1) | ||
47 | - within ".user_#{user.id}" do | ||
48 | - select arg2, :from => "team_member_project_access" | ||
49 | - end | ||
50 | -end | ||
51 | - | ||
52 | -Then /^I should see "(.*?)" team profile$/ do |arg1| | ||
53 | - user = User.find_by_name(arg1) | ||
54 | - page.should have_content(user.name) | ||
55 | - page.should have_content(user.email) | ||
56 | - page.should have_content("To team list") | ||
57 | -end | ||
58 | - | ||
59 | -Then /^I should not see "(.*?)" in team list$/ do |arg1| | ||
60 | - user = User.find_by_name(arg1) | ||
61 | - page.should_not have_content(user.name) | ||
62 | - page.should_not have_content(user.email) | ||
63 | -end |
features/step_definitions/project_wiki_steps.rb
@@ -1,18 +0,0 @@ | @@ -1,18 +0,0 @@ | ||
1 | -Given /^I visit project wiki page$/ do | ||
2 | - visit project_wiki_path(@project, :index) | ||
3 | -end | ||
4 | - | ||
5 | -Given /^I create Wiki page$/ do | ||
6 | - fill_in "Title", :with => 'Test title' | ||
7 | - fill_in "Content", :with => '[link test](test)' | ||
8 | - click_on "Save" | ||
9 | -end | ||
10 | - | ||
11 | -Then /^I should see newly created wiki page$/ do | ||
12 | - page.should have_content("Test title") | ||
13 | - page.should have_content("link test") | ||
14 | - | ||
15 | - click_link "link test" | ||
16 | - | ||
17 | - page.should have_content("Editing page") | ||
18 | -end |
features/step_definitions/projects_steps.rb
@@ -1,68 +0,0 @@ | @@ -1,68 +0,0 @@ | ||
1 | -include LoginMacros | ||
2 | - | ||
3 | -Given /^I signin as a user$/ do | ||
4 | - login_as :user | ||
5 | -end | ||
6 | - | ||
7 | -When /^I visit new project page$/ do | ||
8 | - visit new_project_path | ||
9 | -end | ||
10 | - | ||
11 | -When /^fill project form with valid data$/ do | ||
12 | - fill_in 'project_name', :with => 'NewProject' | ||
13 | - fill_in 'project_code', :with => 'NPR' | ||
14 | - fill_in 'project_path', :with => 'newproject' | ||
15 | - click_button "Create project" | ||
16 | -end | ||
17 | - | ||
18 | -Then /^I should see project page$/ do | ||
19 | - current_path.should == project_path(Project.last) | ||
20 | - page.should have_content('NewProject') | ||
21 | -end | ||
22 | - | ||
23 | -Then /^I should see empty project instuctions$/ do | ||
24 | - page.should have_content("git init") | ||
25 | - page.should have_content("git remote") | ||
26 | - page.should have_content(Project.last.url_to_repo) | ||
27 | -end | ||
28 | - | ||
29 | -Given /^I own project "(.*?)"$/ do |arg1| | ||
30 | - @project = Factory :project, :name => arg1 | ||
31 | - @project.add_access(@user, :admin) | ||
32 | -end | ||
33 | - | ||
34 | -Given /^I visit project "(.*?)" wall page$/ do |arg1| | ||
35 | - project = Project.find_by_name(arg1) | ||
36 | - visit wall_project_path(project) | ||
37 | -end | ||
38 | - | ||
39 | -Then /^I should see project wall note "(.*?)"$/ do |arg1| | ||
40 | - page.should have_content arg1 | ||
41 | -end | ||
42 | - | ||
43 | -Given /^project "(.*?)" has comment "(.*?)"$/ do |arg1, arg2| | ||
44 | - project = Project.find_by_name(arg1) | ||
45 | - project.notes.create(:note => arg1, :author => project.users.first) | ||
46 | -end | ||
47 | - | ||
48 | -Given /^I write new comment "(.*?)"$/ do |arg1| | ||
49 | - fill_in "note_note", :with => arg1 | ||
50 | - click_button "Add Comment" | ||
51 | -end | ||
52 | - | ||
53 | -Given /^I visit project "(.*?)" network page$/ do |arg1| | ||
54 | - project = Project.find_by_name(arg1) | ||
55 | - visit graph_project_path(project) | ||
56 | -end | ||
57 | - | ||
58 | -Given /^show me page$/ do | ||
59 | - save_and_open_page | ||
60 | -end | ||
61 | - | ||
62 | -Given /^page should have network graph$/ do | ||
63 | - page.should have_content "Project Network Graph" | ||
64 | - within ".graph" do | ||
65 | - page.should have_content "stable" | ||
66 | - page.should have_content "notes_refacto..." | ||
67 | - end | ||
68 | -end |
lib/tasks/gitlab/status.rake
@@ -49,7 +49,7 @@ namespace :gitlab do | @@ -49,7 +49,7 @@ namespace :gitlab do | ||
49 | end | 49 | end |
50 | 50 | ||
51 | print "UMASK for .gitolite.rc is 0007? ............" | 51 | print "UMASK for .gitolite.rc is 0007? ............" |
52 | - unless open("#{git_base_path}/../.gitolite.rc").grep(/REPO_UMASK = 0007/).empty? | 52 | + unless open("#{git_base_path}/../.gitolite.rc").grep(/UMASK([ \t]*)=([ \t>]*)0007/).empty? |
53 | puts "YES".green | 53 | puts "YES".green |
54 | else | 54 | else |
55 | puts "NO".red | 55 | puts "NO".red |
spec/models/protected_branch_spec.rb
@@ -37,19 +37,6 @@ describe ProtectedBranch do | @@ -37,19 +37,6 @@ describe ProtectedBranch do | ||
37 | end | 37 | end |
38 | end | 38 | end |
39 | 39 | ||
40 | - describe '#update_repository' do | ||
41 | - let(:gitolite) { mock } | ||
42 | - | ||
43 | - subject { ProtectedBranch.new(:project => project) } | ||
44 | - | ||
45 | - it "updates the branch's project repo permissions" do | ||
46 | - Gitlab::GitHost.should_receive(:system).and_return(gitolite) | ||
47 | - gitolite.should_receive(:update_project).with(project.path, project) | ||
48 | - | ||
49 | - subject.update_repository | ||
50 | - end | ||
51 | - end | ||
52 | - | ||
53 | describe '#commit' do | 40 | describe '#commit' do |
54 | subject { ProtectedBranch.new(:project => project, :name => 'cant_touch_this') } | 41 | subject { ProtectedBranch.new(:project => project, :name => 'cant_touch_this') } |
55 | 42 |
spec/monkeypatch.rb
@@ -0,0 +1,47 @@ | @@ -0,0 +1,47 @@ | ||
1 | +require 'spec_helper' | ||
2 | + | ||
3 | +describe "User Issues Dashboard" do | ||
4 | + describe "GET /issues" do | ||
5 | + before do | ||
6 | + | ||
7 | + login_as :user | ||
8 | + | ||
9 | + @project1 = Factory :project, | ||
10 | + :path => "project1", | ||
11 | + :code => "TEST1" | ||
12 | + | ||
13 | + @project2 = Factory :project, | ||
14 | + :path => "project2", | ||
15 | + :code => "TEST2" | ||
16 | + | ||
17 | + @project1.add_access(@user, :read, :write) | ||
18 | + @project2.add_access(@user, :read, :write) | ||
19 | + | ||
20 | + @issue1 = Factory :issue, | ||
21 | + :author => @user, | ||
22 | + :assignee => @user, | ||
23 | + :project => @project1 | ||
24 | + | ||
25 | + @issue2 = Factory :issue, | ||
26 | + :author => @user, | ||
27 | + :assignee => @user, | ||
28 | + :project => @project2 | ||
29 | + | ||
30 | + visit dashboard_issues_path | ||
31 | + end | ||
32 | + | ||
33 | + describe "atom feed", :js => false do | ||
34 | + it "should render atom feed via private token" do | ||
35 | + logout | ||
36 | + visit dashboard_issues_path(:atom, :private_token => @user.private_token) | ||
37 | + | ||
38 | + page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
39 | + page.body.should have_selector("title", :text => "#{@user.name} issues") | ||
40 | + page.body.should have_selector("author email", :text => @issue1.author_email) | ||
41 | + page.body.should have_selector("entry summary", :text => @issue1.title) | ||
42 | + page.body.should have_selector("author email", :text => @issue2.author_email) | ||
43 | + page.body.should have_selector("entry summary", :text => @issue2.title) | ||
44 | + end | ||
45 | + end | ||
46 | + end | ||
47 | +end |
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +require 'spec_helper' | ||
2 | + | ||
3 | +describe "User Dashboard" do | ||
4 | + before { login_as :user } | ||
5 | + | ||
6 | + describe "GET /" do | ||
7 | + before do | ||
8 | + @project = Factory :project, :owner => @user | ||
9 | + @project.add_access(@user, :read) | ||
10 | + visit dashboard_path | ||
11 | + end | ||
12 | + | ||
13 | + it "should render projects atom feed via private token" do | ||
14 | + logout | ||
15 | + | ||
16 | + visit dashboard_path(:atom, :private_token => @user.private_token) | ||
17 | + page.body.should have_selector("feed title") | ||
18 | + end | ||
19 | + | ||
20 | + it "should not render projects page via private token" do | ||
21 | + logout | ||
22 | + | ||
23 | + visit dashboard_path(:private_token => @user.private_token) | ||
24 | + current_path.should == new_user_session_path | ||
25 | + end | ||
26 | + end | ||
27 | +end |
@@ -0,0 +1,40 @@ | @@ -0,0 +1,40 @@ | ||
1 | +require 'spec_helper' | ||
2 | + | ||
3 | +describe "Issues" 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 "GET /issues" do | ||
12 | + before do | ||
13 | + @issue = Factory :issue, | ||
14 | + :author => @user, | ||
15 | + :assignee => @user, | ||
16 | + :project => project | ||
17 | + | ||
18 | + visit project_issues_path(project) | ||
19 | + end | ||
20 | + | ||
21 | + it "should render atom feed" do | ||
22 | + visit project_issues_path(project, :atom) | ||
23 | + | ||
24 | + page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
25 | + page.body.should have_selector("title", :text => "#{project.name} issues") | ||
26 | + page.body.should have_selector("author email", :text => @issue.author_email) | ||
27 | + page.body.should have_selector("entry summary", :text => @issue.title) | ||
28 | + end | ||
29 | + | ||
30 | + it "should render atom feed via private token" do | ||
31 | + logout | ||
32 | + visit project_issues_path(project, :atom, :private_token => @user.private_token) | ||
33 | + | ||
34 | + page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
35 | + page.body.should have_selector("title", :text => "#{project.name} issues") | ||
36 | + page.body.should have_selector("author email", :text => @issue.author_email) | ||
37 | + page.body.should have_selector("entry summary", :text => @issue.title) | ||
38 | + end | ||
39 | + end | ||
40 | +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/commits_spec.rb
@@ -1,68 +0,0 @@ | @@ -1,68 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Commits" do | ||
4 | - let(:project) { Factory :project } | ||
5 | - let!(:commit) { CommitDecorator.decorate(project.commit) } | ||
6 | - before do | ||
7 | - login_as :user | ||
8 | - project.add_access(@user, :read) | ||
9 | - end | ||
10 | - | ||
11 | - describe "GET /commits" do | ||
12 | - before do | ||
13 | - visit project_commits_path(project) | ||
14 | - end | ||
15 | - | ||
16 | - it "should have valid path" do | ||
17 | - current_path.should == project_commits_path(project) | ||
18 | - end | ||
19 | - | ||
20 | - it "should have project name" do | ||
21 | - page.should have_content(project.name) | ||
22 | - end | ||
23 | - | ||
24 | - it "should list commits" do | ||
25 | - page.should have_content(commit.description) | ||
26 | - page.should have_content(commit.short_id(8)) | ||
27 | - end | ||
28 | - | ||
29 | - it "should render atom feed" do | ||
30 | - visit project_commits_path(project, :atom) | ||
31 | - | ||
32 | - page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
33 | - page.body.should have_selector("title", :text => "Recent commits to #{project.name}") | ||
34 | - page.body.should have_selector("author email", :text => commit.author_email) | ||
35 | - page.body.should have_selector("entry summary", :text => commit.description) | ||
36 | - end | ||
37 | - | ||
38 | - it "should render atom feed via private token" do | ||
39 | - logout | ||
40 | - visit project_commits_path(project, :atom, :private_token => @user.private_token) | ||
41 | - | ||
42 | - page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
43 | - page.body.should have_selector("title", :text => "Recent commits to #{project.name}") | ||
44 | - page.body.should have_selector("author email", :text => commit.author_email) | ||
45 | - page.body.should have_selector("entry summary", :text => commit.description) | ||
46 | - end | ||
47 | - end | ||
48 | - | ||
49 | - describe "GET /commits/:id" do | ||
50 | - before do | ||
51 | - visit project_commit_path(project, commit.id) | ||
52 | - end | ||
53 | - | ||
54 | - it "should have valid path" do | ||
55 | - current_path.should == project_commit_path(project, commit.id) | ||
56 | - end | ||
57 | - end | ||
58 | - | ||
59 | - describe "GET /commits/compare" do | ||
60 | - before do | ||
61 | - visit compare_project_commits_path(project) | ||
62 | - end | ||
63 | - | ||
64 | - it "should have valid path" do | ||
65 | - current_path.should == compare_project_commits_path(project) | ||
66 | - end | ||
67 | - end | ||
68 | -end |
spec/requests/dashboard_issues_spec.rb
@@ -1,55 +0,0 @@ | @@ -1,55 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "User Issues Dashboard" do | ||
4 | - describe "GET /issues" do | ||
5 | - before do | ||
6 | - | ||
7 | - login_as :user | ||
8 | - | ||
9 | - @project1 = Factory :project, | ||
10 | - :path => "project1", | ||
11 | - :code => "TEST1" | ||
12 | - | ||
13 | - @project2 = Factory :project, | ||
14 | - :path => "project2", | ||
15 | - :code => "TEST2" | ||
16 | - | ||
17 | - @project1.add_access(@user, :read, :write) | ||
18 | - @project2.add_access(@user, :read, :write) | ||
19 | - | ||
20 | - @issue1 = Factory :issue, | ||
21 | - :author => @user, | ||
22 | - :assignee => @user, | ||
23 | - :project => @project1 | ||
24 | - | ||
25 | - @issue2 = Factory :issue, | ||
26 | - :author => @user, | ||
27 | - :assignee => @user, | ||
28 | - :project => @project2 | ||
29 | - | ||
30 | - visit dashboard_issues_path | ||
31 | - end | ||
32 | - | ||
33 | - subject { page } | ||
34 | - | ||
35 | - it { should have_content(@issue1.title[0..10]) } | ||
36 | - it { should have_content(@issue1.project.name) } | ||
37 | - | ||
38 | - it { should have_content(@issue2.title[0..10]) } | ||
39 | - it { should have_content(@issue2.project.name) } | ||
40 | - | ||
41 | - describe "atom feed", :js => false do | ||
42 | - it "should render atom feed via private token" do | ||
43 | - logout | ||
44 | - visit dashboard_issues_path(:atom, :private_token => @user.private_token) | ||
45 | - | ||
46 | - page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
47 | - page.body.should have_selector("title", :text => "#{@user.name} issues") | ||
48 | - page.body.should have_selector("author email", :text => @issue1.author_email) | ||
49 | - page.body.should have_selector("entry summary", :text => @issue1.title) | ||
50 | - page.body.should have_selector("author email", :text => @issue2.author_email) | ||
51 | - page.body.should have_selector("entry summary", :text => @issue2.title) | ||
52 | - end | ||
53 | - end | ||
54 | - end | ||
55 | -end |
spec/requests/dashboard_merge_requests_spec.rb
@@ -1,40 +0,0 @@ | @@ -1,40 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "User MergeRequests" do | ||
4 | - describe "GET /issues" do | ||
5 | - before do | ||
6 | - | ||
7 | - login_as :user | ||
8 | - | ||
9 | - @project1 = Factory :project, | ||
10 | - :path => "project1", | ||
11 | - :code => "TEST1" | ||
12 | - | ||
13 | - @project2 = Factory :project, | ||
14 | - :path => "project2", | ||
15 | - :code => "TEST2" | ||
16 | - | ||
17 | - @project1.add_access(@user, :read, :write) | ||
18 | - @project2.add_access(@user, :read, :write) | ||
19 | - | ||
20 | - @merge_request1 = Factory :merge_request, | ||
21 | - :author => @user, | ||
22 | - :assignee => @user, | ||
23 | - :project => @project1 | ||
24 | - | ||
25 | - @merge_request2 = Factory :merge_request, | ||
26 | - :author => @user, | ||
27 | - :assignee => @user, | ||
28 | - :project => @project2 | ||
29 | - | ||
30 | - visit dashboard_merge_requests_path | ||
31 | - end | ||
32 | - | ||
33 | - subject { page } | ||
34 | - | ||
35 | - it { should have_content(@merge_request1.title[0..10]) } | ||
36 | - it { should have_content(@merge_request1.project.name) } | ||
37 | - it { should have_content(@merge_request2.title[0..10]) } | ||
38 | - it { should have_content(@merge_request2.project.name) } | ||
39 | - end | ||
40 | -end |
spec/requests/dashboard_spec.rb
@@ -1,39 +0,0 @@ | @@ -1,39 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "User Dashboard" do | ||
4 | - before { login_as :user } | ||
5 | - | ||
6 | - describe "GET /" do | ||
7 | - before do | ||
8 | - @project = Factory :project, :owner => @user | ||
9 | - @project.add_access(@user, :read) | ||
10 | - visit dashboard_path | ||
11 | - end | ||
12 | - | ||
13 | - it "should be on projects page" do | ||
14 | - current_path.should == dashboard_path | ||
15 | - end | ||
16 | - | ||
17 | - it "should have link to new project" do | ||
18 | - page.should have_content("New Project") | ||
19 | - end | ||
20 | - | ||
21 | - it "should have project" do | ||
22 | - page.should have_content(@project.name) | ||
23 | - end | ||
24 | - | ||
25 | - it "should render projects atom feed via private token" do | ||
26 | - logout | ||
27 | - | ||
28 | - visit dashboard_path(:atom, :private_token => @user.private_token) | ||
29 | - page.body.should have_selector("feed title") | ||
30 | - end | ||
31 | - | ||
32 | - it "should not render projects page via private token" do | ||
33 | - logout | ||
34 | - | ||
35 | - visit dashboard_path(:private_token => @user.private_token) | ||
36 | - current_path.should == new_user_session_path | ||
37 | - end | ||
38 | - end | ||
39 | -end |
spec/requests/file_blame_spec.rb
@@ -1,25 +0,0 @@ | @@ -1,25 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Blame file" do | ||
4 | - before { login_as :user } | ||
5 | - | ||
6 | - describe "GET /:projectname/:commit/blob/Gemfile" do | ||
7 | - before do | ||
8 | - @project = Factory :project | ||
9 | - @project.add_access(@user, :read) | ||
10 | - | ||
11 | - visit tree_project_ref_path(@project, @project.root_ref, :path => "Gemfile") | ||
12 | - click_link "blame" | ||
13 | - end | ||
14 | - | ||
15 | - it "should be correct path" do | ||
16 | - current_path.should == blame_file_project_ref_path(@project, @project.root_ref, :path => "Gemfile") | ||
17 | - end | ||
18 | - | ||
19 | - it "should contain file view" do | ||
20 | - page.should have_content("rubygems.org") | ||
21 | - page.should have_content("Dmitriy Zaporozhets") | ||
22 | - page.should have_content("bc3735004cb Moving to rails 3.2") | ||
23 | - end | ||
24 | - end | ||
25 | -end |
spec/requests/issues_notes_spec.rb
@@ -1,27 +0,0 @@ | @@ -1,27 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Issues" do | ||
4 | - let(:project) { Factory :project } | ||
5 | - | ||
6 | - before do | ||
7 | - login_as :user | ||
8 | - project.add_access(@user, :read, :write) | ||
9 | - | ||
10 | - @issue = Factory :issue, | ||
11 | - :author => @user, | ||
12 | - :assignee => @user, | ||
13 | - :project => project | ||
14 | - end | ||
15 | - | ||
16 | - describe "add new note", :js => true do | ||
17 | - before do | ||
18 | - visit project_issue_path(project, @issue) | ||
19 | - fill_in "note_note", :with => "I commented this issue" | ||
20 | - click_button "Add Comment" | ||
21 | - end | ||
22 | - | ||
23 | - it "should conatin new note" do | ||
24 | - page.should have_content("I commented this issue") | ||
25 | - end | ||
26 | - end | ||
27 | -end |
spec/requests/issues_spec.rb
@@ -11,161 +11,6 @@ describe "Issues" do | @@ -11,161 +11,6 @@ describe "Issues" do | ||
11 | project.add_access(@user2, :read, :write) | 11 | project.add_access(@user2, :read, :write) |
12 | end | 12 | end |
13 | 13 | ||
14 | - describe "GET /issues" do | ||
15 | - before do | ||
16 | - @issue = Factory :issue, | ||
17 | - :author => @user, | ||
18 | - :assignee => @user, | ||
19 | - :project => project | ||
20 | - | ||
21 | - visit project_issues_path(project) | ||
22 | - end | ||
23 | - | ||
24 | - subject { page } | ||
25 | - | ||
26 | - it { should have_content(@issue.title[0..20]) } | ||
27 | - it { should have_content(@issue.project.name) } | ||
28 | - it { should have_content(@issue.assignee.name) } | ||
29 | - | ||
30 | - it "should render atom feed" do | ||
31 | - visit project_issues_path(project, :atom) | ||
32 | - | ||
33 | - page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
34 | - page.body.should have_selector("title", :text => "#{project.name} issues") | ||
35 | - page.body.should have_selector("author email", :text => @issue.author_email) | ||
36 | - page.body.should have_selector("entry summary", :text => @issue.title) | ||
37 | - end | ||
38 | - | ||
39 | - it "should render atom feed via private token" do | ||
40 | - logout | ||
41 | - visit project_issues_path(project, :atom, :private_token => @user.private_token) | ||
42 | - | ||
43 | - page.response_headers['Content-Type'].should have_content("application/atom+xml") | ||
44 | - page.body.should have_selector("title", :text => "#{project.name} issues") | ||
45 | - page.body.should have_selector("author email", :text => @issue.author_email) | ||
46 | - page.body.should have_selector("entry summary", :text => @issue.title) | ||
47 | - end | ||
48 | - | ||
49 | - describe "statuses" do | ||
50 | - before do | ||
51 | - @closed_issue = Factory :issue, | ||
52 | - :author => @user, | ||
53 | - :assignee => @user, | ||
54 | - :project => project, | ||
55 | - :closed => true | ||
56 | - end | ||
57 | - | ||
58 | - it "should show only open" do | ||
59 | - should have_content(@issue.title[0..25]) | ||
60 | - should have_no_content(@closed_issue.title) | ||
61 | - end | ||
62 | - | ||
63 | - it "should show only closed" do | ||
64 | - click_link "Closed" | ||
65 | - should have_no_content(@issue.title) | ||
66 | - should have_content(@closed_issue.title[0..25]) | ||
67 | - end | ||
68 | - | ||
69 | - it "should show all" do | ||
70 | - click_link "All" | ||
71 | - should have_content(@issue.title[0..25]) | ||
72 | - should have_content(@closed_issue.title[0..25]) | ||
73 | - end | ||
74 | - end | ||
75 | - end | ||
76 | - | ||
77 | - describe "New issue", :js => true do | ||
78 | - before do | ||
79 | - visit project_issues_path(project) | ||
80 | - click_link "New Issue" | ||
81 | - end | ||
82 | - | ||
83 | - it "should open new issue form" do | ||
84 | - page.should have_content("New Issue") | ||
85 | - end | ||
86 | - | ||
87 | - describe "fill in" do | ||
88 | - describe 'assign to me' do | ||
89 | - before do | ||
90 | - fill_in "issue_title", :with => "bug 345" | ||
91 | - page.execute_script("$('#issue_assignee_id').show();") | ||
92 | - select @user.name, :from => "issue_assignee_id" | ||
93 | - end | ||
94 | - | ||
95 | - it { expect { click_button "Submit new issue" }.to change {Issue.count}.by(1) } | ||
96 | - | ||
97 | - it "should add new issue to table" do | ||
98 | - click_button "Submit new issue" | ||
99 | - | ||
100 | - page.should_not have_content("Add new issue") | ||
101 | - page.should have_content @user.name | ||
102 | - page.should have_content "bug 345" | ||
103 | - page.should have_content project.name | ||
104 | - end | ||
105 | - | ||
106 | - it "should call send mail" do | ||
107 | - Notify.should_not_receive(:new_issue_email) | ||
108 | - click_button "Submit new issue" | ||
109 | - end | ||
110 | - end | ||
111 | - | ||
112 | - describe 'assign to other' do | ||
113 | - before do | ||
114 | - fill_in "issue_title", :with => "bug 345" | ||
115 | - page.execute_script("$('#issue_assignee_id').show();") | ||
116 | - select @user2.name, :from => "issue_assignee_id" | ||
117 | - end | ||
118 | - | ||
119 | - it { expect { click_button "Submit new issue" }.to change {Issue.count}.by(1) } | ||
120 | - | ||
121 | - it "should add new issue to table" do | ||
122 | - click_button "Submit new issue" | ||
123 | - | ||
124 | - page.should_not have_content("Add new issue") | ||
125 | - page.should have_content @user2.name | ||
126 | - page.should have_content "bug 345" | ||
127 | - page.should have_content project.name | ||
128 | - end | ||
129 | - | ||
130 | - it "should call send mail" do | ||
131 | - Issue.observers.enable :issue_observer do | ||
132 | - Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true)) | ||
133 | - click_button "Submit new issue" | ||
134 | - end | ||
135 | - end | ||
136 | - | ||
137 | - it "should send valid email to user" do | ||
138 | - Issue.observers.enable :issue_observer do | ||
139 | - with_resque do | ||
140 | - click_button "Submit new issue" | ||
141 | - end | ||
142 | - issue = Issue.last | ||
143 | - email = ActionMailer::Base.deliveries.last | ||
144 | - email.subject.should have_content("New Issue was created") | ||
145 | - email.body.should have_content(issue.title) | ||
146 | - end | ||
147 | - end | ||
148 | - | ||
149 | - end | ||
150 | - end | ||
151 | - end | ||
152 | - | ||
153 | - describe "Show issue" do | ||
154 | - before do | ||
155 | - @issue = Factory :issue, | ||
156 | - :author => @user, | ||
157 | - :assignee => @user, | ||
158 | - :project => project | ||
159 | - | ||
160 | - visit project_issue_path(project, @issue) | ||
161 | - end | ||
162 | - | ||
163 | - it "should have valid show page for issue" do | ||
164 | - page.should have_content @issue.title | ||
165 | - page.should have_content @user.name | ||
166 | - end | ||
167 | - end | ||
168 | - | ||
169 | describe "Edit issue", :js => true do | 14 | describe "Edit issue", :js => true do |
170 | before do | 15 | before do |
171 | @issue = Factory :issue, | 16 | @issue = Factory :issue, |
spec/requests/keys_spec.rb
@@ -1,65 +0,0 @@ | @@ -1,65 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Issues" do | ||
4 | - before do | ||
5 | - login_as :user | ||
6 | - end | ||
7 | - | ||
8 | - describe "GET /keys" do | ||
9 | - before do | ||
10 | - @key = Factory :key, :user => @user | ||
11 | - visit keys_path | ||
12 | - end | ||
13 | - | ||
14 | - subject { page } | ||
15 | - | ||
16 | - it { should have_content(@key.title) } | ||
17 | - | ||
18 | - describe "Destroy" do | ||
19 | - before { visit key_path(@key) } | ||
20 | - | ||
21 | - it "should remove entry" do | ||
22 | - expect { | ||
23 | - click_link "Remove" | ||
24 | - }.to change { @user.keys.count }.by(-1) | ||
25 | - end | ||
26 | - end | ||
27 | - end | ||
28 | - | ||
29 | - describe "New key" do | ||
30 | - before do | ||
31 | - visit keys_path | ||
32 | - click_link "Add new" | ||
33 | - end | ||
34 | - | ||
35 | - it "should open new key popup" do | ||
36 | - page.should have_content("New key") | ||
37 | - end | ||
38 | - | ||
39 | - describe "fill in" do | ||
40 | - before do | ||
41 | - fill_in "key_title", :with => "laptop" | ||
42 | - fill_in "key_key", :with => "publickey234=" | ||
43 | - end | ||
44 | - | ||
45 | - it { expect { click_button "Save" }.to change {Key.count}.by(1) } | ||
46 | - | ||
47 | - it "should add new key to table" do | ||
48 | - click_button "Save" | ||
49 | - | ||
50 | - page.should_not have_content("New key") | ||
51 | - page.should have_content "laptop" | ||
52 | - end | ||
53 | - end | ||
54 | - end | ||
55 | - | ||
56 | - describe "Show page" do | ||
57 | - before do | ||
58 | - @key = Factory :key, :user => @user | ||
59 | - visit key_path(@key) | ||
60 | - end | ||
61 | - | ||
62 | - it { page.should have_content @key.title } | ||
63 | - it { page.should have_content @key.key[0..10] } | ||
64 | - end | ||
65 | -end |
spec/requests/last_push_widget_spec.rb
@@ -1,52 +0,0 @@ | @@ -1,52 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Last Push widget" do | ||
4 | - before { login_as :user } | ||
5 | - | ||
6 | - before do | ||
7 | - @project = Factory :project, :owner => @user | ||
8 | - @project.add_access(@user, :read) | ||
9 | - create_push_event | ||
10 | - visit dashboard_path | ||
11 | - end | ||
12 | - | ||
13 | - it "should display last push widget with link to merge request page" do | ||
14 | - page.should have_content "Your pushed to branch new_design" | ||
15 | - page.should have_link "Create Merge Request" | ||
16 | - end | ||
17 | - | ||
18 | - describe "click create MR" do | ||
19 | - before { click_link "Create Merge Request" } | ||
20 | - | ||
21 | - it { current_path.should == new_project_merge_request_path(@project) } | ||
22 | - it { find("#merge_request_source_branch").value.should == "new_design" } | ||
23 | - it { find("#merge_request_target_branch").value.should == "master" } | ||
24 | - it { find("#merge_request_title").value.should == "New Design" } | ||
25 | - end | ||
26 | - | ||
27 | - | ||
28 | - def create_push_event | ||
29 | - data = { | ||
30 | - :before => "0000000000000000000000000000000000000000", | ||
31 | - :after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", | ||
32 | - :ref => "refs/heads/new_design", | ||
33 | - :user_id => @user.id, | ||
34 | - :user_name => @user.name, | ||
35 | - :repository => { | ||
36 | - :name => @project.name, | ||
37 | - :url => "localhost/rubinius", | ||
38 | - :description => "", | ||
39 | - :homepage => "localhost/rubinius", | ||
40 | - :private => true | ||
41 | - } | ||
42 | - } | ||
43 | - | ||
44 | - @event = Event.create( | ||
45 | - :project => @project, | ||
46 | - :action => Event::Pushed, | ||
47 | - :data => data, | ||
48 | - :author_id => @user.id | ||
49 | - ) | ||
50 | - end | ||
51 | -end | ||
52 | - |
spec/requests/milestones_spec.rb
@@ -1,51 +0,0 @@ | @@ -1,51 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Milestones" do | ||
4 | - let(:project) { Factory :project } | ||
5 | - | ||
6 | - before do | ||
7 | - login_as :user | ||
8 | - project.add_access(@user, :admin) | ||
9 | - | ||
10 | - @milestone = Factory :milestone, :project => project | ||
11 | - @issue = Factory :issue, :project => project | ||
12 | - | ||
13 | - @milestone.issues << @issue | ||
14 | - end | ||
15 | - | ||
16 | - describe "GET /milestones" do | ||
17 | - before do | ||
18 | - visit project_milestones_path(project) | ||
19 | - end | ||
20 | - | ||
21 | - subject { page } | ||
22 | - | ||
23 | - it { should have_content(@milestone.title[0..10]) } | ||
24 | - it { should have_content(@milestone.expires_at) } | ||
25 | - it { should have_content("Browse Issues") } | ||
26 | - end | ||
27 | - | ||
28 | - describe "GET /milestone/:id" do | ||
29 | - before do | ||
30 | - visit project_milestone_path(project, @milestone) | ||
31 | - end | ||
32 | - | ||
33 | - subject { page } | ||
34 | - | ||
35 | - it { should have_content(@milestone.title[0..10]) } | ||
36 | - it { should have_content(@milestone.expires_at) } | ||
37 | - it { should have_content("Browse Issues") } | ||
38 | - end | ||
39 | - | ||
40 | - describe "GET /milestones/new" do | ||
41 | - before do | ||
42 | - visit new_project_milestone_path(project) | ||
43 | - fill_in "milestone_title", :with => "v2.3" | ||
44 | - click_button "Create milestone" | ||
45 | - end | ||
46 | - | ||
47 | - it { current_path.should == project_milestone_path(project, project.milestones.last) } | ||
48 | - it { page.should have_content(project.milestones.last.title[0..10]) } | ||
49 | - it { page.should have_content(project.milestones.last.expires_at) } | ||
50 | - end | ||
51 | -end |
spec/requests/profile_spec.rb
@@ -1,82 +0,0 @@ | @@ -1,82 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Profile" do | ||
4 | - before do | ||
5 | - login_as :user | ||
6 | - end | ||
7 | - | ||
8 | - describe "Show profile" do | ||
9 | - before do | ||
10 | - visit profile_path | ||
11 | - end | ||
12 | - | ||
13 | - it { page.should have_content(@user.name) } | ||
14 | - end | ||
15 | - | ||
16 | - describe "Profile update" do | ||
17 | - before do | ||
18 | - visit profile_path | ||
19 | - fill_in "user_skype", :with => "testskype" | ||
20 | - fill_in "user_linkedin", :with => "testlinkedin" | ||
21 | - fill_in "user_twitter", :with => "testtwitter" | ||
22 | - click_button "Save" | ||
23 | - @user.reload | ||
24 | - end | ||
25 | - | ||
26 | - it { @user.skype.should == 'testskype' } | ||
27 | - it { @user.linkedin.should == 'testlinkedin' } | ||
28 | - it { @user.twitter.should == 'testtwitter' } | ||
29 | - end | ||
30 | - | ||
31 | - describe "Reset private token" do | ||
32 | - before do | ||
33 | - visit profile_token_path | ||
34 | - end | ||
35 | - | ||
36 | - it "should reset private token" do | ||
37 | - user_first_token = @user.private_token | ||
38 | - click_button "Reset" | ||
39 | - @user.reload | ||
40 | - @user.private_token.should_not == user_first_token | ||
41 | - end | ||
42 | - end | ||
43 | - | ||
44 | - describe "Password update" do | ||
45 | - before do | ||
46 | - visit profile_password_path | ||
47 | - end | ||
48 | - | ||
49 | - it { page.should have_content("Password") } | ||
50 | - it { page.should have_content("Password confirmation") } | ||
51 | - | ||
52 | - describe "change password" do | ||
53 | - before do | ||
54 | - @old_pwd = @user.encrypted_password | ||
55 | - fill_in "user_password", :with => "777777" | ||
56 | - fill_in "user_password_confirmation", :with => "777777" | ||
57 | - click_button "Save" | ||
58 | - @user.reload | ||
59 | - end | ||
60 | - | ||
61 | - it "should redirect to signin page" do | ||
62 | - current_path.should == new_user_session_path | ||
63 | - end | ||
64 | - | ||
65 | - it "should change password" do | ||
66 | - @user.encrypted_password.should_not == @old_pwd | ||
67 | - end | ||
68 | - | ||
69 | - describe "login with new password" do | ||
70 | - before do | ||
71 | - fill_in "user_email", :with => @user.email | ||
72 | - fill_in "user_password", :with => "777777" | ||
73 | - click_button "Sign in" | ||
74 | - end | ||
75 | - | ||
76 | - it "should login user" do | ||
77 | - current_path.should == root_path | ||
78 | - end | ||
79 | - end | ||
80 | - end | ||
81 | - end | ||
82 | -end |
spec/requests/projects_security_spec.rb
@@ -1,187 +0,0 @@ | @@ -1,187 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Projects Security" 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/projects_spec.rb
@@ -3,47 +3,6 @@ require 'spec_helper' | @@ -3,47 +3,6 @@ require 'spec_helper' | ||
3 | describe "Projects" do | 3 | describe "Projects" do |
4 | before { login_as :user } | 4 | before { login_as :user } |
5 | 5 | ||
6 | - describe "GET /projects/new" do | ||
7 | - before do | ||
8 | - visit root_path | ||
9 | - click_link "New Project" | ||
10 | - end | ||
11 | - | ||
12 | - it "should be correct path" do | ||
13 | - current_path.should == new_project_path | ||
14 | - end | ||
15 | - | ||
16 | - it "should have labels for new project" do | ||
17 | - page.should have_content("Project name is") | ||
18 | - end | ||
19 | - end | ||
20 | - | ||
21 | - describe "POST /projects" do | ||
22 | - before do | ||
23 | - visit new_project_path | ||
24 | - fill_in 'project_name', :with => 'NewProject' | ||
25 | - fill_in 'project_code', :with => 'NPR' | ||
26 | - fill_in 'project_path', :with => 'newproject' | ||
27 | - expect { click_button "Create project" }.to change { Project.count }.by(1) | ||
28 | - @project = Project.last | ||
29 | - end | ||
30 | - | ||
31 | - it "should be correct path" do | ||
32 | - current_path.should == project_path(@project) | ||
33 | - end | ||
34 | - | ||
35 | - it "should show project" do | ||
36 | - page.should have_content(@project.name) | ||
37 | - page.should have_content(@project.path) | ||
38 | - page.should have_content(@project.description) | ||
39 | - end | ||
40 | - | ||
41 | - it "should init repo instructions" do | ||
42 | - page.should have_content("git remote") | ||
43 | - page.should have_content(@project.url_to_repo) | ||
44 | - end | ||
45 | - end | ||
46 | - | ||
47 | describe "GET /projects/show" do | 6 | describe "GET /projects/show" do |
48 | before do | 7 | before do |
49 | @project = Factory :project, :owner => @user | 8 | @project = Factory :project, :owner => @user |
@@ -57,42 +16,6 @@ describe "Projects" do | @@ -57,42 +16,6 @@ describe "Projects" do | ||
57 | end | 16 | end |
58 | end | 17 | end |
59 | 18 | ||
60 | - describe "GET /projects/graph" do | ||
61 | - before do | ||
62 | - @project = Factory :project | ||
63 | - @project.add_access(@user, :read) | ||
64 | - | ||
65 | - visit graph_project_path(@project) | ||
66 | - end | ||
67 | - | ||
68 | - it "should be correct path" do | ||
69 | - current_path.should == graph_project_path(@project) | ||
70 | - end | ||
71 | - | ||
72 | - it "should have as as team member" do | ||
73 | - page.should have_content("master") | ||
74 | - end | ||
75 | - end | ||
76 | - | ||
77 | - describe "GET /projects/team" do | ||
78 | - before do | ||
79 | - @project = Factory :project | ||
80 | - @project.add_access(@user, :read) | ||
81 | - | ||
82 | - visit team_project_path(@project, | ||
83 | - :path => ValidCommit::BLOB_FILE_PATH, | ||
84 | - :commit_id => ValidCommit::ID) | ||
85 | - end | ||
86 | - | ||
87 | - it "should be correct path" do | ||
88 | - current_path.should == team_project_path(@project) | ||
89 | - end | ||
90 | - | ||
91 | - it "should have as as team member" do | ||
92 | - page.should have_content(@user.name) | ||
93 | - end | ||
94 | - end | ||
95 | - | ||
96 | describe "GET /projects/:id/edit" do | 19 | describe "GET /projects/:id/edit" do |
97 | before do | 20 | before do |
98 | @project = Factory :project | 21 | @project = Factory :project |
spec/requests/projects_tree_spec.rb
@@ -1,90 +0,0 @@ | @@ -1,90 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Projects" do | ||
4 | - before { login_as :user } | ||
5 | - | ||
6 | - describe "GET /projects/tree" do | ||
7 | - describe "head" do | ||
8 | - before do | ||
9 | - @project = Factory :project | ||
10 | - @project.add_access(@user, :read) | ||
11 | - | ||
12 | - visit tree_project_ref_path(@project, @project.root_ref) | ||
13 | - end | ||
14 | - | ||
15 | - it "should be correct path" do | ||
16 | - current_path.should == tree_project_ref_path(@project, @project.root_ref) | ||
17 | - end | ||
18 | - | ||
19 | - it_behaves_like :tree_view | ||
20 | - end | ||
21 | - | ||
22 | - describe ValidCommit::ID do | ||
23 | - before do | ||
24 | - @project = Factory :project | ||
25 | - @project.add_access(@user, :read) | ||
26 | - | ||
27 | - visit tree_project_ref_path(@project, ValidCommit::ID) | ||
28 | - end | ||
29 | - | ||
30 | - it "should be correct path" do | ||
31 | - current_path.should == tree_project_ref_path(@project, ValidCommit::ID) | ||
32 | - end | ||
33 | - | ||
34 | - it_behaves_like :tree_view | ||
35 | - it_behaves_like :project_side_pane | ||
36 | - end | ||
37 | - | ||
38 | - describe "branch passed" do | ||
39 | - before do | ||
40 | - @project = Factory :project | ||
41 | - @project.add_access(@user, :read) | ||
42 | - | ||
43 | - visit tree_project_ref_path(@project, @project.root_ref) | ||
44 | - end | ||
45 | - | ||
46 | - it "should be correct path" do | ||
47 | - current_path.should == tree_project_ref_path(@project, @project.root_ref) | ||
48 | - end | ||
49 | - | ||
50 | - it_behaves_like :tree_view | ||
51 | - it_behaves_like :project_side_pane | ||
52 | - end | ||
53 | - | ||
54 | - # TREE FILE PREVIEW | ||
55 | - describe "file preview" do | ||
56 | - before do | ||
57 | - @project = Factory :project | ||
58 | - @project.add_access(@user, :read) | ||
59 | - | ||
60 | - visit tree_project_ref_path(@project, @project.root_ref, :path => "Gemfile") | ||
61 | - end | ||
62 | - | ||
63 | - it "should be correct path" do | ||
64 | - current_path.should == tree_project_ref_path(@project, @project.root_ref) | ||
65 | - end | ||
66 | - | ||
67 | - it "should contain file view" do | ||
68 | - page.should have_content("rubygems.org") | ||
69 | - end | ||
70 | - end | ||
71 | - end | ||
72 | - | ||
73 | - # RAW FILE | ||
74 | - describe "GET /projects/blob" do | ||
75 | - before do | ||
76 | - @project = Factory :project | ||
77 | - @project.add_access(@user, :read) | ||
78 | - | ||
79 | - visit blob_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) | ||
80 | - end | ||
81 | - | ||
82 | - it "should be correct path" do | ||
83 | - current_path.should == blob_project_ref_path(@project, ValidCommit::ID) | ||
84 | - end | ||
85 | - | ||
86 | - it "raw file response" do | ||
87 | - page.source.should == ValidCommit::BLOB_FILE | ||
88 | - end | ||
89 | - end | ||
90 | -end |
spec/requests/projects_wall_spec.rb
@@ -1,33 +0,0 @@ | @@ -1,33 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Projects", "Wall" 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 "View notes on wall", :js => true do | ||
12 | - before do | ||
13 | - Factory :note, :project => project, :note => "Project specs", :author => @user | ||
14 | - visit wall_project_path(project) | ||
15 | - end | ||
16 | - | ||
17 | - it { page.should have_content("Project specs") } | ||
18 | - it { page.should have_content(@user.name) } | ||
19 | - it { page.should have_content("less than a minute ago") } | ||
20 | - end | ||
21 | - | ||
22 | - describe "add new note", :js => true do | ||
23 | - before do | ||
24 | - visit wall_project_path(project) | ||
25 | - fill_in "note_note", :with => "my post on wall" | ||
26 | - click_button "Add Comment" | ||
27 | - end | ||
28 | - | ||
29 | - it "should conatin new note" do | ||
30 | - page.should have_content("my post on wall") | ||
31 | - end | ||
32 | - end | ||
33 | -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 | - |
@@ -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 |
@@ -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 |
spec/requests/wikis_spec.rb
@@ -1,35 +0,0 @@ | @@ -1,35 +0,0 @@ | ||
1 | -require 'spec_helper' | ||
2 | - | ||
3 | -describe "Wiki" 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 pages" do | ||
12 | - before do | ||
13 | - visit project_wiki_path(project, :index) | ||
14 | - end | ||
15 | - | ||
16 | - it "should see form" do | ||
17 | - page.should have_content("Editing page") | ||
18 | - end | ||
19 | - | ||
20 | - it "should see added page" do | ||
21 | - fill_in "Title", :with => 'Test title' | ||
22 | - fill_in "Content", :with => '[link test](test)' | ||
23 | - click_on "Save" | ||
24 | - | ||
25 | - page.should have_content("Test title") | ||
26 | - page.should have_content("link test") | ||
27 | - | ||
28 | - click_link "link test" | ||
29 | - | ||
30 | - page.should have_content("Editing page") | ||
31 | - end | ||
32 | - | ||
33 | - end | ||
34 | - | ||
35 | -end |