Commit ca52f848411efaa5ccfb364c2169b38a8e9644b4
1 parent
f4978bc0
Exists in
master
and in
4 other branches
Update chosen, improve ui, fix MR fork tests
Showing
10 changed files
with
99 additions
and
82 deletions
Show diff stats
Gemfile
| @@ -129,7 +129,7 @@ group :assets do | @@ -129,7 +129,7 @@ group :assets do | ||
| 129 | gem 'turbolinks' | 129 | gem 'turbolinks' |
| 130 | gem 'jquery-turbolinks' | 130 | gem 'jquery-turbolinks' |
| 131 | 131 | ||
| 132 | - gem 'chosen-rails', "0.9.8" | 132 | + gem 'chosen-rails', "1.0.0" |
| 133 | gem 'select2-rails' | 133 | gem 'select2-rails' |
| 134 | gem 'jquery-atwho-rails', "0.3.0" | 134 | gem 'jquery-atwho-rails', "0.3.0" |
| 135 | gem "jquery-rails", "2.1.3" | 135 | gem "jquery-rails", "2.1.3" |
Gemfile.lock
| @@ -72,9 +72,12 @@ GEM | @@ -72,9 +72,12 @@ GEM | ||
| 72 | charlock_holmes (0.6.9.4) | 72 | charlock_holmes (0.6.9.4) |
| 73 | childprocess (0.3.9) | 73 | childprocess (0.3.9) |
| 74 | ffi (~> 1.0, >= 1.0.11) | 74 | ffi (~> 1.0, >= 1.0.11) |
| 75 | - chosen-rails (0.9.8) | ||
| 76 | - railties (~> 3.0) | ||
| 77 | - thor (~> 0.14) | 75 | + chosen-rails (1.0.0) |
| 76 | + coffee-rails (>= 3.2) | ||
| 77 | + compass-rails (>= 1.0) | ||
| 78 | + railties (>= 3.0) | ||
| 79 | + sass-rails (>= 3.2) | ||
| 80 | + chunky_png (1.2.8) | ||
| 78 | code_analyzer (0.3.2) | 81 | code_analyzer (0.3.2) |
| 79 | sexp_processor | 82 | sexp_processor |
| 80 | coderay (1.0.9) | 83 | coderay (1.0.9) |
| @@ -87,6 +90,12 @@ GEM | @@ -87,6 +90,12 @@ GEM | ||
| 87 | coffee-script-source (1.6.2) | 90 | coffee-script-source (1.6.2) |
| 88 | colored (1.2) | 91 | colored (1.2) |
| 89 | colorize (0.5.8) | 92 | colorize (0.5.8) |
| 93 | + compass (0.12.2) | ||
| 94 | + chunky_png (~> 1.2) | ||
| 95 | + fssm (>= 0.2.7) | ||
| 96 | + sass (~> 3.1) | ||
| 97 | + compass-rails (1.0.3) | ||
| 98 | + compass (>= 0.12.2, < 0.14) | ||
| 90 | connection_pool (1.1.0) | 99 | connection_pool (1.1.0) |
| 91 | coveralls (0.6.7) | 100 | coveralls (0.6.7) |
| 92 | colorize | 101 | colorize |
| @@ -149,6 +158,7 @@ GEM | @@ -149,6 +158,7 @@ GEM | ||
| 149 | dotenv (>= 0.7) | 158 | dotenv (>= 0.7) |
| 150 | thor (>= 0.13.6) | 159 | thor (>= 0.13.6) |
| 151 | formatador (0.2.4) | 160 | formatador (0.2.4) |
| 161 | + fssm (0.2.10) | ||
| 152 | gemoji (1.2.1) | 162 | gemoji (1.2.1) |
| 153 | gherkin-ruby (0.3.0) | 163 | gherkin-ruby (0.3.0) |
| 154 | github-linguist (2.3.4) | 164 | github-linguist (2.3.4) |
| @@ -548,7 +558,7 @@ DEPENDENCIES | @@ -548,7 +558,7 @@ DEPENDENCIES | ||
| 548 | bootstrap-sass | 558 | bootstrap-sass |
| 549 | capybara | 559 | capybara |
| 550 | carrierwave | 560 | carrierwave |
| 551 | - chosen-rails (= 0.9.8) | 561 | + chosen-rails (= 1.0.0) |
| 552 | coffee-rails | 562 | coffee-rails |
| 553 | colored | 563 | colored |
| 554 | coveralls | 564 | coveralls |
app/assets/stylesheets/selects.scss
| 1 | /* CHZN reset few styles */ | 1 | /* CHZN reset few styles */ |
| 2 | -.chzn-container-single .chzn-single { | 2 | +.chosen-container-single .chosen-single { |
| 3 | background: #FFF; | 3 | background: #FFF; |
| 4 | border: 1px solid #bbb; | 4 | border: 1px solid #bbb; |
| 5 | box-shadow: none; | 5 | box-shadow: none; |
| 6 | } | 6 | } |
| 7 | -.chzn-container-active .chzn-single { | 7 | +.chosen-container-active .chosen-single { |
| 8 | background: #fff; | 8 | background: #fff; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| @@ -41,38 +41,38 @@ | @@ -41,38 +41,38 @@ | ||
| 41 | width: 120px; | 41 | width: 120px; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | -.project-refs-form .chzn-container { | 44 | +.project-refs-form .chosen-container { |
| 45 | position: relative; | 45 | position: relative; |
| 46 | top: 0; | 46 | top: 0; |
| 47 | left: 0; | 47 | left: 0; |
| 48 | margin-right: 10px; | 48 | margin-right: 10px; |
| 49 | 49 | ||
| 50 | - .chzn-drop { | 50 | + .chosen-drop { |
| 51 | min-width: 400px; | 51 | min-width: 400px; |
| 52 | - .chzn-results { | 52 | + .chosen-results { |
| 53 | max-height: 300px; | 53 | max-height: 300px; |
| 54 | } | 54 | } |
| 55 | - .chzn-search input { | 55 | + .chosen-search input { |
| 56 | min-width: 365px; | 56 | min-width: 365px; |
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /** Fix for Search Dropdown Border **/ | 61 | /** Fix for Search Dropdown Border **/ |
| 62 | -.chzn-container { | ||
| 63 | - .chzn-search { | 62 | +.chosen-container { |
| 63 | + .chosen-search { | ||
| 64 | input:focus { | 64 | input:focus { |
| 65 | @include box-shadow(none); | 65 | @include box-shadow(none); |
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | - .chzn-drop { | 69 | + .chosen-drop { |
| 70 | margin: 7px 0; | 70 | margin: 7px 0; |
| 71 | min-width: 200px; | 71 | min-width: 200px; |
| 72 | border: 1px solid #bbb; | 72 | border: 1px solid #bbb; |
| 73 | @include border-radius(0); | 73 | @include border-radius(0); |
| 74 | 74 | ||
| 75 | - .chzn-results { | 75 | + .chosen-results { |
| 76 | margin-top: 5px; | 76 | margin-top: 5px; |
| 77 | max-height: 300px; | 77 | max-height: 300px; |
| 78 | 78 | ||
| @@ -95,7 +95,7 @@ | @@ -95,7 +95,7 @@ | ||
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | - .chzn-search { | 98 | + .chosen-search { |
| 99 | @include bg-gray-gradient; | 99 | @include bg-gray-gradient; |
| 100 | input { | 100 | input { |
| 101 | min-width: 165px; | 101 | min-width: 165px; |
| @@ -104,7 +104,7 @@ | @@ -104,7 +104,7 @@ | ||
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | - .chzn-single { | 107 | + .chosen-single { |
| 108 | @include bg-light-gray-gradient; | 108 | @include bg-light-gray-gradient; |
| 109 | 109 | ||
| 110 | div { | 110 | div { |
app/controllers/projects/merge_requests_controller.rb
| @@ -101,12 +101,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController | @@ -101,12 +101,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController | ||
| 101 | def branch_from | 101 | def branch_from |
| 102 | #This is always source | 102 | #This is always source |
| 103 | @source_project = @merge_request.nil? ? @project : @merge_request.source_project | 103 | @source_project = @merge_request.nil? ? @project : @merge_request.source_project |
| 104 | - @commit = @repository.commit(params[:ref]) | 104 | + @commit = @repository.commit(params[:ref]) if params[:ref].present? |
| 105 | end | 105 | end |
| 106 | 106 | ||
| 107 | def branch_to | 107 | def branch_to |
| 108 | @target_project = selected_target_project | 108 | @target_project = selected_target_project |
| 109 | - @commit = @target_project.repository.commit(params[:ref]) | 109 | + @commit = @target_project.repository.commit(params[:ref]) if params[:ref].present? |
| 110 | end | 110 | end |
| 111 | 111 | ||
| 112 | def update_branches | 112 | def update_branches |
app/views/projects/merge_requests/_form.html.haml
| @@ -13,8 +13,12 @@ | @@ -13,8 +13,12 @@ | ||
| 13 | .span5 | 13 | .span5 |
| 14 | .light-well | 14 | .light-well |
| 15 | %h5.cgray From | 15 | %h5.cgray From |
| 16 | - .padded= f.select(:source_project_id,[[@merge_request.source_project.path_with_namespace,@merge_request.source_project.id]] , {}, {class: 'source_project chosen span4'}) | ||
| 17 | - .padded= f.select(:source_branch, @merge_request.source_project.repository.branch_names, { include_blank: "Select branch" }, {class: 'source_branch chosen span4'}) | 16 | + .padded |
| 17 | + = f.select(:source_project_id,[[@merge_request.source_project.path_with_namespace,@merge_request.source_project.id]] , {}, {class: 'source_project chosen span4'}) | ||
| 18 | + .prepend-top-10 | ||
| 19 | + %i.icon-code-fork | ||
| 20 | + | ||
| 21 | + = f.select(:source_branch, @merge_request.source_project.repository.branch_names, { include_blank: "Select branch" }, {class: 'source_branch chosen span3'}) | ||
| 18 | .mr_source_commit.prepend-top-10 | 22 | .mr_source_commit.prepend-top-10 |
| 19 | .span2 | 23 | .span2 |
| 20 | %h1.merge-request-angle | 24 | %h1.merge-request-angle |
| @@ -23,9 +27,13 @@ | @@ -23,9 +27,13 @@ | ||
| 23 | .light-well | 27 | .light-well |
| 24 | %h5.cgray To | 28 | %h5.cgray To |
| 25 | - projects = @project.forked_from_project.nil? ? [@project] : [ @project,@project.forked_from_project] | 29 | - projects = @project.forked_from_project.nil? ? [@project] : [ @project,@project.forked_from_project] |
| 26 | - .padded= f.select(:target_project_id, projects.map { |proj| [proj.path_with_namespace,proj.id] }, {include_blank: "Select Target Project" }, {class: 'target_project chosen span4'}) | ||
| 27 | - .padded= f.select(:target_branch, @target_branches, { include_blank: "Select branch" }, {class: 'target_branch chosen span4'}) | ||
| 28 | - .mr_target_commit.prepend-top-10 | 30 | + .padded |
| 31 | + = f.select(:target_project_id, projects.map { |proj| [proj.path_with_namespace,proj.id] }, {include_blank: "Select Target Project" }, {class: 'target_project chosen span4'}) | ||
| 32 | + .prepend-top-10 | ||
| 33 | + %i.icon-code-fork | ||
| 34 | + | ||
| 35 | + = f.select(:target_branch, @target_branches, { include_blank: "Select branch" }, {class: 'target_branch chosen span3'}) | ||
| 36 | + .mr_target_commit.prepend-top-10 | ||
| 29 | 37 | ||
| 30 | %hr | 38 | %hr |
| 31 | 39 |
features/project/forked_merge_requests.feature
| @@ -21,14 +21,6 @@ Feature: Project Forked Merge Requests | @@ -21,14 +21,6 @@ Feature: Project Forked Merge Requests | ||
| 21 | Then I should see merge request "Merge Request On Forked Project" | 21 | Then I should see merge request "Merge Request On Forked Project" |
| 22 | 22 | ||
| 23 | @javascript | 23 | @javascript |
| 24 | - Scenario: I should see a push widget for forked merge requests | ||
| 25 | - Given project "Forked Shop" has push event | ||
| 26 | - And I visit dashboard page | ||
| 27 | - Then I should see last push widget | ||
| 28 | - And I click "Create Merge Request on fork" link | ||
| 29 | - Then I see prefilled new Merge Request page for the forked project | ||
| 30 | - | ||
| 31 | - @javascript | ||
| 32 | Scenario: I can edit a forked merge request | 24 | Scenario: I can edit a forked merge request |
| 33 | Given I visit project "Forked Shop" merge requests page | 25 | Given I visit project "Forked Shop" merge requests page |
| 34 | And I click link "New Merge Request" | 26 | And I click link "New Merge Request" |
| @@ -47,4 +39,4 @@ Feature: Project Forked Merge Requests | @@ -47,4 +39,4 @@ Feature: Project Forked Merge Requests | ||
| 47 | And I click link "New Merge Request" | 39 | And I click link "New Merge Request" |
| 48 | And I fill out an invalid "Merge Request On Forked Project" merge request | 40 | And I fill out an invalid "Merge Request On Forked Project" merge request |
| 49 | And I submit the merge request | 41 | And I submit the merge request |
| 50 | - Then I should see validation errors | ||
| 51 | \ No newline at end of file | 42 | \ No newline at end of file |
| 43 | + Then I should see validation errors |
features/steps/project/project_forked_merge_requests.rb
| @@ -3,30 +3,31 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | @@ -3,30 +3,31 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | ||
| 3 | include SharedProject | 3 | include SharedProject |
| 4 | include SharedNote | 4 | include SharedNote |
| 5 | include SharedPaths | 5 | include SharedPaths |
| 6 | + include ChosenHelper | ||
| 6 | 7 | ||
| 7 | - Given 'I am a member of project "Shop"' do | 8 | + step 'I am a member of project "Shop"' do |
| 8 | @project = Project.find_by_name "Shop" | 9 | @project = Project.find_by_name "Shop" |
| 9 | @project ||= create(:project_with_code, name: "Shop") | 10 | @project ||= create(:project_with_code, name: "Shop") |
| 10 | @project.team << [@user, :reporter] | 11 | @project.team << [@user, :reporter] |
| 11 | end | 12 | end |
| 12 | 13 | ||
| 13 | - And 'I have a project forked off of "Shop" called "Forked Shop"' do | 14 | + step 'I have a project forked off of "Shop" called "Forked Shop"' do |
| 14 | @forking_user = @user | 15 | @forking_user = @user |
| 15 | forked_project_link = build(:forked_project_link) | 16 | forked_project_link = build(:forked_project_link) |
| 16 | @forked_project = Project.find_by_name "Forked Shop" | 17 | @forked_project = Project.find_by_name "Forked Shop" |
| 17 | @forked_project ||= create(:source_project_with_code, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace) | 18 | @forked_project ||= create(:source_project_with_code, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace) |
| 19 | + | ||
| 18 | forked_project_link.forked_from_project = @project | 20 | forked_project_link.forked_from_project = @project |
| 19 | forked_project_link.forked_to_project = @forked_project | 21 | forked_project_link.forked_to_project = @forked_project |
| 20 | @forked_project.team << [@forking_user , :master] | 22 | @forked_project.team << [@forking_user , :master] |
| 21 | forked_project_link.save! | 23 | forked_project_link.save! |
| 22 | end | 24 | end |
| 23 | 25 | ||
| 24 | - Given 'I click link "New Merge Request"' do | 26 | + step 'I click link "New Merge Request"' do |
| 25 | click_link "New Merge Request" | 27 | click_link "New Merge Request" |
| 26 | end | 28 | end |
| 27 | 29 | ||
| 28 | - Then 'I should see merge request "Merge Request On Forked Project"' do | ||
| 29 | - page.should have_content "Merge Request On Forked Project" | 30 | + step 'I should see merge request "Merge Request On Forked Project"' do |
| 30 | @project.merge_requests.size.should >= 1 | 31 | @project.merge_requests.size.should >= 1 |
| 31 | @merge_request = @project.merge_requests.last | 32 | @merge_request = @project.merge_requests.last |
| 32 | current_path.should == project_merge_request_path(@project, @merge_request) | 33 | current_path.should == project_merge_request_path(@project, @merge_request) |
| @@ -40,56 +41,41 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | @@ -40,56 +41,41 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | ||
| 40 | page.should have_content @merge_request.target_branch | 41 | page.should have_content @merge_request.target_branch |
| 41 | end | 42 | end |
| 42 | 43 | ||
| 43 | - And 'I fill out a "Merge Request On Forked Project" merge request' do | ||
| 44 | - #The ordering here is a bit whacky on purpose: | ||
| 45 | - #Select the target right away, to give update_branches time to run and clean up the target_branches | ||
| 46 | - find(:select, "merge_request_target_project_id", {}).value.should == @forked_project.id.to_s | ||
| 47 | - select @project.path_with_namespace, from: "merge_request_target_project_id" | ||
| 48 | - | 44 | + step 'I fill out a "Merge Request On Forked Project" merge request' do |
| 45 | + chosen @forked_project.id, from: "#merge_request_source_project_id" | ||
| 46 | + chosen @project.id, from: "#merge_request_target_project_id" | ||
| 49 | 47 | ||
| 50 | - fill_in "merge_request_title", with: "Merge Request On Forked Project" | ||
| 51 | find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s | 48 | find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s |
| 52 | - | ||
| 53 | find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s | 49 | find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s |
| 54 | 50 | ||
| 55 | - #Ensure the option exists in the select | ||
| 56 | - find(:select, "merge_request_source_branch", {}).should have_content "master" | ||
| 57 | - select "master", from: "merge_request_source_branch" | ||
| 58 | - #Ensure the option is selected | ||
| 59 | - find(:select, "merge_request_source_branch", {}).value.should have_content "master" | ||
| 60 | - verify_commit_link(".mr_source_commit",@forked_project) | ||
| 61 | - | 51 | + chosen "master", from: "#merge_request_source_branch" |
| 52 | + chosen "stable", from: "#merge_request_target_branch" | ||
| 62 | 53 | ||
| 63 | - #This could fail if the javascript hasn't run yet, there is a timing issue here -- this is why we do the select at the top | ||
| 64 | - #Ensure the option exists in the select | ||
| 65 | - find(:select, "merge_request_target_branch", {}).should have_content "stable" | ||
| 66 | - #We must give apparently lots of time for update branches to finish | 54 | + find(:select, "merge_request_source_branch", {}).value.should == 'master' |
| 55 | + find(:select, "merge_request_target_branch", {}).value.should == 'stable' | ||
| 67 | 56 | ||
| 68 | - (find(:select, "merge_request_target_branch", {}).find(:option, "stable",{}).select_option).should be_true | ||
| 69 | - #Ensure the option is selected | ||
| 70 | - find(:select, "merge_request_target_branch", {}).value.should have_content "stable" | ||
| 71 | - verify_commit_link(".mr_target_commit",@project) | 57 | + fill_in "merge_request_title", with: "Merge Request On Forked Project" |
| 72 | end | 58 | end |
| 73 | 59 | ||
| 74 | - And 'I submit the merge request' do | 60 | + step 'I submit the merge request' do |
| 75 | click_button "Submit merge request" | 61 | click_button "Submit merge request" |
| 76 | end | 62 | end |
| 77 | 63 | ||
| 78 | - And 'I follow the target commit link' do | 64 | + step 'I follow the target commit link' do |
| 79 | commit = @project.repository.commit | 65 | commit = @project.repository.commit |
| 80 | click_link commit.short_id(8) | 66 | click_link commit.short_id(8) |
| 81 | end | 67 | end |
| 82 | 68 | ||
| 83 | - Then 'I should see the commit under the forked from project' do | 69 | + step 'I should see the commit under the forked from project' do |
| 84 | commit = @project.repository.commit | 70 | commit = @project.repository.commit |
| 85 | page.should have_content(commit.message) | 71 | page.should have_content(commit.message) |
| 86 | end | 72 | end |
| 87 | 73 | ||
| 88 | - And 'I click "Create Merge Request on fork" link' do | 74 | + step 'I click "Create Merge Request on fork" link' do |
| 89 | click_link "Create Merge Request on fork" | 75 | click_link "Create Merge Request on fork" |
| 90 | end | 76 | end |
| 91 | 77 | ||
| 92 | - Then 'I see prefilled new Merge Request page for the forked project' do | 78 | + step 'I see prefilled new Merge Request page for the forked project' do |
| 93 | current_path.should == new_project_merge_request_path(@forked_project) | 79 | current_path.should == new_project_merge_request_path(@forked_project) |
| 94 | find("#merge_request_source_project_id").value.should == @forked_project.id.to_s | 80 | find("#merge_request_source_project_id").value.should == @forked_project.id.to_s |
| 95 | find("#merge_request_target_project_id").value.should == @project.id.to_s | 81 | find("#merge_request_target_project_id").value.should == @project.id.to_s |
| @@ -100,15 +86,15 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | @@ -100,15 +86,15 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | ||
| 100 | verify_commit_link(".mr_source_commit",@forked_project) | 86 | verify_commit_link(".mr_source_commit",@forked_project) |
| 101 | end | 87 | end |
| 102 | 88 | ||
| 103 | - And 'I update the merge request title' do | 89 | + step 'I update the merge request title' do |
| 104 | fill_in "merge_request_title", with: "An Edited Forked Merge Request" | 90 | fill_in "merge_request_title", with: "An Edited Forked Merge Request" |
| 105 | end | 91 | end |
| 106 | 92 | ||
| 107 | - And 'I save the merge request' do | 93 | + step 'I save the merge request' do |
| 108 | click_button "Save changes" | 94 | click_button "Save changes" |
| 109 | end | 95 | end |
| 110 | 96 | ||
| 111 | - Then 'I should see the edited merge request' do | 97 | + step 'I should see the edited merge request' do |
| 112 | page.should have_content "An Edited Forked Merge Request" | 98 | page.should have_content "An Edited Forked Merge Request" |
| 113 | @project.merge_requests.size.should >= 1 | 99 | @project.merge_requests.size.should >= 1 |
| 114 | @merge_request = @project.merge_requests.last | 100 | @merge_request = @project.merge_requests.last |
| @@ -122,12 +108,12 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | @@ -122,12 +108,12 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | ||
| 122 | page.should have_content @merge_request.target_branch | 108 | page.should have_content @merge_request.target_branch |
| 123 | end | 109 | end |
| 124 | 110 | ||
| 125 | - Then 'I should see last push widget' do | 111 | + step 'I should see last push widget' do |
| 126 | page.should have_content "You pushed to new_design" | 112 | page.should have_content "You pushed to new_design" |
| 127 | page.should have_link "Create Merge Request" | 113 | page.should have_link "Create Merge Request" |
| 128 | end | 114 | end |
| 129 | 115 | ||
| 130 | - Given 'project "Forked Shop" has push event' do | 116 | + step 'project "Forked Shop" has push event' do |
| 131 | @forked_project = Project.find_by_name("Forked Shop") | 117 | @forked_project = Project.find_by_name("Forked Shop") |
| 132 | 118 | ||
| 133 | data = { | 119 | data = { |
| @@ -154,13 +140,13 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | @@ -154,13 +140,13 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | ||
| 154 | end | 140 | end |
| 155 | 141 | ||
| 156 | 142 | ||
| 157 | - Then 'I click link edit "Merge Request On Forked Project"' do | 143 | + step 'I click link edit "Merge Request On Forked Project"' do |
| 158 | find("#edit_merge_request").click | 144 | find("#edit_merge_request").click |
| 159 | end | 145 | end |
| 160 | 146 | ||
| 161 | - Then 'I see the edit page prefilled for "Merge Request On Forked Project"' do | 147 | + step 'I see the edit page prefilled for "Merge Request On Forked Project"' do |
| 162 | current_path.should == edit_project_merge_request_path(@project, @merge_request) | 148 | current_path.should == edit_project_merge_request_path(@project, @merge_request) |
| 163 | - page.should have_content "Edit merge request #{@merge_request.id}" | 149 | + page.should have_content "Edit merge request ##{@merge_request.id}" |
| 164 | find("#merge_request_title").value.should == "Merge Request On Forked Project" | 150 | find("#merge_request_title").value.should == "Merge Request On Forked Project" |
| 165 | find("#merge_request_source_project_id").value.should == @forked_project.id.to_s | 151 | find("#merge_request_source_project_id").value.should == @forked_project.id.to_s |
| 166 | find("#merge_request_target_project_id").value.should == @project.id.to_s | 152 | find("#merge_request_target_project_id").value.should == @project.id.to_s |
| @@ -170,7 +156,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | @@ -170,7 +156,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | ||
| 170 | verify_commit_link(".mr_target_commit",@project) | 156 | verify_commit_link(".mr_target_commit",@project) |
| 171 | end | 157 | end |
| 172 | 158 | ||
| 173 | - And 'I fill out an invalid "Merge Request On Forked Project" merge request' do | 159 | + step 'I fill out an invalid "Merge Request On Forked Project" merge request' do |
| 174 | #If this isn't filled in the rest of the validations won't be triggered | 160 | #If this isn't filled in the rest of the validations won't be triggered |
| 175 | fill_in "merge_request_title", with: "Merge Request On Forked Project" | 161 | fill_in "merge_request_title", with: "Merge Request On Forked Project" |
| 176 | find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s | 162 | find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s |
| @@ -179,7 +165,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | @@ -179,7 +165,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps | ||
| 179 | find(:select, "merge_request_target_branch", {}).value.should == "" | 165 | find(:select, "merge_request_target_branch", {}).value.should == "" |
| 180 | end | 166 | end |
| 181 | 167 | ||
| 182 | - Then 'I should see validation errors' do | 168 | + step 'I should see validation errors' do |
| 183 | page.should have_content "Source branch can't be blank" | 169 | page.should have_content "Source branch can't be blank" |
| 184 | page.should have_content "Target branch can't be blank" | 170 | page.should have_content "Target branch can't be blank" |
| 185 | page.should have_content "Branch conflict You can not use same project/branch for source and target" | 171 | page.should have_content "Branch conflict You can not use same project/branch for source and target" |
features/support/env.rb
| @@ -14,7 +14,7 @@ require 'spinach/capybara' | @@ -14,7 +14,7 @@ require 'spinach/capybara' | ||
| 14 | require 'sidekiq/testing/inline' | 14 | require 'sidekiq/testing/inline' |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | -%w(valid_commit select2_helper test_env).each do |f| | 17 | +%w(valid_commit select2_helper chosen_helper test_env).each do |f| |
| 18 | require Rails.root.join('spec', 'support', f) | 18 | require Rails.root.join('spec', 'support', f) |
| 19 | end | 19 | end |
| 20 | 20 |
| @@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
| 1 | +# Chosen programmatic helper | ||
| 2 | +# It allows you to select value from chosen select | ||
| 3 | +# | ||
| 4 | +# Params | ||
| 5 | +# value - real value of selected item | ||
| 6 | +# opts - options containing css selector | ||
| 7 | +# | ||
| 8 | +# Usage: | ||
| 9 | +# | ||
| 10 | +# chosen(2, from: '#user_ids') | ||
| 11 | +# | ||
| 12 | + | ||
| 13 | +module ChosenHelper | ||
| 14 | + def chosen(value, options={}) | ||
| 15 | + raise "Must pass a hash containing 'from'" if not options.is_a?(Hash) or not options.has_key?(:from) | ||
| 16 | + | ||
| 17 | + selector = options[:from] | ||
| 18 | + | ||
| 19 | + page.execute_script("$('#{selector}').val('#{value}').trigger('chosen:updated');") | ||
| 20 | + end | ||
| 21 | +end |
spec/support/test_env.rb
| @@ -88,11 +88,11 @@ module TestEnv | @@ -88,11 +88,11 @@ module TestEnv | ||
| 88 | 88 | ||
| 89 | def clear_repo_dir(namespace, name) | 89 | def clear_repo_dir(namespace, name) |
| 90 | setup_stubs | 90 | setup_stubs |
| 91 | - #Clean any .wiki.git that may have been created | 91 | + # Clean any .wiki.git that may have been created |
| 92 | FileUtils.rm_rf File.join(testing_path(), "#{name}.wiki.git") | 92 | FileUtils.rm_rf File.join(testing_path(), "#{name}.wiki.git") |
| 93 | end | 93 | end |
| 94 | 94 | ||
| 95 | - #Create a repo and it's satellite | 95 | + # Create a repo and it's satellite |
| 96 | def create_repo(namespace, name) | 96 | def create_repo(namespace, name) |
| 97 | setup_stubs | 97 | setup_stubs |
| 98 | repo = repo(namespace, name) | 98 | repo = repo(namespace, name) |
| @@ -152,7 +152,7 @@ module TestEnv | @@ -152,7 +152,7 @@ module TestEnv | ||
| 152 | # Recreate tmp/test-git-base-path | 152 | # Recreate tmp/test-git-base-path |
| 153 | FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path | 153 | FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path |
| 154 | 154 | ||
| 155 | - #Since much more is happening in satellites | 155 | + # Since much more is happening in satellites |
| 156 | FileUtils.mkdir_p Gitlab.config.satellites.path | 156 | FileUtils.mkdir_p Gitlab.config.satellites.path |
| 157 | end | 157 | end |
| 158 | 158 | ||
| @@ -161,8 +161,8 @@ module TestEnv | @@ -161,8 +161,8 @@ module TestEnv | ||
| 161 | satellite_repo = satellite(namespace, satellite_name) | 161 | satellite_repo = satellite(namespace, satellite_name) |
| 162 | # Symlink tmp/satellite/gitlabhq to tmp/test-git-base-path/satellite/gitlabhq, create the directory if it doesn't exist already | 162 | # Symlink tmp/satellite/gitlabhq to tmp/test-git-base-path/satellite/gitlabhq, create the directory if it doesn't exist already |
| 163 | satellite_dir = File.dirname(satellite_repo) | 163 | satellite_dir = File.dirname(satellite_repo) |
| 164 | - FileUtils.mkdir_p satellite_dir unless File.exists?(satellite_dir) | ||
| 165 | - system("ln -s -f #{seed_satellite_path()} #{satellite_repo}") | 164 | + FileUtils.mkdir_p(satellite_dir) unless File.exists?(satellite_dir) |
| 165 | + system("ln -s -f #{seed_satellite_path} #{satellite_repo}") | ||
| 166 | end | 166 | end |
| 167 | 167 | ||
| 168 | def create_temp_repo(path) | 168 | def create_temp_repo(path) |