From e3d7ce2cc482a730b2dc63ca09057b22a960b998 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 5 Jan 2013 12:12:02 +0200 Subject: [PATCH] Tests are fixed now --- app/assets/stylesheets/sections/events.scss | 6 ++++++ app/controllers/projects_controller.rb | 2 +- app/views/admin/projects/_form.html.haml | 18 +++++++++--------- app/views/events/event/_note.html.haml | 5 ++--- spec/models/merge_request_spec.rb | 2 +- spec/models/protected_branch_spec.rb | 9 --------- 6 files changed, 19 insertions(+), 23 deletions(-) diff --git a/app/assets/stylesheets/sections/events.scss b/app/assets/stylesheets/sections/events.scss index 071a9c35..2d41de25 100644 --- a/app/assets/stylesheets/sections/events.scss +++ b/app/assets/stylesheets/sections/events.scss @@ -47,6 +47,12 @@ .event-info { color: #666; } + .event-note { + padding-top: 5px; + padding-left: 5px; + display: inline-block; + color: #777; + } } .avatar { position: relative; diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 0df30220..1a9c890c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -101,7 +101,7 @@ class ProjectsController < ProjectResourceController return access_denied! unless can?(current_user, :remove_project, project) # Delete team first in order to prevent multiple gitolite calls - project.truncate_team + project.team.truncate project.destroy diff --git a/app/views/admin/projects/_form.html.haml b/app/views/admin/projects/_form.html.haml index 534c4222..36c0c655 100644 --- a/app/views/admin/projects/_form.html.haml +++ b/app/views/admin/projects/_form.html.haml @@ -11,18 +11,18 @@ .input = f.text_field :name, placeholder: "Example Project", class: "xxlarge" - %fieldset.adv_settings - %legend Advanced settings: - .clearfix - = f.label :path do - Path - .input - = text_field_tag :ppath, @project.path_to_repo, class: "xlarge", disabled: true + - if project.repo_exists? + %fieldset.adv_settings + %legend Advanced settings: + .clearfix + = f.label :path do + Path + .input + = text_field_tag :ppath, @project.repository.path_to_repo, class: "xlarge", disabled: true - - if project.repo_exists? .clearfix = f.label :default_branch, "Default Branch" - .input= f.select(:default_branch, repository.heads.map(&:name), {}, style: "width:210px;") + .input= f.select(:default_branch, @project.repository.heads.map(&:name), {}, style: "width:210px;") %fieldset.adv_settings %legend Features: diff --git a/app/views/events/event/_note.html.haml b/app/views/events/event/_note.html.haml index 8c129693..7b57f424 100644 --- a/app/views/events/event/_note.html.haml +++ b/app/views/events/event/_note.html.haml @@ -19,7 +19,6 @@ = event.project_name .event-body - %span.hint -   - %i.icon-comment + %span.event-note + %i.icon-comment-alt = truncate event.target.note, length: 70 diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 5642ba7e..41f4ede5 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -40,7 +40,7 @@ describe MergeRequest do let!(:merge_request) { create(:merge_request) } before do - merge_request.stub(:commits) { [merge_request.project.commit] } + merge_request.stub(:commits) { [merge_request.project.repository.commit] } create(:note, commit_id: merge_request.commits.first.id, noteable_type: 'Commit') create(:note, noteable: merge_request) end diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb index 0835666a..c4d2e2f4 100644 --- a/spec/models/protected_branch_spec.rb +++ b/spec/models/protected_branch_spec.rb @@ -39,13 +39,4 @@ describe ProtectedBranch do branch.destroy end end - - describe '#commit' do - let(:branch) { create(:protected_branch) } - - it 'commits itself to its project' do - branch.project.repository.should_receive(:commit).with(branch.name) - branch.commit - end - end end