Commit 562af7a6a2d12b6bdab25d5a71c05672a1b5b888

Authored by Alex Denisov
2 parents a65ce748 e4447de2

Merge branch 'master' into normalize_capitalization

@@ -323,7 +323,7 @@ GEM @@ -323,7 +323,7 @@ GEM
323 multi_json (~> 1.0) 323 multi_json (~> 1.0)
324 rubyzip 324 rubyzip
325 settingslogic (2.0.8) 325 settingslogic (2.0.8)
326 - shoulda-matchers (1.1.0) 326 + shoulda-matchers (1.3.0)
327 activesupport (>= 3.0.0) 327 activesupport (>= 3.0.0)
328 simplecov (0.6.4) 328 simplecov (0.6.4)
329 multi_json (~> 1.0) 329 multi_json (~> 1.0)
app/assets/stylesheets/gitlab_bootstrap/buttons.scss
1 .btn { 1 .btn {
2 - background-image: -webkit-gradient(linear, 0 0, 0 26, color-stop(0.076, #f7f7f7), to(#d5d5d5));  
3 - background-image: -webkit-linear-gradient(#f7f7f7 7.6%, #d5d5d5);  
4 - background-image: -moz-linear-gradient(#f7f7f7 7.6%, #d5d5d5);  
5 - background-image: -o-linear-gradient(#f7f7f7 7.6%, #d5d5d5); 2 + @include bg-gradient(#f7f7f7, #d5d5d5);
6 border-color:#aaa; 3 border-color:#aaa;
7 &:hover { 4 &:hover {
8 @include bg-gray-gradient; 5 @include bg-gray-gradient;
@@ -12,10 +9,8 @@ @@ -12,10 +9,8 @@
12 9
13 &.primary { 10 &.primary {
14 background:#2a79A3; 11 background:#2a79A3;
  12 + @include bg-gradient(#47A7b7, #2585b5);
15 border-color: #2A79A3; 13 border-color: #2A79A3;
16 - background-image: -webkit-linear-gradient(#47A7b7 7.6%, #2585b5);  
17 - background-image: -moz-linear-gradient(#47A7b7 7.6%, #2585b5);  
18 - background-image: -o-linear-gradient(#47A7b7 7.6%, #2585b5);  
19 color:#fff; 14 color:#fff;
20 text-shadow: 0 1px 1px #268; 15 text-shadow: 0 1px 1px #268;
21 &:hover { 16 &:hover {
@@ -30,16 +25,11 @@ @@ -30,16 +25,11 @@
30 } 25 }
31 26
32 &.success { 27 &.success {
33 - border-color: #4A4;  
34 - background-image: -webkit-linear-gradient(#82D482 7.6%, #22B442);  
35 - background-image: -moz-linear-gradient(#82D482 7.6%, #22B442);  
36 - background-image: -o-linear-gradient(#82D482 7.6%, #22B442);  
37 - color: #fff;  
38 - text-shadow: 0 1px 1px #141; 28 + @extend .btn-success;
39 29
40 &:hover { 30 &:hover {
41 - background: #6C6;  
42 - color: #fff; 31 + @extend .btn-success;
  32 + background: #51a351;
43 } 33 }
44 34
45 &.disabled { 35 &.disabled {
@@ -62,10 +52,8 @@ @@ -62,10 +52,8 @@
62 padding-right:30px; 52 padding-right:30px;
63 } 53 }
64 54
65 - &.danger,  
66 - &.btn-danger {  
67 - color:#fff;  
68 - background: #DA4E49; 55 + &.danger {
  56 + @extend .btn-danger;
69 border-color: #BD362F; 57 border-color: #BD362F;
70 58
71 &:hover { 59 &:hover {
app/assets/stylesheets/gitlab_bootstrap/files.scss
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 * 3 *
4 */ 4 */
5 .file_holder { 5 .file_holder {
6 - border:1px solid #CCC; 6 + border:1px solid #BBB;
7 margin-bottom:1em; 7 margin-bottom:1em;
8 @include solid_shade; 8 @include solid_shade;
9 9
app/assets/stylesheets/main.scss
@@ -56,6 +56,13 @@ $hover: #fdf5d9; @@ -56,6 +56,13 @@ $hover: #fdf5d9;
56 border-radius: $radius; 56 border-radius: $radius;
57 } 57 }
58 58
  59 +@mixin bg-gradient($from, $to) {
  60 + background-image: -webkit-gradient(linear, 0 0, 0 100%, from($from), to($to));
  61 + background-image: -webkit-linear-gradient($from, $to);
  62 + background-image: -moz-linear-gradient($from, $to);
  63 + background-image: -o-linear-gradient($from, $to);
  64 +}
  65 +
59 @mixin bg-gray-gradient { 66 @mixin bg-gray-gradient {
60 background:#eee; 67 background:#eee;
61 background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf)); 68 background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf));
app/assets/stylesheets/sections/header.scss
@@ -22,7 +22,7 @@ header { @@ -22,7 +22,7 @@ header {
22 * 22 *
23 */ 23 */
24 .app_logo { 24 .app_logo {
25 - width:230px; 25 + width:200px;
26 float:left; 26 float:left;
27 position:relative; 27 position:relative;
28 top:-5px; 28 top:-5px;
@@ -31,7 +31,7 @@ header { @@ -31,7 +31,7 @@ header {
31 31
32 h1 { 32 h1 {
33 padding-top: 5px; 33 padding-top: 5px;
34 - width:102px; 34 + width:90px;
35 background: url('logo_dark.png') no-repeat 0px -3px; 35 background: url('logo_dark.png') no-repeat 0px -3px;
36 float:left; 36 float:left;
37 margin-left:5px; 37 margin-left:5px;
app/assets/stylesheets/sections/nav.scss
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * Main Menu of Application 2 * Main Menu of Application
3 * 3 *
4 */ 4 */
5 -ul.main_menu { 5 +ul.main_menu {
6 border-radius: 4px; 6 border-radius: 4px;
7 margin: auto; 7 margin: auto;
8 margin:30px 0; 8 margin:30px 0;
@@ -12,7 +12,7 @@ ul.main_menu { @@ -12,7 +12,7 @@ ul.main_menu {
12 position:relative; 12 position:relative;
13 overflow:hidden; 13 overflow:hidden;
14 @include shade; 14 @include shade;
15 - .count { 15 + .count {
16 position: relative; 16 position: relative;
17 top: -1px; 17 top: -1px;
18 display: inline-block; 18 display: inline-block;
@@ -29,12 +29,12 @@ ul.main_menu { @@ -29,12 +29,12 @@ ul.main_menu {
29 border-radius: 8px; 29 border-radius: 8px;
30 -moz-border-radius: 8px; 30 -moz-border-radius: 8px;
31 } 31 }
32 - .label { 32 + .label {
33 background:$hover; 33 background:$hover;
34 text-shadow:none; 34 text-shadow:none;
35 color:$style_color; 35 color:$style_color;
36 } 36 }
37 - li { 37 + li {
38 list-style-type: none; 38 list-style-type: none;
39 margin: 0; 39 margin: 0;
40 display: table-cell; 40 display: table-cell;
@@ -43,7 +43,7 @@ ul.main_menu { @@ -43,7 +43,7 @@ ul.main_menu {
43 border-left: 1px solid #EEE; 43 border-left: 1px solid #EEE;
44 border-bottom:2px solid #CFCFCF; 44 border-bottom:2px solid #CFCFCF;
45 45
46 - &:first-child{ 46 + &:first-child{
47 -webkit-border-top-left-radius: 4px; 47 -webkit-border-top-left-radius: 4px;
48 -webkit-border-bottom-left-radius: 4px; 48 -webkit-border-bottom-left-radius: 4px;
49 -moz-border-radius-topleft: 4px; 49 -moz-border-radius-topleft: 4px;
@@ -53,31 +53,31 @@ ul.main_menu { @@ -53,31 +53,31 @@ ul.main_menu {
53 border-left: 0; 53 border-left: 0;
54 } 54 }
55 55
56 - &.current { 56 + &.current {
57 background-color:#D5D5D5; 57 background-color:#D5D5D5;
58 - border-bottom: 2px solid $style_color; 58 + border-bottom: 1px solid #AAA;
59 border-right: 1px solid #BBB; 59 border-right: 1px solid #BBB;
60 border-left: 1px solid #BBB; 60 border-left: 1px solid #BBB;
61 border-radius: 0 0 1px 1px; 61 border-radius: 0 0 1px 1px;
62 - &:first-child{ 62 + &:first-child{
63 border-bottom:none; 63 border-bottom:none;
64 border-left:none; 64 border-left:none;
65 } 65 }
66 } 66 }
67 67
68 - &.home {  
69 - a { 68 + &.home {
  69 + a {
70 background: url(home_icon.PNG) no-repeat center center; 70 background: url(home_icon.PNG) no-repeat center center;
71 text-indent:-9999px; 71 text-indent:-9999px;
72 min-width:20px; 72 min-width:20px;
73 - img { 73 + img {
74 position:relative; 74 position:relative;
75 top:4px; 75 top:4px;
76 } 76 }
77 } 77 }
78 } 78 }
79 } 79 }
80 - a { 80 + a {
81 display: block; 81 display: block;
82 text-align: center; 82 text-align: center;
83 font-weight:bold; 83 font-weight:bold;
app/models/project.rb
@@ -104,6 +104,8 @@ class Project < ActiveRecord::Base @@ -104,6 +104,8 @@ class Project < ActiveRecord::Base
104 length: { within: 1..255 } 104 length: { within: 1..255 }
105 105
106 validates :owner, presence: true 106 validates :owner, presence: true
  107 + validates :issues_enabled, :wall_enabled, :merge_requests_enabled,
  108 + :wiki_enabled, inclusion: { in: [true, false] }
107 validate :check_limit 109 validate :check_limit
108 validate :repo_name 110 validate :repo_name
109 111
app/roles/issue_commonality.rb
@@ -16,7 +16,7 @@ module IssueCommonality @@ -16,7 +16,7 @@ module IssueCommonality
16 validates :title, 16 validates :title,
17 presence: true, 17 presence: true,
18 length: { within: 0..255 } 18 length: { within: 0..255 }
19 - 19 + validates :closed, inclusion: { in: [true, false] }
20 20
21 scope :opened, where(closed: false) 21 scope :opened, where(closed: false)
22 scope :closed, where(closed: true) 22 scope :closed, where(closed: true)
app/views/deploy_keys/_form.html.haml
@@ -11,8 +11,13 @@ @@ -11,8 +11,13 @@
11 .input= f.text_field :title 11 .input= f.text_field :title
12 .clearfix 12 .clearfix
13 = f.label :key 13 = f.label :key
14 - .input= f.text_area :key, class: "xlarge" 14 + .input
  15 + = f.text_area :key, class: [:xxlarge, :thin_area]
  16 + %p.hint
  17 + Paste a machine public key here. Read more about how generate it
  18 + = link_to "here", help_ssh_path
  19 +
15 .actions 20 .actions
16 - = f.submit 'Save', class: "primary btn"  
17 - = link_to "Cancel", project_deploy_keys_path(@project), class: "btn" 21 + = f.submit 'Save', class: "save-btn btn"
  22 + = link_to "Cancel", project_deploy_keys_path(@project), class: "btn cancel-btn"
18 23
app/views/deploy_keys/index.html.haml
1 = render "repositories/head" 1 = render "repositories/head"
2 -- if can? current_user, :admin_project, @project  
3 - .alert-message.block-message  
4 - Deploy keys allow read-only access to repository. 2 +
  3 +%p.slead
  4 + Deploy keys allow read-only access to repository. It matches perfectly for CI, staging or production servers.
  5 +
  6 + - if can? current_user, :admin_project, @project
5 = link_to new_project_deploy_key_path(@project), class: "btn small", title: "New Deploy Key" do 7 = link_to new_project_deploy_key_path(@project), class: "btn small", title: "New Deploy Key" do
6 Add Deploy Key 8 Add Deploy Key
7 -  
8 - if @keys.any? 9 - if @keys.any?
9 %table 10 %table
  11 + %thead
  12 + %tr
  13 + %th Keys
  14 + %th
  15 + %th
10 - @keys.each do |key| 16 - @keys.each do |key|
11 = render(partial: 'show', locals: {key: key}) 17 = render(partial: 'show', locals: {key: key})
app/views/deploy_keys/new.html.haml
1 = render "repositories/head" 1 = render "repositories/head"
2 2
3 -%h3 New Deploy key 3 +%h3.page_title New Deploy key
4 %hr 4 %hr
5 5
6 = render 'form' 6 = render 'form'
app/views/deploy_keys/show.html.haml
1 = render "repositories/head" 1 = render "repositories/head"
2 -%h3= @key.title 2 +%h3.page_title
  3 + Deploy key:
  4 + = @key.title
  5 + %small
  6 + created at
  7 + = @key.created_at.stamp("Aug 21, 2011")
  8 +.back_link
  9 + = link_to project_deploy_keys_path(@project) do
  10 + ← To keys list
3 %hr 11 %hr
4 %pre= @key.key 12 %pre= @key.key
5 -.actions 13 +.right
6 = link_to 'Remove', project_deploy_key_path(@key.project, @key), confirm: 'Are you sure?', method: :delete, class: "danger btn delete-key" 14 = link_to 'Remove', project_deploy_key_path(@key.project, @key), confirm: 'Are you sure?', method: :delete, class: "danger btn delete-key"
7 - .clear  
app/views/keys/show.html.haml
@@ -10,5 +10,5 @@ @@ -10,5 +10,5 @@
10 %hr 10 %hr
11 11
12 %pre= @key.key 12 %pre= @key.key
13 -.actions 13 +.right
14 = link_to 'Remove', @key, confirm: 'Are you sure?', method: :delete, class: "btn danger delete-key" 14 = link_to 'Remove', @key, confirm: 'Are you sure?', method: :delete, class: "btn danger delete-key"
app/views/team_members/show.html.haml
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 3
4 .team_member_show 4 .team_member_show
5 - if can? current_user, :admin_project, @project 5 - if can? current_user, :admin_project, @project
6 - = link_to 'Remove from team', project_team_member_path(project_id: @project, id: @team_member.id), confirm: 'Are you sure?', method: :delete, class: "right btn btn-danger" 6 + = link_to 'Remove from team', project_team_member_path(project_id: @project, id: @team_member.id), confirm: 'Are you sure?', method: :delete, class: "right btn danger"
7 .profile_avatar_holder 7 .profile_avatar_holder
8 = image_tag gravatar_icon(user.email, 60), class: "borders" 8 = image_tag gravatar_icon(user.email, 60), class: "borders"
9 %h3 9 %h3
features/projects/issues/issues.feature
@@ -4,7 +4,7 @@ Feature: Issues @@ -4,7 +4,7 @@ Feature: Issues
4 And I own project "Shop" 4 And I own project "Shop"
5 And project "Shop" have "Release 0.4" open issue 5 And project "Shop" have "Release 0.4" open issue
6 And project "Shop" have "Release 0.3" closed issue 6 And project "Shop" have "Release 0.3" closed issue
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" in issues 10 Given I should see "Release 0.4" in issues
@@ -36,3 +36,31 @@ Feature: Issues @@ -36,3 +36,31 @@ Feature: Issues
36 Given I visit issue page "Release 0.4" 36 Given I visit issue page "Release 0.4"
37 And I leave a comment like "XML attached" 37 And I leave a comment like "XML attached"
38 Then I should see comment "XML attached" 38 Then I should see comment "XML attached"
  39 +
  40 + @javascript
  41 + Scenario: I search issue
  42 + Given I fill in issue search with "Release"
  43 + Then I should see "Release 0.4" in issues
  44 + And I should not see "Release 0.3" in issues
  45 +
  46 + @javascript
  47 + Scenario: I search issue that not exist
  48 + Given I fill in issue search with "Bug"
  49 + Then I should not see "Release 0.4" in issues
  50 + And I should not see "Release 0.3" in issues
  51 +
  52 +
  53 + @javascript
  54 + Scenario: I search all issues
  55 + Given I click link "All"
  56 + And I fill in issue search with "0.3"
  57 + Then I should see "Release 0.3" in issues
  58 + And I should not see "Release 0.4" in issues
  59 +
  60 + @javascript
  61 + Scenario: I clear search
  62 + Given I click link "All"
  63 + And I fill in issue search with "Something"
  64 + And I fill in issue search with ""
  65 + Then I should see "Release 0.4" in issues
  66 + And I should see "Release 0.3" in issues
features/step_definitions/common_steps.rb 0 → 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +include LoginHelpers
  2 +
  3 +Given /^I signin as a user$/ do
  4 + login_as :user
  5 +end
  6 +
  7 +When /^I click link "(.*?)"$/ do |link|
  8 + click_link link
  9 +end
  10 +
  11 +When /^I click button "(.*?)"$/ do |button|
  12 + click_button button
  13 +end
  14 +
  15 +When /^I fill in "(.*?)" with "(.*?)"$/ do |field, value|
  16 + fill_in field, :with => value
  17 +end
  18 +
  19 +Given /^show me page$/ do
  20 + save_and_open_page
  21 +end
features/step_definitions/dashboard_steps.rb
1 -Given /^I visit dashboard page$/ do  
2 - visit dashboard_path  
3 -end  
4 -  
5 Then /^I should see "(.*?)" link$/ do |arg1| 1 Then /^I should see "(.*?)" link$/ do |arg1|
6 page.should have_link(arg1) 2 page.should have_link(arg1)
7 end 3 end
@@ -51,10 +47,10 @@ Then /^I click "(.*?)" link$/ do |arg1| @@ -51,10 +47,10 @@ Then /^I click "(.*?)" link$/ do |arg1|
51 end 47 end
52 48
53 Then /^I see prefilled new Merge Request page$/ do 49 Then /^I see prefilled new Merge Request page$/ do
54 - current_path.should == new_project_merge_request_path(@project)  
55 - find("#merge_request_source_branch").value.should == "new_design"  
56 - find("#merge_request_target_branch").value.should == "master"  
57 - find("#merge_request_title").value.should == "New Design" 50 + current_path.should == new_project_merge_request_path(@project)
  51 + find("#merge_request_source_branch").value.should == "new_design"
  52 + find("#merge_request_target_branch").value.should == "master"
  53 + find("#merge_request_title").value.should == "New Design"
58 end 54 end
59 55
60 Given /^I visit dashboard search page$/ do 56 Given /^I visit dashboard search page$/ do
@@ -66,10 +62,6 @@ Given /^I search for "(.*?)"$/ do |arg1| @@ -66,10 +62,6 @@ Given /^I search for "(.*?)"$/ do |arg1|
66 click_button "Search" 62 click_button "Search"
67 end 63 end
68 64
69 -Given /^I visit dashboard issues page$/ do  
70 - visit dashboard_issues_path  
71 -end  
72 -  
73 Then /^I should see issues assigned to me$/ do 65 Then /^I should see issues assigned to me$/ do
74 issues = @user.issues 66 issues = @user.issues
75 issues.each do |issue| 67 issues.each do |issue|
@@ -78,10 +70,6 @@ Then /^I should see issues assigned to me$/ do @@ -78,10 +70,6 @@ Then /^I should see issues assigned to me$/ do
78 end 70 end
79 end 71 end
80 72
81 -Given /^I visit dashboard merge requests page$/ do  
82 - visit dashboard_merge_requests_path  
83 -end  
84 -  
85 Then /^I should see my merge requests$/ do 73 Then /^I should see my merge requests$/ do
86 merge_requests = @user.merge_requests 74 merge_requests = @user.merge_requests
87 merge_requests.each do |mr| 75 merge_requests.each do |mr|
features/step_definitions/profile/profile_steps.rb
1 -Given /^I visit profile page$/ do  
2 - visit profile_path  
3 -end  
4 -  
5 Then /^I should see my profile info$/ do 1 Then /^I should see my profile info$/ do
6 page.should have_content "Profile" 2 page.should have_content "Profile"
7 page.should have_content @user.name 3 page.should have_content @user.name
8 page.should have_content @user.email 4 page.should have_content @user.email
9 end 5 end
10 6
11 -Given /^I visit profile password page$/ do  
12 - visit profile_password_path  
13 -end  
14 -  
15 Then /^I change my password$/ do 7 Then /^I change my password$/ do
16 fill_in "user_password", :with => "222333" 8 fill_in "user_password", :with => "222333"
17 fill_in "user_password_confirmation", :with => "222333" 9 fill_in "user_password_confirmation", :with => "222333"
@@ -22,10 +14,6 @@ Then /^I should be redirected to sign in page$/ do @@ -22,10 +14,6 @@ Then /^I should be redirected to sign in page$/ do
22 current_path.should == new_user_session_path 14 current_path.should == new_user_session_path
23 end 15 end
24 16
25 -Given /^I visit profile token page$/ do  
26 - visit profile_token_path  
27 -end  
28 -  
29 Then /^I reset my token$/ do 17 Then /^I reset my token$/ do
30 @old_token = @user.private_token 18 @old_token = @user.private_token
31 click_button "Reset" 19 click_button "Reset"
features/step_definitions/project/browse_code_steps.rb
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 1 Then /^I should see files from repository$/ do
6 page.should have_content("app") 2 page.should have_content("app")
7 page.should have_content("History") 3 page.should have_content("History")
8 page.should have_content("Gemfile") 4 page.should have_content("Gemfile")
9 end 5 end
10 6
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| 7 Then /^I should see files from repository for "(.*?)"$/ do |arg1|
16 current_path.should == tree_project_ref_path(@project, arg1) 8 current_path.should == tree_project_ref_path(@project, arg1)
17 page.should have_content("app") 9 page.should have_content("app")
@@ -31,10 +23,6 @@ Given /^I click on raw button$/ do @@ -31,10 +23,6 @@ Given /^I click on raw button$/ do
31 click_link "raw" 23 click_link "raw"
32 end 24 end
33 25
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 26 Then /^I should see raw file content$/ do
39 page.source.should == ValidCommit::BLOB_FILE 27 page.source.should == ValidCommit::BLOB_FILE
40 end 28 end
features/step_definitions/project/project_commits_steps.rb
1 -Given /^I visit project commits page$/ do  
2 - visit project_commits_path(@project)  
3 -end  
4 -  
5 Then /^I see project commits$/ do 1 Then /^I see project commits$/ do
6 current_path.should == project_commits_path(@project) 2 current_path.should == project_commits_path(@project)
7 3
@@ -23,19 +19,11 @@ Then /^I see commits atom feed$/ do @@ -23,19 +19,11 @@ Then /^I see commits atom feed$/ do
23 page.body.should have_selector("entry summary", :text => commit.description) 19 page.body.should have_selector("entry summary", :text => commit.description)
24 end 20 end
25 21
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 22 Then /^I see commit info$/ do
31 page.should have_content ValidCommit::MESSAGE 23 page.should have_content ValidCommit::MESSAGE
32 page.should have_content "Showing 1 changed file" 24 page.should have_content "Showing 1 changed file"
33 end 25 end
34 26
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 27 Given /^I fill compare fields with refs$/ do
40 fill_in "from", :with => "master" 28 fill_in "from", :with => "master"
41 fill_in "to", :with => "stable" 29 fill_in "to", :with => "stable"
@@ -48,18 +36,6 @@ Given /^I see compared refs$/ do @@ -48,18 +36,6 @@ Given /^I see compared refs$/ do
48 page.should have_content "Showing 73 changed files" 36 page.should have_content "Showing 73 changed files"
49 end 37 end
50 38
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| 39 Then /^I should see "(.*?)" recent branches list$/ do |arg1|
64 page.should have_content("Branches") 40 page.should have_content("Branches")
65 page.should have_content("master") 41 page.should have_content("master")
@@ -76,7 +52,7 @@ Then /^I should see "(.*?)" all tags list$/ do |arg1| @@ -76,7 +52,7 @@ Then /^I should see "(.*?)" all tags list$/ do |arg1|
76 end 52 end
77 53
78 Then /^I should see "(.*?)" protected branches list$/ do |arg1| 54 Then /^I should see "(.*?)" protected branches list$/ do |arg1|
79 - within "table" do 55 + within "table" do
80 page.should have_content "stable" 56 page.should have_content "stable"
81 page.should_not have_content "master" 57 page.should_not have_content "master"
82 end 58 end
features/step_definitions/project/project_issues_steps.rb
@@ -8,16 +8,12 @@ Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2| @@ -8,16 +8,12 @@ Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2|
8 Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true) 8 Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true)
9 end 9 end
10 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| 11 Given /^I should see "(.*?)" in issues$/ do |arg1|
16 - page.should have_content arg1 12 + page.should have_content arg1
17 end 13 end
18 14
19 Given /^I should not see "(.*?)" in issues$/ do |arg1| 15 Given /^I should not see "(.*?)" in issues$/ do |arg1|
20 - page.should_not have_content arg1 16 + page.should_not have_content arg1
21 end 17 end
22 18
23 Then /^I should see issue "(.*?)"$/ do |arg1| 19 Then /^I should see issue "(.*?)"$/ do |arg1|
@@ -27,11 +23,6 @@ Then /^I should see issue "(.*?)"$/ do |arg1| @@ -27,11 +23,6 @@ Then /^I should see issue "(.*?)"$/ do |arg1|
27 page.should have_content issue.project.name 23 page.should have_content issue.project.name
28 end 24 end
29 25
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| 26 Given /^I submit new issue "(.*?)"$/ do |arg1|
36 fill_in "issue_title", with: arg1 27 fill_in "issue_title", with: arg1
37 click_button "Submit new issue" 28 click_button "Submit new issue"
@@ -51,7 +42,16 @@ Given /^I visit project "(.*?)" labels page$/ do |arg1| @@ -51,7 +42,16 @@ Given /^I visit project "(.*?)" labels page$/ do |arg1|
51 end 42 end
52 43
53 Then /^I should see label "(.*?)"$/ do |arg1| 44 Then /^I should see label "(.*?)"$/ do |arg1|
54 - within ".labels-table" do 45 + within ".labels-table" do
55 page.should have_content arg1 46 page.should have_content arg1
56 end 47 end
57 end 48 end
  49 +
  50 +Given /^I fill in issue search with "(.*?)"$/ do |arg1|
  51 + # Because fill_in, with: "" triggers nothing
  52 + # we need to trigger a keyup event
  53 + if arg1 == ''
  54 + page.execute_script("$('.issue_search').val('').keyup();");
  55 + end
  56 + fill_in 'issue_search', with: arg1
  57 +end
features/step_definitions/project/project_merge_requests_steps.rb
@@ -8,21 +8,17 @@ Given /^project "(.*?)" have "(.*?)" closed merge request$/ do |arg1, arg2| @@ -8,21 +8,17 @@ Given /^project "(.*?)" have "(.*?)" closed merge request$/ do |arg1, arg2|
8 Factory.create(:merge_request, :title => arg2, :project => project, :author => project.users.first, :closed => true) 8 Factory.create(:merge_request, :title => arg2, :project => project, :author => project.users.first, :closed => true)
9 end 9 end
10 10
11 -Given /^I visit project "(.*?)" merge requests page$/ do |arg1|  
12 - visit project_merge_requests_path(Project.find_by_name(arg1))  
13 -end  
14 -  
15 Then /^I should see "(.*?)" in merge requests$/ do |arg1| 11 Then /^I should see "(.*?)" in merge requests$/ do |arg1|
16 - page.should have_content arg1 12 + page.should have_content arg1
17 end 13 end
18 14
19 Then /^I should not see "(.*?)" in merge requests$/ do |arg1| 15 Then /^I should not see "(.*?)" in merge requests$/ do |arg1|
20 - page.should_not have_content arg1 16 + page.should_not have_content arg1
21 end 17 end
22 18
23 Then /^I should see merge request "(.*?)"$/ do |arg1| 19 Then /^I should see merge request "(.*?)"$/ do |arg1|
24 merge_request = MergeRequest.find_by_title(arg1) 20 merge_request = MergeRequest.find_by_title(arg1)
25 - page.should have_content(merge_request.title[0..10]) 21 + page.should have_content(merge_request.title[0..10])
26 page.should have_content(merge_request.target_branch) 22 page.should have_content(merge_request.target_branch)
27 page.should have_content(merge_request.source_branch) 23 page.should have_content(merge_request.source_branch)
28 end 24 end
@@ -34,11 +30,6 @@ Given /^I submit new merge request "(.*?)"$/ do |arg1| @@ -34,11 +30,6 @@ Given /^I submit new merge request "(.*?)"$/ do |arg1|
34 click_button "Save" 30 click_button "Save"
35 end 31 end
36 32
37 -Given /^I visit merge request page "(.*?)"$/ do |arg1|  
38 - mr = MergeRequest.find_by_title(arg1)  
39 - visit project_merge_request_path(mr.project, mr)  
40 -end  
41 -  
42 Then /^I should see closed merge request "(.*?)"$/ do |arg1| 33 Then /^I should see closed merge request "(.*?)"$/ do |arg1|
43 mr = MergeRequest.find_by_title(arg1) 34 mr = MergeRequest.find_by_title(arg1)
44 mr.closed.should be_true 35 mr.closed.should be_true
features/step_definitions/project/project_milestones_steps.rb
@@ -12,11 +12,6 @@ Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2| @@ -12,11 +12,6 @@ Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2|
12 end 12 end
13 end 13 end
14 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 15 Then /^I should see active milestones$/ do
21 milestone = @project.milestones.first 16 milestone = @project.milestones.first
22 page.should have_content(milestone.title[0..10]) 17 page.should have_content(milestone.title[0..10])
features/step_definitions/project/project_team_steps.rb
@@ -8,10 +8,6 @@ Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2| @@ -8,10 +8,6 @@ Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2|
8 project.add_access(user, :write) 8 project.add_access(user, :write)
9 end 9 end
10 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 11 Then /^I should be able to see myself in team$/ do
16 page.should have_content(@user.name) 12 page.should have_content(@user.name)
17 page.should have_content(@user.email) 13 page.should have_content(@user.email)
@@ -23,13 +19,9 @@ Then /^I should see "(.*?)" in team list$/ do |arg1| @@ -23,13 +19,9 @@ Then /^I should see "(.*?)" in team list$/ do |arg1|
23 page.should have_content(user.email) 19 page.should have_content(user.email)
24 end 20 end
25 21
26 -Given /^I click link "(.*?)"$/ do |arg1|  
27 - click_link arg1  
28 -end  
29 -  
30 Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2| 22 Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2|
31 user = User.find_by_name(arg1) 23 user = User.find_by_name(arg1)
32 - within "#new_team_member" do 24 + within "#new_team_member" do
33 select user.name, :from => "team_member_user_id" 25 select user.name, :from => "team_member_user_id"
34 select arg2, :from => "team_member_project_access" 26 select arg2, :from => "team_member_project_access"
35 end 27 end
@@ -44,7 +36,7 @@ end @@ -44,7 +36,7 @@ end
44 36
45 Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2| 37 Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2|
46 user = User.find_by_name(arg1) 38 user = User.find_by_name(arg1)
47 - within ".user_#{user.id}" do 39 + within ".user_#{user.id}" do
48 select arg2, :from => "team_member_project_access" 40 select arg2, :from => "team_member_project_access"
49 end 41 end
50 end 42 end
features/step_definitions/project/project_wiki_steps.rb
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 1 Given /^I create Wiki page$/ do
6 fill_in "Title", :with => 'Test title' 2 fill_in "Title", :with => 'Test title'
7 fill_in "Content", :with => '[link test](test)' 3 fill_in "Content", :with => '[link test](test)'
features/step_definitions/project/projects_steps.rb
1 -include LoginHelpers  
2 -  
3 -Given /^I signin as a user$/ do  
4 - login_as :user  
5 -end  
6 -  
7 When /^I visit new project page$/ do 1 When /^I visit new project page$/ do
8 visit new_project_path 2 visit new_project_path
9 end 3 end
@@ -65,10 +59,6 @@ Given /^I visit project "(.*?)" network page$/ do |arg1| @@ -65,10 +59,6 @@ Given /^I visit project "(.*?)" network page$/ do |arg1|
65 visit graph_project_path(project) 59 visit graph_project_path(project)
66 end 60 end
67 61
68 -Given /^show me page$/ do  
69 - save_and_open_page  
70 -end  
71 -  
72 Given /^page should have network graph$/ do 62 Given /^page should have network graph$/ do
73 page.should have_content "Project Network Graph" 63 page.should have_content "Project Network Graph"
74 within ".graph" do 64 within ".graph" do
features/step_definitions/visit_steps.rb 0 → 100644
@@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
  1 +Given /^I visit project "(.*?)" issues page$/ do |arg1|
  2 + visit project_issues_path(Project.find_by_name(arg1))
  3 +end
  4 +
  5 +Given /^I visit issue page "(.*?)"$/ do |arg1|
  6 + issue = Issue.find_by_title(arg1)
  7 + visit project_issue_path(issue.project, issue)
  8 +end
  9 +
  10 +Given /^I visit project "(.*?)" merge requests page$/ do |arg1|
  11 + visit project_merge_requests_path(Project.find_by_name(arg1))
  12 +end
  13 +
  14 +Given /^I visit merge request page "(.*?)"$/ do |arg1|
  15 + mr = MergeRequest.find_by_title(arg1)
  16 + visit project_merge_request_path(mr.project, mr)
  17 +end
  18 +
  19 +Given /^I visit project "(.*?)" milestones page$/ do |arg1|
  20 + @project = Project.find_by_name(arg1)
  21 + visit project_milestones_path(@project)
  22 +end
  23 +
  24 +Given /^I visit project commits page$/ do
  25 + visit project_commits_path(@project)
  26 +end
  27 +
  28 +Given /^I visit compare refs page$/ do
  29 + visit compare_project_commits_path(@project)
  30 +end
  31 +
  32 +Given /^I visit project branches page$/ do
  33 + visit branches_project_repository_path(@project)
  34 +end
  35 +
  36 +Given /^I visit project commit page$/ do
  37 + visit project_commit_path(@project, ValidCommit::ID)
  38 +end
  39 +
  40 +Given /^I visit project tags page$/ do
  41 + visit tags_project_repository_path(@project)
  42 +end
  43 +
  44 +Given /^I click on commit link$/ do
  45 + visit project_commit_path(@project, ValidCommit::ID)
  46 +end
  47 +
  48 +Given /^I visit project source page$/ do
  49 + visit tree_project_ref_path(@project, @project.root_ref)
  50 +end
  51 +
  52 +Given /^I visit project source page for "(.*?)"$/ do |arg1|
  53 + visit tree_project_ref_path(@project, arg1)
  54 +end
  55 +
  56 +Given /^I visit blob file from repo$/ do
  57 + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
  58 +end
  59 +
  60 +Given /^I visit project "(.*?)" team page$/ do |arg1|
  61 + visit team_project_path(Project.find_by_name(arg1))
  62 +end
  63 +
  64 +Given /^I visit project wiki page$/ do
  65 + visit project_wiki_path(@project, :index)
  66 +end
  67 +
  68 +Given /^I visit profile page$/ do
  69 + visit profile_path
  70 +end
  71 +
  72 +Given /^I visit profile token page$/ do
  73 + visit profile_token_path
  74 +end
  75 +
  76 +Given /^I visit profile password page$/ do
  77 + visit profile_password_path
  78 +end
  79 +
  80 +Given /^I visit dashboard page$/ do
  81 + visit dashboard_path
  82 +end
  83 +
  84 +Given /^I visit dashboard issues page$/ do
  85 + visit dashboard_issues_path
  86 +end
  87 +
  88 +Given /^I visit dashboard merge requests page$/ do
  89 + visit dashboard_merge_requests_path
  90 +end
  91 +
spec/models/issue_spec.rb
@@ -7,6 +7,7 @@ describe Issue do @@ -7,6 +7,7 @@ describe Issue do
7 7
8 describe "Validation" do 8 describe "Validation" do
9 it { should ensure_length_of(:description).is_within(0..2000) } 9 it { should ensure_length_of(:description).is_within(0..2000) }
  10 + it { should ensure_inclusion_of(:closed).in_array([true, false]) }
10 end 11 end
11 12
12 describe 'modules' do 13 describe 'modules' do
spec/models/milestone_spec.rb
@@ -9,6 +9,7 @@ describe Milestone do @@ -9,6 +9,7 @@ describe Milestone do
9 describe "Validation" do 9 describe "Validation" do
10 it { should validate_presence_of(:title) } 10 it { should validate_presence_of(:title) }
11 it { should validate_presence_of(:project_id) } 11 it { should validate_presence_of(:project_id) }
  12 + it { should ensure_inclusion_of(:closed).in_array([true, false]) }
12 end 13 end
13 14
14 let(:milestone) { Factory :milestone } 15 let(:milestone) { Factory :milestone }
spec/models/project_spec.rb
@@ -37,6 +37,10 @@ describe Project do @@ -37,6 +37,10 @@ describe Project do
37 # TODO: Formats 37 # TODO: Formats
38 38
39 it { should validate_presence_of(:owner) } 39 it { should validate_presence_of(:owner) }
  40 + it { should ensure_inclusion_of(:issues_enabled).in_array([true, false]) }
  41 + it { should ensure_inclusion_of(:wall_enabled).in_array([true, false]) }
  42 + it { should ensure_inclusion_of(:merge_requests_enabled).in_array([true, false]) }
  43 + it { should ensure_inclusion_of(:wiki_enabled).in_array([true, false]) }
40 44
41 it "should not allow new projects beyond user limits" do 45 it "should not allow new projects beyond user limits" do
42 project.stub(:owner).and_return(double(can_create_project?: false, projects_limit: 1)) 46 project.stub(:owner).and_return(double(can_create_project?: false, projects_limit: 1))
@@ -239,7 +243,7 @@ describe Project do @@ -239,7 +243,7 @@ describe Project do
239 end 243 end
240 end 244 end
241 245
242 - describe :update_merge_requests do 246 + describe :update_merge_requests do
243 let(:project) { Factory :project } 247 let(:project) { Factory :project }
244 248
245 before do 249 before do
@@ -259,7 +263,7 @@ describe Project do @@ -259,7 +263,7 @@ describe Project do
259 @merge_request.closed.should be_true 263 @merge_request.closed.should be_true
260 end 264 end
261 265
262 - it "should update merge request commits with new one if pushed to source branch" do 266 + it "should update merge request commits with new one if pushed to source branch" do
263 @merge_request.last_commit.should == nil 267 @merge_request.last_commit.should == nil
264 project.update_merge_requests("8716fc78f3c65bbf7bcf7b574febd583bc5d2812", "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a", "refs/heads/master", @key.user) 268 project.update_merge_requests("8716fc78f3c65bbf7bcf7b574febd583bc5d2812", "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a", "refs/heads/master", @key.user)
265 @merge_request.reload 269 @merge_request.reload