Commit 469d16f4 authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-05-04

# Conflicts:
#	app/controllers/concerns/internal_redirect.rb
#	app/services/application_settings/update_service.rb
#	db/schema.rb
#	doc/administration/index.md
#	doc/api/settings.md
#	locale/gitlab.pot

[ci skip]
parents 1ec30dbc 7603beff
module InternalRedirect module InternalRedirect
<<<<<<< HEAD
prepend EE::InternalRedirect prepend EE::InternalRedirect
=======
>>>>>>> upstream/master
extend ActiveSupport::Concern extend ActiveSupport::Concern
def safe_redirect_path(path) def safe_redirect_path(path)
......
...@@ -93,7 +93,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController ...@@ -93,7 +93,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
if identity_linker.changed? if identity_linker.changed?
redirect_identity_linked redirect_identity_linked
elsif identity_linker.error_message.present? elsif identity_linker.failed?
redirect_identity_link_failed(identity_linker.error_message) redirect_identity_link_failed(identity_linker.error_message)
else else
redirect_identity_exists redirect_identity_exists
......
module ApplicationSettings module ApplicationSettings
class UpdateService < ApplicationSettings::BaseService class UpdateService < ApplicationSettings::BaseService
def execute def execute
<<<<<<< HEAD
# Repository size limit comes as MB from the view # Repository size limit comes as MB from the view
limit = @params.delete(:repository_size_limit) limit = @params.delete(:repository_size_limit)
@application_setting.repository_size_limit = Gitlab::Utils.try_megabytes_to_bytes(limit) if limit @application_setting.repository_size_limit = Gitlab::Utils.try_megabytes_to_bytes(limit) if limit
=======
>>>>>>> upstream/master
update_terms(@params.delete(:terms)) update_terms(@params.delete(:terms))
@application_setting.update(@params) @application_setting.update(@params)
......
- active_tab = local_assigns.fetch(:active_tab, 'blank')
- f = local_assigns.fetch(:f)
.project-import.row
.col-lg-12
.form-group.import-btn-container.clearfix
= f.label :visibility_level, class: 'label-light' do #the label here seems wrong
Import project from
.import-buttons
- if gitlab_project_import_enabled?
.import_gitlab_project.has-tooltip{ data: { container: 'body' } }
= link_to new_import_gitlab_project_path, class: 'btn btn_import_gitlab_project project-submit' do
= icon('gitlab', text: 'GitLab export')
%div
- if github_import_enabled?
= link_to new_import_github_path, class: 'btn js-import-github' do
= icon('github', text: 'GitHub')
%div
- if bitbucket_import_enabled?
= link_to status_import_bitbucket_path, class: "btn import_bitbucket #{'how_to_import_link' unless bitbucket_import_configured?}" do
= icon('bitbucket', text: 'Bitbucket')
- unless bitbucket_import_configured?
= render 'bitbucket_import_modal'
%div
- if gitlab_import_enabled?
= link_to status_import_gitlab_path, class: "btn import_gitlab #{'how_to_import_link' unless gitlab_import_configured?}" do
= icon('gitlab', text: 'GitLab.com')
- unless gitlab_import_configured?
= render 'gitlab_import_modal'
%div
- if google_code_import_enabled?
= link_to new_import_google_code_path, class: 'btn import_google_code' do
= icon('google', text: 'Google Code')
%div
- if fogbugz_import_enabled?
= link_to new_import_fogbugz_path, class: 'btn import_fogbugz' do
= icon('bug', text: 'Fogbugz')
%div
- if gitea_import_enabled?
= link_to new_import_gitea_path, class: 'btn import_gitea' do
= custom_icon('go_logo')
Gitea
%div
- if git_import_enabled?
%button.btn.js-toggle-button.js-import-git-toggle-button{ type: "button", data: { toggle_open_class: 'active' } }
= icon('git', text: 'Repo by URL')
.col-lg-12
.js-toggle-content.toggle-import-form{ class: ('hide' if active_tab != 'import') }
%hr
= render "shared/import_form", f: f
= render 'new_project_fields', f: f, project_name_id: "import-url-name"
...@@ -65,54 +65,11 @@ ...@@ -65,54 +65,11 @@
.tab-pane.import-project-pane.js-toggle-container{ id: 'import-project-pane', class: active_when(active_tab == 'import'), role: 'tabpanel' } .tab-pane.import-project-pane.js-toggle-container{ id: 'import-project-pane', class: active_when(active_tab == 'import'), role: 'tabpanel' }
= form_for @project, html: { class: 'new_project' } do |f| = form_for @project, html: { class: 'new_project' } do |f|
- if import_sources_enabled? - if import_sources_enabled?
.project-import.row = render 'import_project_pane', f: f, active_tab: active_tab
.col-lg-12 - else
.form-group.import-btn-container.clearfix .nothing-here-block
= f.label :visibility_level, class: 'label-light' do #the label here seems wrong %h4 No import options available
Import project from %p Contact an administrator to enable options for importing your project.
.import-buttons
- if gitlab_project_import_enabled?
.import_gitlab_project.has-tooltip{ data: { container: 'body' } }
= link_to new_import_gitlab_project_path, class: 'btn btn_import_gitlab_project project-submit' do
= icon('gitlab', text: 'GitLab export')
%div
- if github_import_enabled?
= link_to new_import_github_path, class: 'btn js-import-github' do
= icon('github', text: 'GitHub')
%div
- if bitbucket_import_enabled?
= link_to status_import_bitbucket_path, class: "btn import_bitbucket #{'how_to_import_link' unless bitbucket_import_configured?}" do
= icon('bitbucket', text: 'Bitbucket')
- unless bitbucket_import_configured?
= render 'bitbucket_import_modal'
%div
- if gitlab_import_enabled?
= link_to status_import_gitlab_path, class: "btn import_gitlab #{'how_to_import_link' unless gitlab_import_configured?}" do
= icon('gitlab', text: 'GitLab.com')
- unless gitlab_import_configured?
= render 'gitlab_import_modal'
%div
- if google_code_import_enabled?
= link_to new_import_google_code_path, class: 'btn import_google_code' do
= icon('google', text: 'Google Code')
%div
- if fogbugz_import_enabled?
= link_to new_import_fogbugz_path, class: 'btn import_fogbugz' do
= icon('bug', text: 'Fogbugz')
%div
- if gitea_import_enabled?
= link_to new_import_gitea_path, class: 'btn import_gitea' do
= custom_icon('go_logo')
Gitea
%div
- if git_import_enabled?
%button.btn.js-toggle-button.js-import-git-toggle-button{ type: "button", data: { toggle_open_class: 'active' } }
= icon('git', text: 'Repo by URL')
.col-lg-12
.js-toggle-content.toggle-import-form{ class: ('hide' if active_tab != 'import') }
%hr
= render "shared/import_form", f: f
= render 'new_project_fields', f: f, project_name_id: "import-url-name"
-# EE-specific start -# EE-specific start
= render 'new_ci_cd_only_project_pane', active_tab: active_tab = render 'new_ci_cd_only_project_pane', active_tab: active_tab
......
---
title: Reconcile project templates with Auto DevOps
merge_request: 18737
author:
type: changed
---
title: Inform the user when there are no project import options available
merge_request: 18716
author: George Tsiolis
type: changed
...@@ -27,7 +27,7 @@ module Sidekiq ...@@ -27,7 +27,7 @@ module Sidekiq
Use an `after_commit` hook, or include `AfterCommitQueue` and use a `run_after_commit` block instead. Use an `after_commit` hook, or include `AfterCommitQueue` and use a `run_after_commit` block instead.
MSG MSG
rescue Sidekiq::Worker::EnqueueFromTransactionError => e rescue Sidekiq::Worker::EnqueueFromTransactionError => e
Rails.logger.error(e.message) if Rails.env.production? ::Rails.logger.error(e.message) if ::Rails.env.production?
Gitlab::Sentry.track_exception(e) Gitlab::Sentry.track_exception(e)
end end
end end
......
...@@ -43,6 +43,13 @@ scope '-/users', module: :users do ...@@ -43,6 +43,13 @@ scope '-/users', module: :users do
end end
end end
scope '-/users', module: :users do
resources :terms, only: [:index] do
post :accept, on: :member
post :decline, on: :member
end
end
scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) do scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) do
scope(path: 'users/:username', scope(path: 'users/:username',
as: :user, as: :user,
......
...@@ -53,6 +53,12 @@ ActiveRecord::Schema.define(version: 20180503150427) do ...@@ -53,6 +53,12 @@ ActiveRecord::Schema.define(version: 20180503150427) do
t.text "terms_html" t.text "terms_html"
end end
create_table "application_setting_terms", force: :cascade do |t|
t.integer "cached_markdown_version"
t.text "terms", null: false
t.text "terms_html"
end
create_table "application_settings", force: :cascade do |t| create_table "application_settings", force: :cascade do |t|
t.integer "default_projects_limit" t.integer "default_projects_limit"
t.boolean "signup_enabled" t.boolean "signup_enabled"
...@@ -198,6 +204,7 @@ ActiveRecord::Schema.define(version: 20180503150427) do ...@@ -198,6 +204,7 @@ ActiveRecord::Schema.define(version: 20180503150427) do
t.boolean "pages_domain_verification_enabled", default: true, null: false t.boolean "pages_domain_verification_enabled", default: true, null: false
t.float "external_authorization_service_timeout", default: 0.5, null: false t.float "external_authorization_service_timeout", default: 0.5, null: false
t.boolean "allow_local_requests_from_hooks_and_services", default: false, null: false t.boolean "allow_local_requests_from_hooks_and_services", default: false, null: false
<<<<<<< HEAD
t.text "external_auth_client_cert" t.text "external_auth_client_cert"
t.text "encrypted_external_auth_client_key" t.text "encrypted_external_auth_client_key"
t.string "encrypted_external_auth_client_key_iv" t.string "encrypted_external_auth_client_key_iv"
...@@ -222,6 +229,9 @@ ActiveRecord::Schema.define(version: 20180503150427) do ...@@ -222,6 +229,9 @@ ActiveRecord::Schema.define(version: 20180503150427) do
t.integer "group_id", null: false t.integer "group_id", null: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
=======
t.boolean "enforce_terms", default: false
>>>>>>> upstream/master
end end
add_index "approver_groups", ["group_id"], name: "index_approver_groups_on_group_id", using: :btree add_index "approver_groups", ["group_id"], name: "index_approver_groups_on_group_id", using: :btree
......
...@@ -47,8 +47,11 @@ Learn how to install, configure, update, and maintain your GitLab instance. ...@@ -47,8 +47,11 @@ Learn how to install, configure, update, and maintain your GitLab instance.
[source installations](../install/installation.md#installation-from-source). [source installations](../install/installation.md#installation-from-source).
- [Environment variables](environment_variables.md): Supported environment variables that can be used to override their defaults values in order to configure GitLab. - [Environment variables](environment_variables.md): Supported environment variables that can be used to override their defaults values in order to configure GitLab.
- [Plugins](plugins.md): With custom plugins, GitLab administrators can introduce custom integrations without modifying GitLab's source code. - [Plugins](plugins.md): With custom plugins, GitLab administrators can introduce custom integrations without modifying GitLab's source code.
<<<<<<< HEAD
- [Elasticsearch](../integration/elasticsearch.md): Enable Elasticsearch to empower GitLab's Advanced Global Search. Useful when you deal with a huge amount of data. **[STARTER ONLY]** - [Elasticsearch](../integration/elasticsearch.md): Enable Elasticsearch to empower GitLab's Advanced Global Search. Useful when you deal with a huge amount of data. **[STARTER ONLY]**
- [External Classification Policy Authorization](../user/admin_area/settings/external_authorization.md) **[PREMIUM ONLY]** - [External Classification Policy Authorization](../user/admin_area/settings/external_authorization.md) **[PREMIUM ONLY]**
=======
>>>>>>> upstream/master
- [Enforcing Terms of Service](../user/admin_area/settings/terms.md) - [Enforcing Terms of Service](../user/admin_area/settings/terms.md)
#### Customizing GitLab's appearance #### Customizing GitLab's appearance
......
...@@ -172,12 +172,15 @@ PUT /application/settings ...@@ -172,12 +172,15 @@ PUT /application/settings
| `user_default_external` | boolean | no | Newly registered users will by default be external | | `user_default_external` | boolean | no | Newly registered users will by default be external |
| `user_oauth_applications` | boolean | no | Allow users to register any application to use GitLab as an OAuth provider | | `user_oauth_applications` | boolean | no | Allow users to register any application to use GitLab as an OAuth provider |
| `version_check_enabled` | boolean | no | Let GitLab inform you when an update is available. | | `version_check_enabled` | boolean | no | Let GitLab inform you when an update is available. |
<<<<<<< HEAD
| `external_authorization_service_enabled` | boolean | no | Enable using an external authorization service for accessing projects | | `external_authorization_service_enabled` | boolean | no | Enable using an external authorization service for accessing projects |
| `external_authorization_service_url` | string | no | URL to which authorization requests will be directed | | `external_authorization_service_url` | string | no | URL to which authorization requests will be directed |
| `external_authorization_service_default_label` | string | no | The default classification label to use when requesting authorization and no classification label has been specified on the project | | `external_authorization_service_default_label` | string | no | The default classification label to use when requesting authorization and no classification label has been specified on the project |
| `external_auth_client_cert` | string | no | The certificate to use to authenticate with the external authorization service | | `external_auth_client_cert` | string | no | The certificate to use to authenticate with the external authorization service |
| `external_auth_client_key` | string | no | Private key for the certificate when authentication is required for the external authorization service, this is encrypted when stored | | `external_auth_client_key` | string | no | Private key for the certificate when authentication is required for the external authorization service, this is encrypted when stored |
| `external_auth_client_key_pass` | string | no | Passphrase to use for the private key when authenticating with the external service this is encrypted when stored | | `external_auth_client_key_pass` | string | no | Passphrase to use for the private key when authenticating with the external service this is encrypted when stored |
=======
>>>>>>> upstream/master
| `enforce_terms` | boolean | no | Enforce application ToS to all users | | `enforce_terms` | boolean | no | Enforce application ToS to all users |
| `terms` | text | yes (if `enforce_terms` is true) | Markdown content for the ToS | | `terms` | text | yes (if `enforce_terms` is true) | Markdown content for the ToS |
......
...@@ -310,7 +310,7 @@ Please check this [rules][eslint-plugin-vue-rules] for more documentation. ...@@ -310,7 +310,7 @@ Please check this [rules][eslint-plugin-vue-rules] for more documentation.
})); }));
``` ```
1. Don not use a singleton for the service or the store 1. Do not use a singleton for the service or the store
```javascript ```javascript
// bad // bad
class Store { class Store {
...@@ -328,9 +328,11 @@ Please check this [rules][eslint-plugin-vue-rules] for more documentation. ...@@ -328,9 +328,11 @@ Please check this [rules][eslint-plugin-vue-rules] for more documentation.
} }
} }
``` ```
1. Use `.vue` for Vue templates. Do not use `%template` in HAML.
#### Naming #### Naming
1. **Extensions**: Use `.vue` extension for Vue components.
1. **Extensions**: Use `.vue` extension for Vue components. Do not use `.js` as file extension ([#34371]).
1. **Reference Naming**: Use PascalCase for their instances: 1. **Reference Naming**: Use PascalCase for their instances:
```javascript ```javascript
// bad // bad
...@@ -364,6 +366,8 @@ Please check this [rules][eslint-plugin-vue-rules] for more documentation. ...@@ -364,6 +366,8 @@ Please check this [rules][eslint-plugin-vue-rules] for more documentation.
<component my-prop="prop" /> <component my-prop="prop" />
``` ```
[#34371]: https://gitlab.com/gitlab-org/gitlab-ce/issues/34371
#### Alignment #### Alignment
1. Follow these alignment styles for the template method: 1. Follow these alignment styles for the template method:
1. With more than one attribute, all attributes should be on a new line: 1. With more than one attribute, all attributes should be on a new line:
......
...@@ -390,7 +390,7 @@ If you have installed GitLab using a different method, you need to: ...@@ -390,7 +390,7 @@ If you have installed GitLab using a different method, you need to:
1. [Deploy Prometheus](../../user/project/integrations/prometheus.md#configuring-your-own-prometheus-server-within-kubernetes) into your Kubernetes cluster 1. [Deploy Prometheus](../../user/project/integrations/prometheus.md#configuring-your-own-prometheus-server-within-kubernetes) into your Kubernetes cluster
1. If you would like response metrics, ensure you are running at least version 1. If you would like response metrics, ensure you are running at least version
0.9.0 of NGINX Ingress and 0.9.0 of NGINX Ingress and
[enable Prometheus metrics](https://github.com/kubernetes/ingress/blob/master/examples/customization/custom-vts-metrics/nginx/nginx-vts-metrics-conf.yaml). [enable Prometheus metrics](https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/customization/custom-vts-metrics-prometheus/nginx-vts-metrics-conf.yaml).
1. Finally, [annotate](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) 1. Finally, [annotate](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)
the NGINX Ingress deployment to be scraped by Prometheus using the NGINX Ingress deployment to be scraped by Prometheus using
`prometheus.io/scrape: "true"` and `prometheus.io/port: "10254"`. `prometheus.io/scrape: "true"` and `prometheus.io/port: "10254"`.
......
@project_commits
Feature: Project Commits
Background:
Given I sign in as a user
And I own a project
And I visit my project's commits page
Scenario: I browse commits list for master branch
Then I see project commits
And I should not see button to create a new merge request
Then I click the "Compare" tab
And I should not see button to create a new merge request
Scenario: I browse commits list for feature branch without a merge request
Given I visit commits list page for feature branch
Then I see feature branch commits
And I see button to create a new merge request
Then I click the "Compare" tab
And I see button to create a new merge request
Scenario: I browse commits list for feature branch with an open merge request
Given project have an open merge request
And I visit commits list page for feature branch
Then I see feature branch commits
And I should not see button to create a new merge request
And I should see button to the merge request
Then I click the "Compare" tab
And I should not see button to create a new merge request
And I should see button to the merge request
Scenario: I browse atom feed of commits list for master branch
Given I click atom feed link
Then I see commits atom feed
Scenario: I browse commit from list
Given I click on commit link
Then I see commit info
And I see side-by-side diff button
Scenario: I browse commit from list and create a new tag
Given I click on commit link
And I click on tag link
Then I see commit SHA pre-filled
Scenario: I browse commit with ci from list
Given commit has ci status
And repository contains ".gitlab-ci.yml" file
When I click on commit link
Then I see commit ci info
Scenario: I browse commit with side-by-side diff view
Given I click on commit link
And I click side-by-side diff button
Then I see inline diff button
@javascript
Scenario: I compare branches without a merge request
Given I visit compare refs page
And I fill compare fields with branches
Then I see compared branches
And I see button to create a new merge request
@javascript
Scenario: I compare branches with an open merge request
Given project have an open merge request
And I visit compare refs page
And I fill compare fields with branches
Then I see compared branches
And I should not see button to create a new merge request
And I should see button to the merge request
@javascript
Scenario: I compare refs
Given I visit compare refs page
And I fill compare fields with refs
Then I see compared refs
And I unfold diff
Then I should see additional file lines
Scenario: I browse commits for a specific path
Given I visit my project's commits page for a specific path
Then I see breadcrumb links
# TODO: Implement feature in graphs
#Scenario: I browse commits stats
#Given I visit my project's commits stats page
#Then I see commits stats
Scenario: I browse a commit with an image
Given I visit a commit with an image that changed
Then The diff links to both the previous and current image
@javascript
Scenario: I filter commits by message
When I search "submodules" commits
Then I should see only "submodules" commits
class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
include SharedDiffNote
include RepoHelpers
step 'I see project commits' do
commit = @project.repository.commit
expect(page).to have_content(@project.name)
expect(page).to have_content(commit.message[0..20])
expect(page).to have_content(commit.short_id)
end
step 'I click atom feed link' do
click_link "Commits feed"
end
step 'I see commits atom feed' do
commit = @project.repository.commit
expect(response_headers['Content-Type']).to have_content("application/atom+xml")
expect(body).to have_selector("title", text: "#{@project.name}:master commits")
expect(body).to have_selector("author email", text: commit.author_email)
expect(body).to have_selector("entry summary", text: commit.description[0..10].delete("\r\n"))
end
step 'I click on tag link' do
click_link "Tag"
end
step 'I see commit SHA pre-filled' do
expect(page).to have_selector("input[value='#{sample_commit.id}']")
end
step 'I click on commit link' do
visit project_commit_path(@project, sample_commit.id)
end
step 'I see commit info' do
expect(page).to have_content sample_commit.message
expect(page).to have_content "Showing #{sample_commit.files_changed_count} changed files"
end
step 'I fill compare fields with branches' do
select_using_dropdown('from', 'feature')
select_using_dropdown('to', 'master')
click_button 'Compare'
end
step 'I fill compare fields with refs' do
select_using_dropdown('from', sample_commit.parent_id, true)
select_using_dropdown('to', sample_commit.id, true)
click_button "Compare"
end
step 'I unfold diff' do
@diff = first('.js-unfold')
@diff.click
sleep 2
end
step 'I should see additional file lines' do
page.within @diff.query_scope do
expect(first('.new_line').text).not_to have_content "..."
end
end
step 'I see compared refs' do
expect(page).to have_content "Commits (1)"
expect(page).to have_content "Showing 2 changed files"
end
step 'I visit commits list page for feature branch' do
visit project_commits_path(@project, 'feature', { limit: 5 })
end
step 'I see feature branch commits' do
commit = @project.repository.commit('0b4bc9a')
expect(page).to have_content(@project.name)
expect(page).to have_content(commit.message[0..12])
expect(page).to have_content(commit.short_id)
end
step 'project have an open merge request' do
create(:merge_request,
title: 'Feature',
source_project: @project,
source_branch: 'feature',
target_branch: 'master',
author: @project.users.first
)
end
step 'I click the "Compare" tab' do
click_link('Compare')
end
step 'I fill compare fields with branches' do
select_using_dropdown('from', 'master')
select_using_dropdown('to', 'feature')
click_button 'Compare'
end
step 'I see compared branches' do
expect(page).to have_content 'Commits (1)'
expect(page).to have_content 'Showing 1 changed file with 5 additions and 0 deletions'
end
step 'I see button to create a new merge request' do
expect(page).to have_link 'Create merge request'
end
step 'I should not see button to create a new merge request' do
expect(page).not_to have_link 'Create merge request'
end
step 'I should see button to the merge request' do
merge_request = MergeRequest.find_by(title: 'Feature')
expect(page).to have_link "View open merge request", href: project_merge_request_path(@project, merge_request)
end
step 'I see breadcrumb links' do
expect(page).to have_selector('ul.breadcrumb')
expect(page).to have_selector('ul.breadcrumb a', count: 4)
end
step 'I see commits stats' do
expect(page).to have_content 'Top 50 Committers'
expect(page).to have_content 'Committers'
expect(page).to have_content 'Total commits'
expect(page).to have_content 'Authors'
end
step 'I visit a commit with an image that changed' do
visit project_commit_path(@project, sample_image_commit.id)
end
step 'The diff links to both the previous and current image' do
links = page.all('.file-actions a')
expect(links[0]['href']).to match %r{blob/#{sample_image_commit.old_blob_id}}
expect(links[1]['href']).to match %r{blob/#{sample_image_commit.new_blob_id}}
end
step 'I see inline diff button' do
expect(page).to have_content "Inline"
end
step 'I click side-by-side diff button' do
find('#parallel-diff-btn').click
end
step 'commit has ci status' do
@project.enable_ci
@pipeline = create(:ci_pipeline, project: @project, sha: sample_commit.id)
create(:ci_build, pipeline: @pipeline)
end
step 'repository contains ".gitlab-ci.yml" file' do
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file).and_return(String.new)
end
step 'I see commit ci info' do
expect(page).to have_content "Pipeline ##{@pipeline.id} pending"
end
step 'I search "submodules" commits' do
fill_in 'commits-search', with: 'submodules'
end
step 'I should see only "submodules" commits' do
expect(page).to have_content "More submodules"
expect(page).not_to have_content "Change some files"
end
def select_using_dropdown(dropdown_type, selection, is_commit = false)
dropdown = find(".js-compare-#{dropdown_type}-dropdown")
dropdown.find(".compare-dropdown-toggle").click
dropdown.find('.dropdown-menu', visible: true)
dropdown.fill_in("Filter by Git revision", with: selection)
if is_commit
dropdown.find('input[type="search"]').send_keys(:return)
else
find_link(selection, visible: true).click
end
dropdown.find('.dropdown-menu', visible: false)
end
end
...@@ -17,6 +17,10 @@ module Gitlab ...@@ -17,6 +17,10 @@ module Gitlab
@changed @changed
end end
def failed?
error_message.present?
end
def error_message def error_message
identity.validate identity.validate
......
...@@ -20,6 +20,9 @@ module Gitlab ...@@ -20,6 +20,9 @@ module Gitlab
GIT_ALTERNATE_OBJECT_DIRECTORIES_RELATIVE GIT_ALTERNATE_OBJECT_DIRECTORIES_RELATIVE
].freeze ].freeze
SEARCH_CONTEXT_LINES = 3 SEARCH_CONTEXT_LINES = 3
# In https://gitlab.com/gitlab-org/gitaly/merge_requests/698
# We copied these two prefixes into gitaly-go, so don't change these
# or things will break! (REBASE_WORKTREE_PREFIX and SQUASH_WORKTREE_PREFIX)
REBASE_WORKTREE_PREFIX = 'rebase'.freeze REBASE_WORKTREE_PREFIX = 'rebase'.freeze
SQUASH_WORKTREE_PREFIX = 'squash'.freeze SQUASH_WORKTREE_PREFIX = 'squash'.freeze
GITALY_INTERNAL_URL = 'ssh://gitaly/internal.git'.freeze GITALY_INTERNAL_URL = 'ssh://gitaly/internal.git'.freeze
...@@ -1685,10 +1688,14 @@ module Gitlab ...@@ -1685,10 +1688,14 @@ module Gitlab
end end
end end
# This function is duplicated in Gitaly-Go, don't change it!
# https://gitlab.com/gitlab-org/gitaly/merge_requests/698
def fresh_worktree?(path) def fresh_worktree?(path)
File.exist?(path) && !clean_stuck_worktree(path) File.exist?(path) && !clean_stuck_worktree(path)
end end
# This function is duplicated in Gitaly-Go, don't change it!
# https://gitlab.com/gitlab-org/gitaly/merge_requests/698
def clean_stuck_worktree(path) def clean_stuck_worktree(path)
return false unless File.mtime(path) < 15.minutes.ago return false unless File.mtime(path) < 15.minutes.ago
......
...@@ -25,9 +25,9 @@ module Gitlab ...@@ -25,9 +25,9 @@ module Gitlab
end end
TEMPLATES_TABLE = [ TEMPLATES_TABLE = [
ProjectTemplate.new('rails', 'Ruby on Rails', 'Includes an MVC structure, gemfile, rakefile, and .gitlab-ci.yml file, along with many others, to help you get started.', 'https://gitlab.com/gitlab-org/project-templates/rails'), ProjectTemplate.new('rails', 'Ruby on Rails', 'Includes an MVC structure, Gemfile, Rakefile, along with many others, to help you get started.', 'https://gitlab.com/gitlab-org/project-templates/rails'),
ProjectTemplate.new('spring', 'Spring', 'Includes an MVC structure, mvnw, pom.xml, and .gitlab-ci.yml file to help you get started.', 'https://gitlab.com/gitlab-org/project-templates/spring'), ProjectTemplate.new('spring', 'Spring', 'Includes an MVC structure, mvnw and pom.xml to help you get started.', 'https://gitlab.com/gitlab-org/project-templates/spring'),
ProjectTemplate.new('express', 'NodeJS Express', 'Includes an MVC structure and .gitlab-ci.yml file to help you get started.', 'https://gitlab.com/gitlab-org/project-templates/express') ProjectTemplate.new('express', 'NodeJS Express', 'Includes an MVC structure to help you get started.', 'https://gitlab.com/gitlab-org/project-templates/express')
].freeze ].freeze
class << self class << self
......
...@@ -8,8 +8,13 @@ msgid "" ...@@ -8,8 +8,13 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: gitlab 1.0.0\n" "Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
<<<<<<< HEAD
"POT-Creation-Date: 2018-05-03 10:13+0200\n" "POT-Creation-Date: 2018-05-03 10:13+0200\n"
"PO-Revision-Date: 2018-05-03 10:13+0200\n" "PO-Revision-Date: 2018-05-03 10:13+0200\n"
=======
"POT-Creation-Date: 2018-05-02 22:28+0200\n"
"PO-Revision-Date: 2018-05-02 22:28+0200\n"
>>>>>>> upstream/master
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
...@@ -119,11 +124,14 @@ msgstr "" ...@@ -119,11 +124,14 @@ msgstr ""
msgid "%{title} changes" msgid "%{title} changes"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "%{type} detected %d vulnerability" msgid "%{type} detected %d vulnerability"
msgid_plural "%{type} detected %d vulnerabilities" msgid_plural "%{type} detected %d vulnerabilities"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
=======
>>>>>>> upstream/master
msgid "(checkout the %{link} for information on how to install it)." msgid "(checkout the %{link} for information on how to install it)."
msgstr "" msgstr ""
...@@ -206,9 +214,12 @@ msgstr "" ...@@ -206,9 +214,12 @@ msgstr ""
msgid "Accept terms" msgid "Accept terms"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Accepted MR" msgid "Accepted MR"
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "Access Tokens" msgid "Access Tokens"
msgstr "" msgstr ""
...@@ -871,9 +882,12 @@ msgstr "" ...@@ -871,9 +882,12 @@ msgstr ""
msgid "CI/CD configuration" msgid "CI/CD configuration"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "CI/CD for external repo" msgid "CI/CD for external repo"
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "CICD|An explicit %{ci_file} needs to be specified before you can begin using Continuous Integration and Delivery." msgid "CICD|An explicit %{ci_file} needs to be specified before you can begin using Continuous Integration and Delivery."
msgstr "" msgstr ""
...@@ -1730,13 +1744,20 @@ msgstr "" ...@@ -1730,13 +1744,20 @@ msgstr ""
msgid "CreateTokenToCloneLink|create a personal access token" msgid "CreateTokenToCloneLink|create a personal access token"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Creating epic" msgid "Creating epic"
msgstr "" =======
msgid "Cron Timezone" msgid "Cron Timezone"
msgstr "" msgstr ""
msgid "Cron syntax" msgid "Cron syntax"
>>>>>>> upstream/master
msgstr ""
msgid "CurrentUser|Profile"
msgstr ""
msgid "CurrentUser|Settings"
msgstr "" msgstr ""
msgid "Current node" msgid "Current node"
...@@ -1796,9 +1817,12 @@ msgstr "" ...@@ -1796,9 +1817,12 @@ msgstr ""
msgid "Decline and sign out" msgid "Decline and sign out"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Default classification label" msgid "Default classification label"
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "Define a custom pattern with cron syntax" msgid "Define a custom pattern with cron syntax"
msgstr "" msgstr ""
...@@ -1903,9 +1927,12 @@ msgstr "" ...@@ -1903,9 +1927,12 @@ msgstr ""
msgid "Directory name" msgid "Directory name"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Disable" msgid "Disable"
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "Discard changes" msgid "Discard changes"
msgstr "" msgstr ""
...@@ -1918,12 +1945,15 @@ msgstr "" ...@@ -1918,12 +1945,15 @@ msgstr ""
msgid "Dismiss Cycle Analytics introduction box" msgid "Dismiss Cycle Analytics introduction box"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Dismiss Merge Request promotion" msgid "Dismiss Merge Request promotion"
msgstr "" msgstr ""
msgid "Documentation for popular identity providers" msgid "Documentation for popular identity providers"
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "Domain" msgid "Domain"
msgstr "" msgstr ""
...@@ -2508,6 +2538,7 @@ msgstr "" ...@@ -2508,6 +2538,7 @@ msgstr ""
msgid "Group ID" msgid "Group ID"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "GroupRoadmap|Epics let you manage your portfolio of projects more efficiently and with less effort" msgid "GroupRoadmap|Epics let you manage your portfolio of projects more efficiently and with less effort"
msgstr "" msgstr ""
...@@ -2526,6 +2557,8 @@ msgstr "" ...@@ -2526,6 +2557,8 @@ msgstr ""
msgid "GroupRoadmap|Until %{dateWord}" msgid "GroupRoadmap|Until %{dateWord}"
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "GroupSettings|Prevent sharing a project within %{group} with other groups" msgid "GroupSettings|Prevent sharing a project within %{group} with other groups"
msgstr "" msgstr ""
...@@ -2663,6 +2696,7 @@ msgstr "" ...@@ -2663,6 +2696,7 @@ msgstr ""
msgid "Import repository" msgid "Import repository"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "ImportButtons|Connect repositories from" msgid "ImportButtons|Connect repositories from"
msgstr "" msgstr ""
...@@ -2675,6 +2709,8 @@ msgstr "" ...@@ -2675,6 +2709,8 @@ msgstr ""
msgid "Improve search with Advanced Global Search and GitLab Enterprise Edition." msgid "Improve search with Advanced Global Search and GitLab Enterprise Edition."
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "Include a Terms of Service agreement that all users must accept." msgid "Include a Terms of Service agreement that all users must accept."
msgstr "" msgstr ""
...@@ -2946,9 +2982,12 @@ msgstr "" ...@@ -2946,9 +2982,12 @@ msgstr ""
msgid "Members" msgid "Members"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Members will be forwarded here when signing in to your group. Get this from your identity provider, where it can also be called \"SSO Service Location\", \"SAML Token Issuance Endpoint\", or \"SAML 2.0/W-Federation URL\"." msgid "Members will be forwarded here when signing in to your group. Get this from your identity provider, where it can also be called \"SSO Service Location\", \"SAML Token Issuance Endpoint\", or \"SAML 2.0/W-Federation URL\"."
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "Merge Request:" msgid "Merge Request:"
msgstr "" msgstr ""
...@@ -3099,9 +3138,12 @@ msgstr "" ...@@ -3099,9 +3138,12 @@ msgstr ""
msgid "Move issue" msgid "Move issue"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Multiple issue boards" msgid "Multiple issue boards"
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "Name" msgid "Name"
msgstr "" msgstr ""
...@@ -4001,9 +4043,12 @@ msgstr "" ...@@ -4001,9 +4043,12 @@ msgstr ""
msgid "Resolve discussion" msgid "Resolve discussion"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Response metrics (Custom)" msgid "Response metrics (Custom)"
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "Retry" msgid "Retry"
msgstr "" msgstr ""
...@@ -4221,6 +4266,7 @@ msgid_plural "Showing %d events" ...@@ -4221,6 +4266,7 @@ msgid_plural "Showing %d events"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
<<<<<<< HEAD
msgid "Sidebar|Change weight" msgid "Sidebar|Change weight"
msgstr "" msgstr ""
...@@ -4233,6 +4279,8 @@ msgstr "" ...@@ -4233,6 +4279,8 @@ msgstr ""
msgid "Sidebar|Weight" msgid "Sidebar|Weight"
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "Sign out" msgid "Sign out"
msgstr "" msgstr ""
...@@ -4553,12 +4601,15 @@ msgstr "" ...@@ -4553,12 +4601,15 @@ msgstr ""
msgid "Terms of Service Agreement" msgid "Terms of Service Agreement"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Thanks! Don't show me this again" msgid "Thanks! Don't show me this again"
msgstr "" msgstr ""
msgid "The Advanced Global Search in GitLab is a powerful search service that saves you time. Instead of creating duplicate code and wasting time, you can now search for code within other teams that can help your own project." msgid "The Advanced Global Search in GitLab is a powerful search service that saves you time. Instead of creating duplicate code and wasting time, you can now search for code within other teams that can help your own project."
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "The Issue Tracker is the place to add things that need to be improved or solved in a project" msgid "The Issue Tracker is the place to add things that need to be improved or solved in a project"
msgstr "" msgstr ""
...@@ -4760,12 +4811,15 @@ msgstr "" ...@@ -4760,12 +4811,15 @@ msgstr ""
msgid "Time between merge request creation and merge/close" msgid "Time between merge request creation and merge/close"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Time between updates and capacity settings." msgid "Time between updates and capacity settings."
msgstr "" msgstr ""
msgid "Time in seconds GitLab will wait for a response from the external service. When the service does not respond in time, access will be denied." msgid "Time in seconds GitLab will wait for a response from the external service. When the service does not respond in time, access will be denied."
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "Time remaining" msgid "Time remaining"
msgstr "" msgstr ""
...@@ -5004,6 +5058,7 @@ msgstr "" ...@@ -5004,6 +5058,7 @@ msgstr ""
msgid "Try again" msgid "Try again"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Turn on Service Desk" msgid "Turn on Service Desk"
msgstr "" msgstr ""
...@@ -5013,6 +5068,11 @@ msgstr "" ...@@ -5013,6 +5068,11 @@ msgstr ""
msgid "Unknown" msgid "Unknown"
msgstr "" msgstr ""
=======
msgid "Unable to load the diff. %{button_try_again}"
msgstr ""
>>>>>>> upstream/master
msgid "Unlock" msgid "Unlock"
msgstr "" msgstr ""
...@@ -5172,6 +5232,7 @@ msgstr "" ...@@ -5172,6 +5232,7 @@ msgstr ""
msgid "Web terminal" msgid "Web terminal"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "Webhooks allow you to trigger a URL if, for example, new code is pushed or a new issue is created. You can configure webhooks to listen for specific events like pushes, issues or merge requests. Group webhooks will apply to all projects in a group, allowing you to standardize webhook functionality across your entire group." msgid "Webhooks allow you to trigger a URL if, for example, new code is pushed or a new issue is created. You can configure webhooks to listen for specific events like pushes, issues or merge requests. Group webhooks will apply to all projects in a group, allowing you to standardize webhook functionality across your entire group."
msgstr "" msgstr ""
...@@ -5187,6 +5248,11 @@ msgstr "" ...@@ -5187,6 +5248,11 @@ msgstr ""
msgid "When leaving the URL blank, classification labels can still be specified whitout disabling cross project features or performing external authorization checks." msgid "When leaving the URL blank, classification labels can still be specified whitout disabling cross project features or performing external authorization checks."
msgstr "" msgstr ""
=======
msgid "When enabled, users cannot use GitLab until the terms have been accepted."
msgstr ""
>>>>>>> upstream/master
msgid "Wiki" msgid "Wiki"
msgstr "" msgstr ""
...@@ -5587,6 +5653,7 @@ msgstr[1] "" ...@@ -5587,6 +5653,7 @@ msgstr[1] ""
msgid "deploy token" msgid "deploy token"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "detected %d fixed vulnerability" msgid "detected %d fixed vulnerability"
msgid_plural "detected %d fixed vulnerabilities" msgid_plural "detected %d fixed vulnerabilities"
msgstr[0] "" msgstr[0] ""
...@@ -5600,6 +5667,8 @@ msgstr[1] "" ...@@ -5600,6 +5667,8 @@ msgstr[1] ""
msgid "detected no vulnerabilities" msgid "detected no vulnerabilities"
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "disabled" msgid "disabled"
msgstr "" msgstr ""
...@@ -5844,9 +5913,12 @@ msgstr "" ...@@ -5844,9 +5913,12 @@ msgstr ""
msgid "personal access token" msgid "personal access token"
msgstr "" msgstr ""
<<<<<<< HEAD
msgid "private key does not match certificate." msgid "private key does not match certificate."
msgstr "" msgstr ""
=======
>>>>>>> upstream/master
msgid "remaining" msgid "remaining"
msgstr "" msgstr ""
......
require 'spec_helper' require 'spec_helper'
describe 'User browses commits' do describe 'User browses commits' do
include RepoHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository, namespace: user.namespace) } let(:project) { create(:project, :repository, namespace: user.namespace) }
...@@ -9,13 +11,68 @@ describe 'User browses commits' do ...@@ -9,13 +11,68 @@ describe 'User browses commits' do
sign_in(user) sign_in(user)
end end
it 'renders commit' do
visit project_commit_path(project, sample_commit.id)
expect(page).to have_content(sample_commit.message)
.and have_content("Showing #{sample_commit.files_changed_count} changed files")
.and have_content('Side-by-side')
end
it 'fill commit sha when click new tag from commit page' do
visit project_commit_path(project, sample_commit.id)
click_link 'Tag'
expect(page).to have_selector("input[value='#{sample_commit.id}']", visible: false)
end
it 'renders inline diff button when click side-by-side diff button' do
visit project_commit_path(project, sample_commit.id)
find('#parallel-diff-btn').click
expect(page).to have_content 'Inline'
end
it 'renders breadcrumbs on specific commit path' do
visit project_commits_path(project, project.repository.root_ref + '/files/ruby/regex.rb', limit: 5)
expect(page).to have_selector('ul.breadcrumb')
.and have_selector('ul.breadcrumb a', count: 4)
end
it 'renders diff links to both the previous and current image' do
visit project_commit_path(project, sample_image_commit.id)
links = page.all('.file-actions a')
expect(links[0]['href']).to match %r{blob/#{sample_image_commit.old_blob_id}}
expect(links[1]['href']).to match %r{blob/#{sample_image_commit.new_blob_id}}
end
context 'when commit has ci status' do
let(:pipeline) { create(:ci_pipeline, project: project, sha: sample_commit.id) }
before do
project.enable_ci
create(:ci_build, pipeline: pipeline)
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file).and_return('')
end
it 'renders commit ci info' do
visit project_commit_path(project, sample_commit.id)
expect(page).to have_content "Pipeline ##{pipeline.id} pending"
end
end
context 'primary email' do context 'primary email' do
it 'finds a commit by a primary email' do it 'finds a commit by a primary email' do
user = create(:user, email: 'dmitriy.zaporozhets@gmail.com') user = create(:user, email: 'dmitriy.zaporozhets@gmail.com')
visit(project_commit_path(project, RepoHelpers.sample_commit.id)) visit(project_commit_path(project, sample_commit.id))
check_author_link(RepoHelpers.sample_commit.author_email, user) check_author_link(sample_commit.author_email, user)
end end
end end
...@@ -26,9 +83,9 @@ describe 'User browses commits' do ...@@ -26,9 +83,9 @@ describe 'User browses commits' do
create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' }) create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' })
end end
visit(project_commit_path(project, RepoHelpers.sample_commit.parent_id)) visit(project_commit_path(project, sample_commit.parent_id))
check_author_link(RepoHelpers.sample_commit.author_email, user) check_author_link(sample_commit.author_email, user)
end end
end end
...@@ -44,6 +101,135 @@ describe 'User browses commits' do ...@@ -44,6 +101,135 @@ describe 'User browses commits' do
expect(find('.diff-file-changes', visible: false)).to have_content('No file name available') expect(find('.diff-file-changes', visible: false)).to have_content('No file name available')
end end
end end
describe 'commits list' do
let(:visit_commits_page) do
visit project_commits_path(project, project.repository.root_ref, limit: 5)
end
it 'searches commit', :js do
visit_commits_page
fill_in 'commits-search', with: 'submodules'
expect(page).to have_content 'More submodules'
expect(page).not_to have_content 'Change some files'
end
it 'renders commits atom feed' do
visit_commits_page
click_link('Commits feed')
commit = project.repository.commit
expect(response_headers['Content-Type']).to have_content("application/atom+xml")
expect(body).to have_selector('title', text: "#{project.name}:master commits")
.and have_selector('author email', text: commit.author_email)
.and have_selector('entry summary', text: commit.description[0..10].delete("\r\n"))
end
context 'master branch' do
before do
visit_commits_page
end
it 'renders project commits' do
commit = project.repository.commit
expect(page).to have_content(project.name)
.and have_content(commit.message[0..20])
.and have_content(commit.short_id)
end
it 'does not render create merge request button' do
expect(page).not_to have_link 'Create merge request'
end
context 'when click the compare tab' do
before do
click_link('Compare')
end
it 'does not render create merge request button' do
expect(page).not_to have_link 'Create merge request'
end
end
end
context 'feature branch' do
let(:visit_commits_page) do
visit project_commits_path(project, 'feature')
end
context 'when project does not have open merge requests' do
before do
visit_commits_page
end
it 'renders project commits' do
commit = project.repository.commit('0b4bc9a')
expect(page).to have_content(project.name)
.and have_content(commit.message[0..12])
.and have_content(commit.short_id)
end
it 'renders create merge request button' do
expect(page).to have_link 'Create merge request'
end
context 'when click the compare tab' do
before do
click_link('Compare')
end
it 'renders create merge request button' do
expect(page).to have_link 'Create merge request'
end
end
end
context 'when project have open merge request' do
let!(:merge_request) do
create(
:merge_request,
title: 'Feature',
source_project: project,
source_branch: 'feature',
target_branch: 'master',
author: project.users.first
)
end
before do
visit_commits_page
end
it 'renders project commits' do
commit = project.repository.commit('0b4bc9a')
expect(page).to have_content(project.name)
.and have_content(commit.message[0..12])
.and have_content(commit.short_id)
end
it 'renders button to the merge request' do
expect(page).not_to have_link 'Create merge request'
expect(page).to have_link 'View open merge request', href: project_merge_request_path(project, merge_request)
end
context 'when click the compare tab' do
before do
click_link('Compare')
end
it 'renders button to the merge request' do
expect(page).not_to have_link 'Create merge request'
expect(page).to have_link 'View open merge request', href: project_merge_request_path(project, merge_request)
end
end
end
end
end
end end
private private
......
...@@ -7,16 +7,19 @@ describe "Compare", :js do ...@@ -7,16 +7,19 @@ describe "Compare", :js do
before do before do
project.add_master(user) project.add_master(user)
sign_in user sign_in user
visit project_compare_index_path(project, from: "master", to: "master")
end end
describe "branches" do describe "branches" do
it "pre-populates fields" do it "pre-populates fields" do
visit project_compare_index_path(project, from: "master", to: "master")
expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("master") expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("master")
expect(find(".js-compare-to-dropdown .dropdown-toggle-text")).to have_content("master") expect(find(".js-compare-to-dropdown .dropdown-toggle-text")).to have_content("master")
end end
it "compares branches" do it "compares branches" do
visit project_compare_index_path(project, from: "master", to: "master")
select_using_dropdown "from", "feature" select_using_dropdown "from", "feature"
expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("feature") expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("feature")
...@@ -26,9 +29,58 @@ describe "Compare", :js do ...@@ -26,9 +29,58 @@ describe "Compare", :js do
click_button "Compare" click_button "Compare"
expect(page).to have_content "Commits" expect(page).to have_content "Commits"
expect(page).to have_link 'Create merge request'
end
it 'renders additions info when click unfold diff' do
visit project_compare_index_path(project)
select_using_dropdown('from', RepoHelpers.sample_commit.parent_id, commit: true)
select_using_dropdown('to', RepoHelpers.sample_commit.id, commit: true)
click_button 'Compare'
expect(page).to have_content 'Commits (1)'
expect(page).to have_content "Showing 2 changed files"
diff = first('.js-unfold')
diff.click
wait_for_requests
page.within diff.query_scope do
expect(first('.new_line').text).not_to have_content "..."
end
end
context 'when project have an open merge request' do
let!(:merge_request) do
create(
:merge_request,
title: 'Feature',
source_project: project,
source_branch: 'feature',
target_branch: 'master',
author: project.users.first
)
end
it 'compares branches' do
visit project_compare_index_path(project)
select_using_dropdown('from', 'master')
select_using_dropdown('to', 'feature')
click_button 'Compare'
expect(page).to have_content 'Commits (1)'
expect(page).to have_content 'Showing 1 changed file with 5 additions and 0 deletions'
expect(page).to have_link 'View open merge request', href: project_merge_request_path(project, merge_request)
expect(page).not_to have_link 'Create merge request'
end
end end
it "filters branches" do it "filters branches" do
visit project_compare_index_path(project, from: "master", to: "master")
select_using_dropdown("from", "wip") select_using_dropdown("from", "wip")
find(".js-compare-from-dropdown .compare-dropdown-toggle").click find(".js-compare-from-dropdown .compare-dropdown-toggle").click
...@@ -39,6 +91,8 @@ describe "Compare", :js do ...@@ -39,6 +91,8 @@ describe "Compare", :js do
describe "tags" do describe "tags" do
it "compares tags" do it "compares tags" do
visit project_compare_index_path(project, from: "master", to: "master")
select_using_dropdown "from", "v1.0.0" select_using_dropdown "from", "v1.0.0"
expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("v1.0.0") expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("v1.0.0")
...@@ -50,15 +104,20 @@ describe "Compare", :js do ...@@ -50,15 +104,20 @@ describe "Compare", :js do
end end
end end
def select_using_dropdown(dropdown_type, selection) def select_using_dropdown(dropdown_type, selection, commit: false)
dropdown = find(".js-compare-#{dropdown_type}-dropdown") dropdown = find(".js-compare-#{dropdown_type}-dropdown")
dropdown.find(".compare-dropdown-toggle").click dropdown.find(".compare-dropdown-toggle").click
# find input before using to wait for the inputs visiblity # find input before using to wait for the inputs visiblity
dropdown.find('.dropdown-menu') dropdown.find('.dropdown-menu')
dropdown.fill_in("Filter by Git revision", with: selection) dropdown.fill_in("Filter by Git revision", with: selection)
wait_for_requests wait_for_requests
if commit
dropdown.find('input[type="search"]').send_keys(:return)
else
# find before all to wait for the items visiblity # find before all to wait for the items visiblity
dropdown.find("a[data-ref=\"#{selection}\"]", match: :first) dropdown.find("a[data-ref=\"#{selection}\"]", match: :first)
dropdown.all("a[data-ref=\"#{selection}\"]").last.click dropdown.all("a[data-ref=\"#{selection}\"]").last.click
end 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