Commit ef5b36eaaf92db19ae90cc599c3f64b865bdc4d5
1 parent
afbdbb0c
Exists in
master
and in
4 other branches
Fixed protected branches and file edit
Showing
9 changed files
with
21 additions
and
20 deletions
Show diff stats
app/controllers/admin/users_controller.rb
| @@ -19,9 +19,9 @@ class Admin::UsersController < AdminController | @@ -19,9 +19,9 @@ class Admin::UsersController < AdminController | ||
| 19 | def team_update | 19 | def team_update |
| 20 | @admin_user = User.find(params[:id]) | 20 | @admin_user = User.find(params[:id]) |
| 21 | 21 | ||
| 22 | - UsersProject.user_bulk_import( | ||
| 23 | - @admin_user, | 22 | + UsersProject.add_users_into_projects( |
| 24 | params[:project_ids], | 23 | params[:project_ids], |
| 24 | + [@admin_user.id], | ||
| 25 | params[:project_access] | 25 | params[:project_access] |
| 26 | ) | 26 | ) |
| 27 | 27 |
app/controllers/tree_controller.rb
| @@ -22,7 +22,7 @@ class TreeController < ProjectResourceController | @@ -22,7 +22,7 @@ class TreeController < ProjectResourceController | ||
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | def edit | 24 | def edit |
| 25 | - @last_commit = @project.last_commit_for(@ref, @path).sha | 25 | + @last_commit = @project.repository.last_commit_for(@ref, @path).sha |
| 26 | end | 26 | end |
| 27 | 27 | ||
| 28 | def update | 28 | def update |
app/models/users_project.rb
| @@ -128,16 +128,6 @@ class UsersProject < ActiveRecord::Base | @@ -128,16 +128,6 @@ class UsersProject < ActiveRecord::Base | ||
| 128 | end | 128 | end |
| 129 | end | 129 | end |
| 130 | 130 | ||
| 131 | - # TODO: depreceate in future in favor of add_users_into_projects | ||
| 132 | - def bulk_import(project, user_ids, project_access) | ||
| 133 | - add_users_into_projects([project.id], user_ids, project_access) | ||
| 134 | - end | ||
| 135 | - | ||
| 136 | - # TODO: depreceate in future in favor of add_users_into_projects | ||
| 137 | - def user_bulk_import(user, project_ids, project_access) | ||
| 138 | - add_users_into_projects(project_ids, [user.id], project_access) | ||
| 139 | - end | ||
| 140 | - | ||
| 141 | def roles_hash | 131 | def roles_hash |
| 142 | { | 132 | { |
| 143 | guest: GUEST, | 133 | guest: GUEST, |
app/views/protected_branches/index.html.haml
| @@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
| 36 | %td | 36 | %td |
| 37 | = link_to project_commits_path(@project, branch.name) do | 37 | = link_to project_commits_path(@project, branch.name) do |
| 38 | %strong= branch.name | 38 | %strong= branch.name |
| 39 | - - if branch.name == @project.root_ref | 39 | + - if @project.root_ref?(branch.name) |
| 40 | %span.label default | 40 | %span.label default |
| 41 | %td | 41 | %td |
| 42 | - if branch.commit | 42 | - if branch.commit |
app/views/repositories/_feed.html.haml
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | = link_to project_commits_path(@project, commit.head.name) do | 5 | = link_to project_commits_path(@project, commit.head.name) do |
| 6 | %strong | 6 | %strong |
| 7 | = commit.head.name | 7 | = commit.head.name |
| 8 | - - if commit.head.name == @project.root_ref | 8 | + - if @project.root_ref?(commit.head.name) |
| 9 | %span.label default | 9 | %span.label default |
| 10 | 10 | ||
| 11 | %td | 11 | %td |
features/steps/project/create_project.rb
| @@ -3,13 +3,13 @@ class CreateProject < Spinach::FeatureSteps | @@ -3,13 +3,13 @@ class CreateProject < Spinach::FeatureSteps | ||
| 3 | include SharedPaths | 3 | include SharedPaths |
| 4 | 4 | ||
| 5 | And 'fill project form with valid data' do | 5 | And 'fill project form with valid data' do |
| 6 | - fill_in 'project_name', :with => 'NewProject' | 6 | + fill_in 'project_name', with: 'Empty' |
| 7 | click_button "Create project" | 7 | click_button "Create project" |
| 8 | end | 8 | end |
| 9 | 9 | ||
| 10 | Then 'I should see project page' do | 10 | Then 'I should see project page' do |
| 11 | current_path.should == project_path(Project.last) | 11 | current_path.should == project_path(Project.last) |
| 12 | - page.should have_content "NewProject" | 12 | + page.should have_content "Empty" |
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | And 'I should see empty project instuctions' do | 15 | And 'I should see empty project instuctions' do |
features/steps/project/project_browse_commits.rb
| @@ -48,7 +48,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps | @@ -48,7 +48,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps | ||
| 48 | page.should have_selector('ul.breadcrumb span.divider', count: 3) | 48 | page.should have_selector('ul.breadcrumb span.divider', count: 3) |
| 49 | page.should have_selector('ul.breadcrumb a', count: 4) | 49 | page.should have_selector('ul.breadcrumb a', count: 4) |
| 50 | 50 | ||
| 51 | - find('ul.breadcrumb li:first a')['href'].should match(/#{@project.path}\/commits\/master\z/) | 51 | + find('ul.breadcrumb li:first a')['href'].should match(/#{@project.path_with_namespace}\/commits\/master\z/) |
| 52 | find('ul.breadcrumb li:last a')['href'].should match(%r{master/app/models/project\.rb\z}) | 52 | find('ul.breadcrumb li:last a')['href'].should match(%r{master/app/models/project\.rb\z}) |
| 53 | end | 53 | end |
| 54 | 54 |
spec/models/commit_spec.rb
| 1 | require 'spec_helper' | 1 | require 'spec_helper' |
| 2 | 2 | ||
| 3 | describe Commit do | 3 | describe Commit do |
| 4 | - let(:commit) { create(:project).commit } | 4 | + let(:commit) { create(:project).repository.commit } |
| 5 | 5 | ||
| 6 | describe CommitDecorator do | 6 | describe CommitDecorator do |
| 7 | let(:decorator) { CommitDecorator.new(commit) } | 7 | let(:decorator) { CommitDecorator.new(commit) } |
spec/support/stubbed_repository.rb
| 1 | +require "repository" | ||
| 2 | +require "project" | ||
| 3 | + | ||
| 1 | # Stubs out all Git repository access done by models so that specs can run | 4 | # Stubs out all Git repository access done by models so that specs can run |
| 2 | # against fake repositories without Grit complaining that they don't exist. | 5 | # against fake repositories without Grit complaining that they don't exist. |
| 3 | class Project | 6 | class Project |
| 7 | + def repository | ||
| 8 | + if path == "empty" || !path | ||
| 9 | + nil | ||
| 10 | + else | ||
| 11 | + GitLabTestRepo.new(path_with_namespace) | ||
| 12 | + end | ||
| 13 | + end | ||
| 14 | + | ||
| 4 | def satellite | 15 | def satellite |
| 5 | FakeSatellite.new | 16 | FakeSatellite.new |
| 6 | end | 17 | end |
| @@ -16,7 +27,7 @@ class Project | @@ -16,7 +27,7 @@ class Project | ||
| 16 | end | 27 | end |
| 17 | end | 28 | end |
| 18 | 29 | ||
| 19 | -class Repository | 30 | +class GitLabTestRepo < Repository |
| 20 | def repo | 31 | def repo |
| 21 | @repo ||= Grit::Repo.new(Rails.root.join('tmp', 'repositories', 'gitlabhq')) | 32 | @repo ||= Grit::Repo.new(Rails.root.join('tmp', 'repositories', 'gitlabhq')) |
| 22 | end | 33 | end |