diff options
-rw-r--r-- | app/models/event.rb | 6 | ||||
-rw-r--r-- | app/views/projects/branches/index.html.haml | 2 | ||||
-rw-r--r-- | features/project/commits/branches.feature | 12 | ||||
-rw-r--r-- | features/steps/project/project_browse_branches.rb | 28 |
4 files changed, 31 insertions, 17 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index ddb863c1be2..d43d6eb682f 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -56,11 +56,13 @@ class Event < ActiveRecord::Base end def create_ref_event(project, user, ref, action = 'add', prefix = 'refs/heads') + commit = project.repository.commit(ref.target) + if action.to_s == 'add' before = '00000000' - after = ref.commit.id + after = commit.id else - before = ref.commit.id + before = commit.id after = '00000000' end diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml index 690df98a2ab..bee04eb013e 100644 --- a/app/views/projects/branches/index.html.haml +++ b/app/views/projects/branches/index.html.haml @@ -4,7 +4,7 @@ = render "filter" .col-md-9 - unless @branches.empty? - %ul.bordered-list.top-list + %ul.bordered-list.top-list.all-branches - @branches.each do |branch| = render "projects/branches/branch", branch: branch = paginate @branches, theme: 'gitlab' diff --git a/features/project/commits/branches.feature b/features/project/commits/branches.feature index 4fa4dc26a1b..fcf8b7694f4 100644 --- a/features/project/commits/branches.feature +++ b/features/project/commits/branches.feature @@ -16,11 +16,7 @@ Feature: Project Browse branches Given I click link "Protected" Then I should see "Shop" protected branches list - # @wip - # Scenario: I can download project by branch - - # @wip - # Scenario: I can view protected branches - - # @wip - # Scenario: I can manage protected branches + Scenario: I create a branch + Given I click new branch link + When I submit new branch form + Then I should see new branch created diff --git a/features/steps/project/project_browse_branches.rb b/features/steps/project/project_browse_branches.rb index ef29cc67a4e..30c8cef80c8 100644 --- a/features/steps/project/project_browse_branches.rb +++ b/features/steps/project/project_browse_branches.rb @@ -3,33 +3,49 @@ class ProjectBrowseBranches < Spinach::FeatureSteps include SharedProject 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 "master" end - Given 'I click link "All"' do + step 'I click link "All"' do click_link "All" 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 "master" end - Given 'I click link "Protected"' do + step 'I click link "Protected"' do click_link "Protected" end - Then 'I should see "Shop" protected branches list' do + step 'I should see "Shop" protected branches list' do within ".protected-branches-list" do page.should have_content "stable" page.should_not have_content "master" end end - And 'project "Shop" has protected branches' do + step 'project "Shop" has protected branches' do project = Project.find_by(name: "Shop") project.protected_branches.create(name: "stable") 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 |