Commit 31386adf authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fixed 500 error on branch and tag creation via UI

Also fixes issue with branch/tag removing via UI
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 6c660698
...@@ -56,11 +56,13 @@ class Event < ActiveRecord::Base ...@@ -56,11 +56,13 @@ class Event < ActiveRecord::Base
end end
def create_ref_event(project, user, ref, action = 'add', prefix = 'refs/heads') def create_ref_event(project, user, ref, action = 'add', prefix = 'refs/heads')
commit = project.repository.commit(ref.target)
if action.to_s == 'add' if action.to_s == 'add'
before = '00000000' before = '00000000'
after = ref.commit.id after = commit.id
else else
before = ref.commit.id before = commit.id
after = '00000000' after = '00000000'
end end
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
= render "filter" = render "filter"
.col-md-9 .col-md-9
- unless @branches.empty? - unless @branches.empty?
%ul.bordered-list.top-list %ul.bordered-list.top-list.all-branches
- @branches.each do |branch| - @branches.each do |branch|
= render "projects/branches/branch", branch: branch = render "projects/branches/branch", branch: branch
= paginate @branches, theme: 'gitlab' = paginate @branches, theme: 'gitlab'
...@@ -16,11 +16,7 @@ Feature: Project Browse branches ...@@ -16,11 +16,7 @@ Feature: Project Browse branches
Given I click link "Protected" Given I click link "Protected"
Then I should see "Shop" protected branches list Then I should see "Shop" protected branches list
# @wip Scenario: I create a branch
# Scenario: I can download project by branch Given I click new branch link
When I submit new branch form
# @wip Then I should see new branch created
# Scenario: I can view protected branches
# @wip
# Scenario: I can manage protected branches
...@@ -3,33 +3,49 @@ class ProjectBrowseBranches < Spinach::FeatureSteps ...@@ -3,33 +3,49 @@ class ProjectBrowseBranches < Spinach::FeatureSteps
include SharedProject include SharedProject
include SharedPaths include SharedPaths
Then 'I should see "Shop" recent branches list' do step 'I should see "Shop" recent branches list' do
page.should have_content "Branches" page.should have_content "Branches"
page.should have_content "master" page.should have_content "master"
end end
Given 'I click link "All"' do step 'I click link "All"' do
click_link "All" click_link "All"
end end
Then 'I should see "Shop" all branches list' do step 'I should see "Shop" all branches list' do
page.should have_content "Branches" page.should have_content "Branches"
page.should have_content "master" page.should have_content "master"
end end
Given 'I click link "Protected"' do step 'I click link "Protected"' do
click_link "Protected" click_link "Protected"
end end
Then 'I should see "Shop" protected branches list' do step 'I should see "Shop" protected branches list' do
within ".protected-branches-list" do within ".protected-branches-list" do
page.should have_content "stable" page.should have_content "stable"
page.should_not have_content "master" page.should_not have_content "master"
end end
end end
And 'project "Shop" has protected branches' do step 'project "Shop" has protected branches' do
project = Project.find_by(name: "Shop") project = Project.find_by(name: "Shop")
project.protected_branches.create(name: "stable") project.protected_branches.create(name: "stable")
end end
step 'I click new branch link' do
click_link "New branch"
end
step 'I submit new branch form' do
fill_in 'branch_name', with: 'deploy_keys'
fill_in 'ref', with: 'master'
click_button 'Create branch'
end
step 'I should see new branch created' do
within '.all-branches' do
page.should have_content 'deploy_keys'
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment