Merge branch 'master' into normalize_capitalization

This commit is contained in:
Alex Denisov 2012-09-06 11:40:56 +03:00
commit 562af7a6a2
30 changed files with 236 additions and 171 deletions

View file

@ -323,7 +323,7 @@ GEM
multi_json (~> 1.0) multi_json (~> 1.0)
rubyzip rubyzip
settingslogic (2.0.8) settingslogic (2.0.8)
shoulda-matchers (1.1.0) shoulda-matchers (1.3.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
simplecov (0.6.4) simplecov (0.6.4)
multi_json (~> 1.0) multi_json (~> 1.0)

View file

@ -1,8 +1,5 @@
.btn { .btn {
background-image: -webkit-gradient(linear, 0 0, 0 26, color-stop(0.076, #f7f7f7), to(#d5d5d5)); @include bg-gradient(#f7f7f7, #d5d5d5);
background-image: -webkit-linear-gradient(#f7f7f7 7.6%, #d5d5d5);
background-image: -moz-linear-gradient(#f7f7f7 7.6%, #d5d5d5);
background-image: -o-linear-gradient(#f7f7f7 7.6%, #d5d5d5);
border-color:#aaa; border-color:#aaa;
&:hover { &:hover {
@include bg-gray-gradient; @include bg-gray-gradient;
@ -12,10 +9,8 @@
&.primary { &.primary {
background:#2a79A3; background:#2a79A3;
@include bg-gradient(#47A7b7, #2585b5);
border-color: #2A79A3; border-color: #2A79A3;
background-image: -webkit-linear-gradient(#47A7b7 7.6%, #2585b5);
background-image: -moz-linear-gradient(#47A7b7 7.6%, #2585b5);
background-image: -o-linear-gradient(#47A7b7 7.6%, #2585b5);
color:#fff; color:#fff;
text-shadow: 0 1px 1px #268; text-shadow: 0 1px 1px #268;
&:hover { &:hover {
@ -30,16 +25,11 @@
} }
&.success { &.success {
border-color: #4A4; @extend .btn-success;
background-image: -webkit-linear-gradient(#82D482 7.6%, #22B442);
background-image: -moz-linear-gradient(#82D482 7.6%, #22B442);
background-image: -o-linear-gradient(#82D482 7.6%, #22B442);
color: #fff;
text-shadow: 0 1px 1px #141;
&:hover { &:hover {
background: #6C6; @extend .btn-success;
color: #fff; background: #51a351;
} }
&.disabled { &.disabled {
@ -62,10 +52,8 @@
padding-right:30px; padding-right:30px;
} }
&.danger, &.danger {
&.btn-danger { @extend .btn-danger;
color:#fff;
background: #DA4E49;
border-color: #BD362F; border-color: #BD362F;
&:hover { &:hover {

View file

@ -3,7 +3,7 @@
* *
*/ */
.file_holder { .file_holder {
border:1px solid #CCC; border:1px solid #BBB;
margin-bottom:1em; margin-bottom:1em;
@include solid_shade; @include solid_shade;

View file

@ -56,6 +56,13 @@ $hover: #fdf5d9;
border-radius: $radius; border-radius: $radius;
} }
@mixin bg-gradient($from, $to) {
background-image: -webkit-gradient(linear, 0 0, 0 100%, from($from), to($to));
background-image: -webkit-linear-gradient($from, $to);
background-image: -moz-linear-gradient($from, $to);
background-image: -o-linear-gradient($from, $to);
}
@mixin bg-gray-gradient { @mixin bg-gray-gradient {
background:#eee; background:#eee;
background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf)); background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf));

View file

@ -22,7 +22,7 @@ header {
* *
*/ */
.app_logo { .app_logo {
width:230px; width:200px;
float:left; float:left;
position:relative; position:relative;
top:-5px; top:-5px;
@ -31,7 +31,7 @@ header {
h1 { h1 {
padding-top: 5px; padding-top: 5px;
width:102px; width:90px;
background: url('logo_dark.png') no-repeat 0px -3px; background: url('logo_dark.png') no-repeat 0px -3px;
float:left; float:left;
margin-left:5px; margin-left:5px;

View file

@ -55,7 +55,7 @@ ul.main_menu {
&.current { &.current {
background-color:#D5D5D5; background-color:#D5D5D5;
border-bottom: 2px solid $style_color; border-bottom: 1px solid #AAA;
border-right: 1px solid #BBB; border-right: 1px solid #BBB;
border-left: 1px solid #BBB; border-left: 1px solid #BBB;
border-radius: 0 0 1px 1px; border-radius: 0 0 1px 1px;

View file

@ -104,6 +104,8 @@ class Project < ActiveRecord::Base
length: { within: 1..255 } length: { within: 1..255 }
validates :owner, presence: true validates :owner, presence: true
validates :issues_enabled, :wall_enabled, :merge_requests_enabled,
:wiki_enabled, inclusion: { in: [true, false] }
validate :check_limit validate :check_limit
validate :repo_name validate :repo_name

View file

@ -16,7 +16,7 @@ module IssueCommonality
validates :title, validates :title,
presence: true, presence: true,
length: { within: 0..255 } length: { within: 0..255 }
validates :closed, inclusion: { in: [true, false] }
scope :opened, where(closed: false) scope :opened, where(closed: false)
scope :closed, where(closed: true) scope :closed, where(closed: true)

View file

@ -11,8 +11,13 @@
.input= f.text_field :title .input= f.text_field :title
.clearfix .clearfix
= f.label :key = f.label :key
.input= f.text_area :key, class: "xlarge" .input
.actions = f.text_area :key, class: [:xxlarge, :thin_area]
= f.submit 'Save', class: "primary btn" %p.hint
= link_to "Cancel", project_deploy_keys_path(@project), class: "btn" Paste a machine public key here. Read more about how generate it
= link_to "here", help_ssh_path
.actions
= f.submit 'Save', class: "save-btn btn"
= link_to "Cancel", project_deploy_keys_path(@project), class: "btn cancel-btn"

View file

@ -1,11 +1,17 @@
= render "repositories/head" = render "repositories/head"
%p.slead
Deploy keys allow read-only access to repository. It matches perfectly for CI, staging or production servers.
- if can? current_user, :admin_project, @project - if can? current_user, :admin_project, @project
.alert-message.block-message
Deploy keys allow read-only access to repository.
= link_to new_project_deploy_key_path(@project), class: "btn small", title: "New Deploy Key" do = link_to new_project_deploy_key_path(@project), class: "btn small", title: "New Deploy Key" do
Add Deploy Key Add Deploy Key
- if @keys.any? - if @keys.any?
%table %table
%thead
%tr
%th Keys
%th
%th
- @keys.each do |key| - @keys.each do |key|
= render(partial: 'show', locals: {key: key}) = render(partial: 'show', locals: {key: key})

View file

@ -1,6 +1,6 @@
= render "repositories/head" = render "repositories/head"
%h3 New Deploy key %h3.page_title New Deploy key
%hr %hr
= render 'form' = render 'form'

View file

@ -1,7 +1,14 @@
= render "repositories/head" = render "repositories/head"
%h3= @key.title %h3.page_title
Deploy key:
= @key.title
%small
created at
= @key.created_at.stamp("Aug 21, 2011")
.back_link
= link_to project_deploy_keys_path(@project) do
&larr; To keys list
%hr %hr
%pre= @key.key %pre= @key.key
.actions .right
= link_to 'Remove', project_deploy_key_path(@key.project, @key), confirm: 'Are you sure?', method: :delete, class: "danger btn delete-key" = link_to 'Remove', project_deploy_key_path(@key.project, @key), confirm: 'Are you sure?', method: :delete, class: "danger btn delete-key"
.clear

View file

@ -10,5 +10,5 @@
%hr %hr
%pre= @key.key %pre= @key.key
.actions .right
= link_to 'Remove', @key, confirm: 'Are you sure?', method: :delete, class: "btn danger delete-key" = link_to 'Remove', @key, confirm: 'Are you sure?', method: :delete, class: "btn danger delete-key"

View file

@ -3,7 +3,7 @@
.team_member_show .team_member_show
- if can? current_user, :admin_project, @project - if can? current_user, :admin_project, @project
= 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" = 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"
.profile_avatar_holder .profile_avatar_holder
= image_tag gravatar_icon(user.email, 60), class: "borders" = image_tag gravatar_icon(user.email, 60), class: "borders"
%h3 %h3

View file

@ -36,3 +36,31 @@ Feature: Issues
Given I visit issue page "Release 0.4" Given I visit issue page "Release 0.4"
And I leave a comment like "XML attached" And I leave a comment like "XML attached"
Then I should see comment "XML attached" Then I should see comment "XML attached"
@javascript
Scenario: I search issue
Given I fill in issue search with "Release"
Then I should see "Release 0.4" in issues
And I should not see "Release 0.3" in issues
@javascript
Scenario: I search issue that not exist
Given I fill in issue search with "Bug"
Then I should not see "Release 0.4" in issues
And I should not see "Release 0.3" in issues
@javascript
Scenario: I search all issues
Given I click link "All"
And I fill in issue search with "0.3"
Then I should see "Release 0.3" in issues
And I should not see "Release 0.4" in issues
@javascript
Scenario: I clear search
Given I click link "All"
And I fill in issue search with "Something"
And I fill in issue search with ""
Then I should see "Release 0.4" in issues
And I should see "Release 0.3" in issues

View file

@ -0,0 +1,21 @@
include LoginHelpers
Given /^I signin as a user$/ do
login_as :user
end
When /^I click link "(.*?)"$/ do |link|
click_link link
end
When /^I click button "(.*?)"$/ do |button|
click_button button
end
When /^I fill in "(.*?)" with "(.*?)"$/ do |field, value|
fill_in field, :with => value
end
Given /^show me page$/ do
save_and_open_page
end

View file

@ -1,7 +1,3 @@
Given /^I visit dashboard page$/ do
visit dashboard_path
end
Then /^I should see "(.*?)" link$/ do |arg1| Then /^I should see "(.*?)" link$/ do |arg1|
page.should have_link(arg1) page.should have_link(arg1)
end end
@ -66,10 +62,6 @@ Given /^I search for "(.*?)"$/ do |arg1|
click_button "Search" click_button "Search"
end end
Given /^I visit dashboard issues page$/ do
visit dashboard_issues_path
end
Then /^I should see issues assigned to me$/ do Then /^I should see issues assigned to me$/ do
issues = @user.issues issues = @user.issues
issues.each do |issue| issues.each do |issue|
@ -78,10 +70,6 @@ Then /^I should see issues assigned to me$/ do
end end
end end
Given /^I visit dashboard merge requests page$/ do
visit dashboard_merge_requests_path
end
Then /^I should see my merge requests$/ do Then /^I should see my merge requests$/ do
merge_requests = @user.merge_requests merge_requests = @user.merge_requests
merge_requests.each do |mr| merge_requests.each do |mr|

View file

@ -1,17 +1,9 @@
Given /^I visit profile page$/ do
visit profile_path
end
Then /^I should see my profile info$/ do Then /^I should see my profile info$/ do
page.should have_content "Profile" page.should have_content "Profile"
page.should have_content @user.name page.should have_content @user.name
page.should have_content @user.email page.should have_content @user.email
end end
Given /^I visit profile password page$/ do
visit profile_password_path
end
Then /^I change my password$/ do Then /^I change my password$/ do
fill_in "user_password", :with => "222333" fill_in "user_password", :with => "222333"
fill_in "user_password_confirmation", :with => "222333" fill_in "user_password_confirmation", :with => "222333"
@ -22,10 +14,6 @@ Then /^I should be redirected to sign in page$/ do
current_path.should == new_user_session_path current_path.should == new_user_session_path
end end
Given /^I visit profile token page$/ do
visit profile_token_path
end
Then /^I reset my token$/ do Then /^I reset my token$/ do
@old_token = @user.private_token @old_token = @user.private_token
click_button "Reset" click_button "Reset"

View file

@ -1,17 +1,9 @@
Given /^I visit project source page$/ do
visit tree_project_ref_path(@project, @project.root_ref)
end
Then /^I should see files from repository$/ do Then /^I should see files from repository$/ do
page.should have_content("app") page.should have_content("app")
page.should have_content("History") page.should have_content("History")
page.should have_content("Gemfile") page.should have_content("Gemfile")
end end
Given /^I visit project source page for "(.*?)"$/ do |arg1|
visit tree_project_ref_path(@project, arg1)
end
Then /^I should see files from repository for "(.*?)"$/ do |arg1| Then /^I should see files from repository for "(.*?)"$/ do |arg1|
current_path.should == tree_project_ref_path(@project, arg1) current_path.should == tree_project_ref_path(@project, arg1)
page.should have_content("app") page.should have_content("app")
@ -31,10 +23,6 @@ Given /^I click on raw button$/ do
click_link "raw" click_link "raw"
end end
Given /^I visit blob file from repo$/ do
visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
end
Then /^I should see raw file content$/ do Then /^I should see raw file content$/ do
page.source.should == ValidCommit::BLOB_FILE page.source.should == ValidCommit::BLOB_FILE
end end

View file

@ -1,7 +1,3 @@
Given /^I visit project commits page$/ do
visit project_commits_path(@project)
end
Then /^I see project commits$/ do Then /^I see project commits$/ do
current_path.should == project_commits_path(@project) current_path.should == project_commits_path(@project)
@ -23,19 +19,11 @@ Then /^I see commits atom feed$/ do
page.body.should have_selector("entry summary", :text => commit.description) page.body.should have_selector("entry summary", :text => commit.description)
end end
Given /^I click on commit link$/ do
visit project_commit_path(@project, ValidCommit::ID)
end
Then /^I see commit info$/ do Then /^I see commit info$/ do
page.should have_content ValidCommit::MESSAGE page.should have_content ValidCommit::MESSAGE
page.should have_content "Showing 1 changed file" page.should have_content "Showing 1 changed file"
end end
Given /^I visit compare refs page$/ do
visit compare_project_commits_path(@project)
end
Given /^I fill compare fields with refs$/ do Given /^I fill compare fields with refs$/ do
fill_in "from", :with => "master" fill_in "from", :with => "master"
fill_in "to", :with => "stable" fill_in "to", :with => "stable"
@ -48,18 +36,6 @@ Given /^I see compared refs$/ do
page.should have_content "Showing 73 changed files" page.should have_content "Showing 73 changed files"
end end
Given /^I visit project branches page$/ do
visit branches_project_repository_path(@project)
end
Given /^I visit project commit page$/ do
visit project_commit_path(@project, ValidCommit::ID)
end
Given /^I visit project tags page$/ do
visit tags_project_repository_path(@project)
end
Then /^I should see "(.*?)" recent branches list$/ do |arg1| Then /^I should see "(.*?)" recent branches list$/ do |arg1|
page.should have_content("Branches") page.should have_content("Branches")
page.should have_content("master") page.should have_content("master")

View file

@ -8,10 +8,6 @@ Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2|
Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true) Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true)
end end
Given /^I visit project "(.*?)" issues page$/ do |arg1|
visit project_issues_path(Project.find_by_name(arg1))
end
Given /^I should see "(.*?)" in issues$/ do |arg1| Given /^I should see "(.*?)" in issues$/ do |arg1|
page.should have_content arg1 page.should have_content arg1
end end
@ -27,11 +23,6 @@ Then /^I should see issue "(.*?)"$/ do |arg1|
page.should have_content issue.project.name page.should have_content issue.project.name
end end
Given /^I visit issue page "(.*?)"$/ do |arg1|
issue = Issue.find_by_title(arg1)
visit project_issue_path(issue.project, issue)
end
Given /^I submit new issue "(.*?)"$/ do |arg1| Given /^I submit new issue "(.*?)"$/ do |arg1|
fill_in "issue_title", with: arg1 fill_in "issue_title", with: arg1
click_button "Submit new issue" click_button "Submit new issue"
@ -55,3 +46,12 @@ Then /^I should see label "(.*?)"$/ do |arg1|
page.should have_content arg1 page.should have_content arg1
end end
end end
Given /^I fill in issue search with "(.*?)"$/ do |arg1|
# Because fill_in, with: "" triggers nothing
# we need to trigger a keyup event
if arg1 == ''
page.execute_script("$('.issue_search').val('').keyup();");
end
fill_in 'issue_search', with: arg1
end

View file

@ -8,10 +8,6 @@ Given /^project "(.*?)" have "(.*?)" closed merge request$/ do |arg1, arg2|
Factory.create(:merge_request, :title => arg2, :project => project, :author => project.users.first, :closed => true) Factory.create(:merge_request, :title => arg2, :project => project, :author => project.users.first, :closed => true)
end end
Given /^I visit project "(.*?)" merge requests page$/ do |arg1|
visit project_merge_requests_path(Project.find_by_name(arg1))
end
Then /^I should see "(.*?)" in merge requests$/ do |arg1| Then /^I should see "(.*?)" in merge requests$/ do |arg1|
page.should have_content arg1 page.should have_content arg1
end end
@ -34,11 +30,6 @@ Given /^I submit new merge request "(.*?)"$/ do |arg1|
click_button "Save" click_button "Save"
end end
Given /^I visit merge request page "(.*?)"$/ do |arg1|
mr = MergeRequest.find_by_title(arg1)
visit project_merge_request_path(mr.project, mr)
end
Then /^I should see closed merge request "(.*?)"$/ do |arg1| Then /^I should see closed merge request "(.*?)"$/ do |arg1|
mr = MergeRequest.find_by_title(arg1) mr = MergeRequest.find_by_title(arg1)
mr.closed.should be_true mr.closed.should be_true

View file

@ -12,11 +12,6 @@ Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2|
end end
end end
Given /^I visit project "(.*?)" milestones page$/ do |arg1|
@project = Project.find_by_name(arg1)
visit project_milestones_path(@project)
end
Then /^I should see active milestones$/ do Then /^I should see active milestones$/ do
milestone = @project.milestones.first milestone = @project.milestones.first
page.should have_content(milestone.title[0..10]) page.should have_content(milestone.title[0..10])

View file

@ -8,10 +8,6 @@ Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2|
project.add_access(user, :write) project.add_access(user, :write)
end end
Given /^I visit project "(.*?)" team page$/ do |arg1|
visit team_project_path(Project.find_by_name(arg1))
end
Then /^I should be able to see myself in team$/ do Then /^I should be able to see myself in team$/ do
page.should have_content(@user.name) page.should have_content(@user.name)
page.should have_content(@user.email) page.should have_content(@user.email)
@ -23,10 +19,6 @@ Then /^I should see "(.*?)" in team list$/ do |arg1|
page.should have_content(user.email) page.should have_content(user.email)
end end
Given /^I click link "(.*?)"$/ do |arg1|
click_link arg1
end
Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2| Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2|
user = User.find_by_name(arg1) user = User.find_by_name(arg1)
within "#new_team_member" do within "#new_team_member" do

View file

@ -1,7 +1,3 @@
Given /^I visit project wiki page$/ do
visit project_wiki_path(@project, :index)
end
Given /^I create Wiki page$/ do Given /^I create Wiki page$/ do
fill_in "Title", :with => 'Test title' fill_in "Title", :with => 'Test title'
fill_in "Content", :with => '[link test](test)' fill_in "Content", :with => '[link test](test)'

View file

@ -1,9 +1,3 @@
include LoginHelpers
Given /^I signin as a user$/ do
login_as :user
end
When /^I visit new project page$/ do When /^I visit new project page$/ do
visit new_project_path visit new_project_path
end end
@ -65,10 +59,6 @@ Given /^I visit project "(.*?)" network page$/ do |arg1|
visit graph_project_path(project) visit graph_project_path(project)
end end
Given /^show me page$/ do
save_and_open_page
end
Given /^page should have network graph$/ do Given /^page should have network graph$/ do
page.should have_content "Project Network Graph" page.should have_content "Project Network Graph"
within ".graph" do within ".graph" do

View file

@ -0,0 +1,91 @@
Given /^I visit project "(.*?)" issues page$/ do |arg1|
visit project_issues_path(Project.find_by_name(arg1))
end
Given /^I visit issue page "(.*?)"$/ do |arg1|
issue = Issue.find_by_title(arg1)
visit project_issue_path(issue.project, issue)
end
Given /^I visit project "(.*?)" merge requests page$/ do |arg1|
visit project_merge_requests_path(Project.find_by_name(arg1))
end
Given /^I visit merge request page "(.*?)"$/ do |arg1|
mr = MergeRequest.find_by_title(arg1)
visit project_merge_request_path(mr.project, mr)
end
Given /^I visit project "(.*?)" milestones page$/ do |arg1|
@project = Project.find_by_name(arg1)
visit project_milestones_path(@project)
end
Given /^I visit project commits page$/ do
visit project_commits_path(@project)
end
Given /^I visit compare refs page$/ do
visit compare_project_commits_path(@project)
end
Given /^I visit project branches page$/ do
visit branches_project_repository_path(@project)
end
Given /^I visit project commit page$/ do
visit project_commit_path(@project, ValidCommit::ID)
end
Given /^I visit project tags page$/ do
visit tags_project_repository_path(@project)
end
Given /^I click on commit link$/ do
visit project_commit_path(@project, ValidCommit::ID)
end
Given /^I visit project source page$/ do
visit tree_project_ref_path(@project, @project.root_ref)
end
Given /^I visit project source page for "(.*?)"$/ do |arg1|
visit tree_project_ref_path(@project, arg1)
end
Given /^I visit blob file from repo$/ do
visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
end
Given /^I visit project "(.*?)" team page$/ do |arg1|
visit team_project_path(Project.find_by_name(arg1))
end
Given /^I visit project wiki page$/ do
visit project_wiki_path(@project, :index)
end
Given /^I visit profile page$/ do
visit profile_path
end
Given /^I visit profile token page$/ do
visit profile_token_path
end
Given /^I visit profile password page$/ do
visit profile_password_path
end
Given /^I visit dashboard page$/ do
visit dashboard_path
end
Given /^I visit dashboard issues page$/ do
visit dashboard_issues_path
end
Given /^I visit dashboard merge requests page$/ do
visit dashboard_merge_requests_path
end

View file

@ -7,6 +7,7 @@ describe Issue do
describe "Validation" do describe "Validation" do
it { should ensure_length_of(:description).is_within(0..2000) } it { should ensure_length_of(:description).is_within(0..2000) }
it { should ensure_inclusion_of(:closed).in_array([true, false]) }
end end
describe 'modules' do describe 'modules' do

View file

@ -9,6 +9,7 @@ describe Milestone do
describe "Validation" do describe "Validation" do
it { should validate_presence_of(:title) } it { should validate_presence_of(:title) }
it { should validate_presence_of(:project_id) } it { should validate_presence_of(:project_id) }
it { should ensure_inclusion_of(:closed).in_array([true, false]) }
end end
let(:milestone) { Factory :milestone } let(:milestone) { Factory :milestone }

View file

@ -37,6 +37,10 @@ describe Project do
# TODO: Formats # TODO: Formats
it { should validate_presence_of(:owner) } it { should validate_presence_of(:owner) }
it { should ensure_inclusion_of(:issues_enabled).in_array([true, false]) }
it { should ensure_inclusion_of(:wall_enabled).in_array([true, false]) }
it { should ensure_inclusion_of(:merge_requests_enabled).in_array([true, false]) }
it { should ensure_inclusion_of(:wiki_enabled).in_array([true, false]) }
it "should not allow new projects beyond user limits" do it "should not allow new projects beyond user limits" do
project.stub(:owner).and_return(double(can_create_project?: false, projects_limit: 1)) project.stub(:owner).and_return(double(can_create_project?: false, projects_limit: 1))