summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-03-01 10:15:46 -0600
committerJose Ivan Vargas <jvargas@gitlab.com>2017-03-06 09:47:44 -0600
commitbd9887e61701492dc331d188d5b0e1740b037ea3 (patch)
tree6f39ac52c9e6f406565fb5df83f018e0ce355d6f
parent43958926c5310642f2fc0c6f72952004d2ca5089 (diff)
downloadgitlab-ce-bd9887e61701492dc331d188d5b0e1740b037ea3.tar.gz
Fixed repository_controller_spec
also added an #open_branches private method
-rw-r--r--app/controllers/projects/settings/repository_controller.rb11
-rw-r--r--spec/controllers/projects/settings/repository_controller_spec.rb2
2 files changed, 8 insertions, 5 deletions
diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb
index 7a1edee0822..a9d10dcddef 100644
--- a/app/controllers/projects/settings/repository_controller.rb
+++ b/app/controllers/projects/settings/repository_controller.rb
@@ -5,7 +5,7 @@ module Projects
def show
@deploy_keys = DeployKeysPresenter
- .new(@project, current_user: @current_user)
+ .new(@project, current_user: current_user)
define_protected_branches
end
@@ -37,10 +37,13 @@ module Projects
}
end
+ def open_branches
+ branches = @project.open_branches.map { |br| { text: br.name, id: br.name, title: br.name } }
+ { open_branches: branches }
+ end
+
def load_gon_index
- open_branches = @project.open_branches.map { |br| { text: br.name, id: br.name, title: br.name } }
- params = { open_branches: open_branches }
- gon.push(params.merge(access_levels_options))
+ gon.push(open_branches.merge(access_levels_options))
end
end
end
diff --git a/spec/controllers/projects/settings/repository_controller_spec.rb b/spec/controllers/projects/settings/repository_controller_spec.rb
index 77faf96033d..f73471f8ca8 100644
--- a/spec/controllers/projects/settings/repository_controller_spec.rb
+++ b/spec/controllers/projects/settings/repository_controller_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Projects::Settings::RepositoryController do
- let(:project) { create(:empty_project, :public) }
+ let(:project) { create(:project_empty_repo, :public) }
let(:user) { create(:user) }
before do