diff --git a/CHANGELOG b/CHANGELOG index 51f19565cd..efdb865095 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,10 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.12.0 (unreleased) + - Update oauth button logos for Twitter and Google to recommended assets + - Update browser gem to version 0.8.0 for IE11 support (Stan Hu) - Fix timeout when rendering file with thousands of lines. + - Add "Remember me" checkbox to LDAP signin form. - Don't notify users mentioned in code blocks or blockquotes. - Omit link to generate labels if user does not have access to create them (Stan Hu) - Show warning when a comment will add 10 or more people to the discussion. diff --git a/Gemfile b/Gemfile index 6f736652ed..6fe5ed22c9 100644 --- a/Gemfile +++ b/Gemfile @@ -30,7 +30,7 @@ gem 'rqrcode-rails3' gem 'attr_encrypted', '1.3.4' # Browser detection -gem "browser" +gem "browser", '~> 0.8.0' # Extracting information from a git repository # Provide access to Gitlab::Git library @@ -82,7 +82,7 @@ gem "carrierwave" gem 'dropzonejs-rails' # for aws storage -gem "fog", "~> 1.14" +gem "fog", "~> 1.25.0" gem "unf" # Authorization @@ -257,10 +257,10 @@ group :development, :test do end group :test do - gem "simplecov", require: false - gem "shoulda-matchers", "~> 2.7.0" + gem 'simplecov', require: false + gem 'shoulda-matchers', '~> 2.8.0', require: false gem 'email_spec' - gem "webmock" + gem 'webmock', '~> 1.21.0' gem 'test_after_commit' end diff --git a/Gemfile.lock b/Gemfile.lock index 88e64c7732..4cb66e674b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,7 @@ GEM remote: https://rubygems.org/ specs: + CFPropertyList (2.3.1) RedCloth (4.2.9) ace-rails-ap (2.0.1) actionmailer (4.1.9) @@ -35,7 +36,7 @@ GEM tzinfo (~> 1.1) acts-as-taggable-on (3.5.0) activerecord (>= 3.2, < 5) - addressable (2.3.5) + addressable (2.3.8) annotate (2.6.0) activerecord (>= 2.3.0) rake (>= 0.8.7) @@ -75,7 +76,7 @@ GEM ruby_parser (~> 3.5.0) sass (~> 3.0) terminal-table (~> 1.4) - browser (0.7.2) + browser (0.8.0) builder (3.2.2) byebug (3.2.0) columnize (~> 0.8) @@ -118,8 +119,8 @@ GEM simplecov (>= 0.7) term-ansicolor thor - crack (0.4.1) - safe_yaml (~> 0.9.0) + crack (0.4.2) + safe_yaml (~> 1.0.0) creole (0.3.8) d3_rails (3.5.5) railties (>= 3.1.0) @@ -163,7 +164,7 @@ GEM erubis (2.7.0) escape_utils (0.2.4) eventmachine (1.0.4) - excon (0.32.1) + excon (0.45.3) execjs (2.5.2) expression_parser (0.9.0) factory_girl (4.3.0) @@ -178,29 +179,69 @@ GEM fastercsv (1.5.5) ffaker (2.0.0) ffi (1.9.8) - fog (1.21.0) - fog-brightbox - fog-core (~> 1.21, >= 1.21.1) + fission (0.5.0) + CFPropertyList (~> 2.2) + fog (1.25.0) + fog-brightbox (~> 0.4) + fog-core (~> 1.25) fog-json + fog-profitbricks + fog-radosgw (>= 0.0.2) + fog-sakuracloud (>= 0.0.4) + fog-softlayer + fog-terremark + fog-vmfusion + fog-voxel + fog-xml (~> 0.1.1) + ipaddress (~> 0.5) nokogiri (~> 1.5, >= 1.5.11) - fog-brightbox (0.0.1) - fog-core + opennebula + fog-brightbox (0.7.1) + fog-core (~> 1.22) fog-json - fog-core (1.21.1) + inflecto (~> 0.0.2) + fog-core (1.30.0) builder - excon (~> 0.32) - formatador (~> 0.2.0) + excon (~> 0.45) + formatador (~> 0.2) mime-types net-scp (~> 1.1) net-ssh (>= 2.1.3) - fog-json (1.0.0) - multi_json (~> 1.0) + fog-json (1.0.2) + fog-core (~> 1.0) + multi_json (~> 1.10) + fog-profitbricks (0.0.3) + fog-core + fog-xml + nokogiri + fog-radosgw (0.0.4) + fog-core (>= 1.21.0) + fog-json + fog-xml (>= 0.0.1) + fog-sakuracloud (1.0.1) + fog-core + fog-json + fog-softlayer (0.4.6) + fog-core + fog-json + fog-terremark (0.1.0) + fog-core + fog-xml + fog-vmfusion (0.1.0) + fission + fog-core + fog-voxel (0.1.0) + fog-core + fog-xml + fog-xml (0.1.2) + fog-core + nokogiri (~> 1.5, >= 1.5.11) font-awesome-rails (4.2.0.0) railties (>= 3.2, < 5.0) foreman (0.63.0) dotenv (>= 0.7) thor (>= 0.13.6) - formatador (0.2.4) + formatador (0.2.5) gemnasium-gitlab-service (0.2.6) rugged (~> 0.21) gemojione (2.0.0) @@ -288,6 +329,8 @@ GEM i18n (0.7.0) ice_cube (0.11.1) ice_nine (0.10.0) + inflecto (0.0.2) + ipaddress (0.8.0) jquery-atwho-rails (1.0.1) jquery-rails (3.1.2) railties (>= 3.0, < 5.0) @@ -329,9 +372,9 @@ GEM multipart-post (1.2.0) mysql2 (0.3.16) net-ldap (0.11) - net-scp (1.1.2) + net-scp (1.2.1) net-ssh (>= 2.6.5) - net-ssh (2.8.0) + net-ssh (2.9.2) newrelic_rpm (3.9.4.245) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) @@ -380,6 +423,10 @@ GEM omniauth-twitter (1.0.1) multi_json (~> 1.3) omniauth-oauth (~> 1.0) + opennebula (4.12.1) + json + nokogiri + rbvmomi org-ruby (0.9.12) rubypants (~> 0.2) orm_adapter (0.5.0) @@ -447,6 +494,10 @@ GEM rb-fsevent (0.9.4) rb-inotify (0.9.5) ffi (>= 0.5.0) + rbvmomi (1.8.2) + builder + nokogiri (>= 1.4.1) + trollop rdoc (3.12.2) json (~> 1.4) redcarpet (3.2.3) @@ -514,7 +565,7 @@ GEM rubypants (0.2.0) rugged (0.22.2) rugments (1.0.0.beta7) - safe_yaml (0.9.7) + safe_yaml (1.0.4) sanitize (2.1.0) nokogiri (>= 1.4.4) sass (3.2.19) @@ -536,7 +587,7 @@ GEM thor (~> 0.14) settingslogic (2.0.9) sexp_processor (4.4.5) - shoulda-matchers (2.7.0) + shoulda-matchers (2.8.0) activesupport (>= 3.0.0) sidekiq (3.3.0) celluloid (>= 0.16.0) @@ -622,6 +673,7 @@ GEM multi_json (~> 1.7) twitter-stream (~> 0.1) tins (0.13.1) + trollop (2.1.2) turbolinks (2.5.3) coffee-rails twitter-stream (0.1.16) @@ -653,8 +705,8 @@ GEM equalizer (~> 0.0.7) warden (1.2.3) rack (>= 1.0) - webmock (1.16.0) - addressable (>= 2.2.7) + webmock (1.21.0) + addressable (>= 2.3.6) crack (>= 0.3.2) websocket-driver (0.3.3) wikicloth (0.8.1) @@ -681,7 +733,7 @@ DEPENDENCIES binding_of_caller bootstrap-sass (~> 3.0) brakeman - browser + browser (~> 0.8.0) byebug cal-heatmap-rails (~> 0.0.1) capybara (~> 2.2.1) @@ -705,7 +757,7 @@ DEPENDENCIES enumerize factory_girl_rails ffaker (~> 2.0.0) - fog (~> 1.14) + fog (~> 1.25.0) font-awesome-rails (~> 4.2) foreman gemnasium-gitlab-service (~> 0.2) @@ -775,7 +827,7 @@ DEPENDENCIES seed-fu select2-rails settingslogic - shoulda-matchers (~> 2.7.0) + shoulda-matchers (~> 2.8.0) sidekiq (~> 3.3) sidetiq (= 0.6.3) simplecov @@ -804,5 +856,5 @@ DEPENDENCIES unicorn-worker-killer version_sorter virtus - webmock + webmock (~> 1.21.0) wikicloth (= 0.8.1) diff --git a/app/assets/images/authbuttons/google_64.png b/app/assets/images/authbuttons/google_64.png index 94a0e089c6..fb64f8bee6 100644 Binary files a/app/assets/images/authbuttons/google_64.png and b/app/assets/images/authbuttons/google_64.png differ diff --git a/app/assets/images/authbuttons/twitter_64.png b/app/assets/images/authbuttons/twitter_64.png index 5c9f14cb07..e3bd9169a3 100644 Binary files a/app/assets/images/authbuttons/twitter_64.png and b/app/assets/images/authbuttons/twitter_64.png differ diff --git a/app/assets/javascripts/calendar.js.coffee b/app/assets/javascripts/calendar.js.coffee index 44d75bd694..4c4bc3d66e 100644 --- a/app/assets/javascripts/calendar.js.coffee +++ b/app/assets/javascripts/calendar.js.coffee @@ -25,6 +25,7 @@ class @Calendar 30 ] legendCellPadding: 3 + cellSize: $('.user-calendar').width() / 80 onClick: (date, count) -> formated_date = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate() $.ajax diff --git a/app/assets/javascripts/merge_request.js.coffee b/app/assets/javascripts/merge_request.js.coffee index b8f916b522..25a7815dba 100644 --- a/app/assets/javascripts/merge_request.js.coffee +++ b/app/assets/javascripts/merge_request.js.coffee @@ -11,12 +11,6 @@ class @MergeRequest # commits_loaded - Boolean, have commits been pre-rendered server-side? # (default: false) # - # check_enable - Boolean, whether to check automerge status - # url_to_automerge_check - String, URL to use to check automerge status - # current_status - String, current automerge status - # ci_enable - Boolean, whether a CI service is enabled - # url_to_ci_check - String, URL to use to check CI status - # constructor: (@opts) -> @initContextWidget() this.$el = $('.merge-request') @@ -27,14 +21,9 @@ class @MergeRequest this.bindEvents() this.activateTabFromPath() - this.initMergeWidget() this.$('.show-all-commits').on 'click', => this.showAllCommits() - modal = $('#modal_merge_info').modal(show: false) - - disableButtonIfEmptyField '#commit_message', '.accept_merge_request' - # Prevent duplicate event bindings @disableTaskList() @@ -63,20 +52,6 @@ class @MergeRequest $(".context .inline-update").on "change", "#merge_request_assignee_id", -> $(this).submit() - initMergeWidget: -> - this.showState( @opts.current_status ) - - if this.$('.automerge_widget').length and @opts.check_enable - $.get @opts.url_to_automerge_check, (data) => - this.showState( data.merge_status ) - , 'json' - - if @opts.ci_enable - $.get @opts.url_to_ci_check, (data) => - this.showCiState data.status - if data.coverage - this.showCiCoverage data.coverage - , 'json' bindEvents: -> this.$('.merge-request-tabs a[data-toggle="tab"]').on 'shown.bs.tab', (e) => @@ -92,22 +67,6 @@ class @MergeRequest unless @opts.action == 'new' @setCurrentAction(tab_action) - this.$('.accept_merge_request').on 'click', -> - $('.automerge_widget.can_be_merged').hide() - $('.merge-in-progress').show() - - this.$('.remove_source_branch').on 'click', -> - $('.remove_source_branch_widget').hide() - $('.remove_source_branch_in_progress').show() - - this.$(".remove_source_branch").on "ajax:success", (e, data, status, xhr) -> - location.reload() - - this.$(".remove_source_branch").on "ajax:error", (e, data, status, xhr) => - this.$('.remove_source_branch_widget').hide() - this.$('.remove_source_branch_in_progress').hide() - this.$('.remove_source_branch_widget.failed').show() - # Activate a tab based on the current URL path # # If the current action is 'show' or 'new' (i.e., initial page load), @@ -157,30 +116,6 @@ class @MergeRequest # See https://github.com/rails/turbolinks/issues/363 history.replaceState {turbolinks: true, url: new_state}, '', new_state - showState: (state) -> - $('.automerge_widget').hide() - $('.automerge_widget.' + state).show() - - showCiState: (state) -> - $('.ci_widget').hide() - allowed_states = ["failed", "canceled", "running", "pending", "success"] - if state in allowed_states - $('.ci_widget.ci-' + state).show() - switch state - when "failed", "canceled" - @setMergeButtonClass('btn-danger') - when "running", "pending" - @setMergeButtonClass('btn-warning') - else - $('.ci_widget.ci-error').show() - @setMergeButtonClass('btn-danger') - - showCiCoverage: (coverage) -> - cov_html = $('') - cov_html.addClass('ci-coverage') - cov_html.text('Coverage ' + coverage + '%') - $('.ci_widget:visible').append(cov_html) - loadDiff: (event) -> $.ajax type: 'GET' @@ -198,26 +133,6 @@ class @MergeRequest this.$('.first-commits').remove() this.$('.all-commits').removeClass 'hide' - alreadyOrCannotBeMerged: -> - this.$('.automerge_widget').hide() - this.$('.merge-in-progress').hide() - this.$('.automerge_widget.already_cannot_be_merged').show() - - setMergeButtonClass: (css_class) -> - $('.accept_merge_request').removeClass("btn-create").addClass(css_class) - - mergeInProgress: -> - $.ajax - type: 'GET' - url: $('.merge-request').data('url') - success: (data) => - switch data.state - when 'merged' - location.reload() - else - setTimeout(merge_request.mergeInProgress, 3000) - dataType: 'json' - initTaskList: -> $('.merge-request-details .js-task-list-container').taskList('enable') $(document).on 'tasklist:changed', '.merge-request-details .js-task-list-container', @updateTaskList diff --git a/app/assets/javascripts/merge_request_widget.js.coffee b/app/assets/javascripts/merge_request_widget.js.coffee new file mode 100644 index 0000000000..ca769e06a4 --- /dev/null +++ b/app/assets/javascripts/merge_request_widget.js.coffee @@ -0,0 +1,58 @@ +class @MergeRequestWidget + # Initialize MergeRequestWidget behavior + # + # check_enable - Boolean, whether to check automerge status + # url_to_automerge_check - String, URL to use to check automerge status + # current_status - String, current automerge status + # ci_enable - Boolean, whether a CI service is enabled + # url_to_ci_check - String, URL to use to check CI status + # + constructor: (@opts) -> + modal = $('#modal_merge_info').modal(show: false) + + mergeInProgress: -> + $.ajax + type: 'GET' + url: $('.merge-request').data('url') + success: (data) => + switch data.state + when 'merged' + location.reload() + else + setTimeout(merge_request_widget.mergeInProgress, 3000) + dataType: 'json' + + getMergeStatus: -> + $.get @opts.url_to_automerge_check, (data) -> + $('.mr-state-widget').replaceWith(data) + + getCiStatus: -> + if @opts.ci_enable + $.get @opts.url_to_ci_check, (data) => + this.showCiState data.status + if data.coverage + this.showCiCoverage data.coverage + , 'json' + + showCiState: (state) -> + $('.ci_widget').hide() + allowed_states = ["failed", "canceled", "running", "pending", "success"] + if state in allowed_states + $('.ci_widget.ci-' + state).show() + switch state + when "failed", "canceled" + @setMergeButtonClass('btn-danger') + when "running", "pending" + @setMergeButtonClass('btn-warning') + else + $('.ci_widget.ci-error').show() + @setMergeButtonClass('btn-danger') + + showCiCoverage: (coverage) -> + cov_html = $('') + cov_html.addClass('ci-coverage') + cov_html.text('Coverage ' + coverage + '%') + $('.ci_widget:visible').append(cov_html) + + setMergeButtonClass: (css_class) -> + $('.accept_merge_request').removeClass("btn-create").addClass(css_class) diff --git a/app/assets/javascripts/stat_graph_contributors_graph.js.coffee b/app/assets/javascripts/stat_graph_contributors_graph.js.coffee index 0e6fbdef3b..b7a0e07376 100644 --- a/app/assets/javascripts/stat_graph_contributors_graph.js.coffee +++ b/app/assets/javascripts/stat_graph_contributors_graph.js.coffee @@ -50,7 +50,7 @@ class @ContributorsGraph class @ContributorsMasterGraph extends ContributorsGraph constructor: (@data) -> - @width = $('.container').width() - 345 + @width = $('.content').width() - 70 @height = 200 @x = null @y = null @@ -123,7 +123,7 @@ class @ContributorsMasterGraph extends ContributorsGraph class @ContributorsAuthorGraph extends ContributorsGraph constructor: (@data) -> - @width = $('.container').width()/2 - 225 + @width = $('.content').width()/2 - 100 @height = 200 @x = null @y = null diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss index 86bbb8d932..7e5cca6257 100644 --- a/app/assets/stylesheets/pages/merge_requests.scss +++ b/app/assets/stylesheets/pages/merge_requests.scss @@ -3,7 +3,7 @@ * MR -> show: Automerge widget * */ -.automerge_widget { +.mr-state-widget { form { margin-bottom: 0; .clearfix { diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index ee449badf5..f616ccf568 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -5,7 +5,7 @@ class Admin::ProjectsController < Admin::ApplicationController def index @projects = Project.all - @projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present? + @projects = @projects.in_namespace(params[:namespace_id]) if params[:namespace_id].present? @projects = @projects.where("visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present? @projects = @projects.with_push if params[:with_push].present? @projects = @projects.abandoned if params[:abandoned].present? diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 54a5e3feca..c9644c4f09 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -25,7 +25,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController @user = Gitlab::LDAP::User.new(oauth) @user.save if @user.changed? # will also save new users gl_user = @user.gl_user - gl_user.remember_me = true if @user.persisted? + gl_user.remember_me = params[:remember_me] if @user.persisted? # Do additional LDAP checks for the user filter and EE features if @user.allowed? diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 641268a8bb..fb47fa0ef8 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -139,11 +139,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request.check_if_can_be_merged end - render json: { merge_status: @merge_request.automerge_status } + closes_issues + + render partial: "projects/merge_requests/widget/show.html.haml", layout: false end def automerge - return access_denied! unless allowed_to_merge? + return access_denied! unless @merge_request.can_be_merged_by?(current_user) if @merge_request.automergeable? AutoMergeWorker.perform_async(@merge_request.id, current_user.id, params) @@ -260,8 +262,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController @commits = @merge_request.commits @merge_request_diff = @merge_request.merge_request_diff - @allowed_to_merge = allowed_to_merge? - @show_merge_controls = @merge_request.open? && @commits.any? && @allowed_to_merge @source_branch = @merge_request.source_project.repository.find_branch(@merge_request.source_branch).try(:name) if @merge_request.locked_long_ago? @@ -270,19 +270,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController end end - def allowed_to_merge? - allowed_to_push_code?(project, @merge_request.target_branch) - end - def invalid_mr # Render special view for MR with removed source or target branch render 'invalid' end - def allowed_to_push_code?(project, branch) - ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(branch) - end - def merge_request_params params.require(:merge_request).permit( :title, :assignee_id, :source_project_id, :source_branch, diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb index d87243b970..89d1ff5cfc 100644 --- a/app/controllers/projects/project_members_controller.rb +++ b/app/controllers/projects/project_members_controller.rb @@ -2,8 +2,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController # Authorize before_action :authorize_admin_project!, except: :leave - layout "project_settings" - def index @project_members = @project.project_members @project_members = @project_members.non_invite unless can?(current_user, :admin_project, @project) diff --git a/app/helpers/tab_helper.rb b/app/helpers/tab_helper.rb index bbb37259d6..8d0e3de776 100644 --- a/app/helpers/tab_helper.rb +++ b/app/helpers/tab_helper.rb @@ -89,7 +89,7 @@ module TabHelper def project_tab_class return "active" if current_page?(controller: "/projects", action: :edit, id: @project) - if ['services', 'git_hooks', 'hooks', 'deploy_keys', 'project_members', 'protected_branches'].include? controller.controller_name + if ['services', 'hooks', 'deploy_keys', 'protected_branches', 'git_hooks'].include? controller.controller_name "active" end end diff --git a/app/models/commit.rb b/app/models/commit.rb index f02fe24054..9d72166162 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -172,10 +172,8 @@ class Commit @raw.send(m, *args, &block) end - def respond_to?(method) - return true if @raw.respond_to?(method) - - super + def respond_to_missing?(method, include_private = false) + @raw.respond_to?(method, include_private) || super end # Truncate sha to 8 characters diff --git a/app/models/concerns/taskable.rb b/app/models/concerns/taskable.rb index 33b4814d7e..660e58b876 100644 --- a/app/models/concerns/taskable.rb +++ b/app/models/concerns/taskable.rb @@ -1,4 +1,5 @@ require 'task_list' +require 'task_list/filter' # Contains functionality for objects that can have task lists in their # descriptions. Task list items can be added with Markdown like "* [x] Fix diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index c9824cba30..e503dd19dd 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -433,4 +433,16 @@ class MergeRequest < ActiveRecord::Base def approved_by_users approvals.map(&:user) end + + def has_ci? + source_project.ci_service && commits.any? + end + + def branch_missing? + !source_branch_exists? || !target_branch_exists? + end + + def can_be_merged_by?(user) + ::Gitlab::GitAccess.new(user, project).can_push_to_branch?(target_branch) + end end diff --git a/app/models/project.rb b/app/models/project.rb index 9a72f7c25f..a308428c36 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -164,7 +164,7 @@ class Project < ActiveRecord::Base scope :without_user, ->(user) { where('projects.id NOT IN (:ids)', ids: user.authorized_projects.map(&:id) ) } scope :without_team, ->(team) { team.projects.present? ? where('projects.id NOT IN (:ids)', ids: team.projects.map(&:id)) : scoped } scope :not_in_group, ->(group) { where('projects.id NOT IN (:ids)', ids: group.project_ids ) } - scope :in_namespace, ->(namespace) { where(namespace_id: namespace.id) } + scope :in_namespace, ->(namespace_ids) { where(namespace_id: namespace_ids) } scope :in_group_namespace, -> { joins(:group) } scope :personal, ->(user) { where(namespace_id: user.namespace_id) } scope :joined, ->(user) { where('namespace_id != ?', user.namespace_id) } diff --git a/app/models/repository.rb b/app/models/repository.rb index 1ca9701763..2c6347222a 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -163,10 +163,8 @@ class Repository end end - def respond_to?(method) - return true if raw_repository.respond_to?(method) - - super + def respond_to_missing?(method, include_private = false) + raw_repository.respond_to?(method, include_private) || super end def blob_at(sha, path) diff --git a/app/models/user.rb b/app/models/user.rb index d0fbaeceb6..1c0df57103 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -381,9 +381,11 @@ class User < ActiveRecord::Base end def owned_projects - @owned_projects ||= begin - Project.where(namespace_id: owned_groups.pluck(:id).push(namespace.id)).joins(:namespace) - end + @owned_projects ||= + begin + namespace_ids = owned_groups.pluck(:id).push(namespace.id) + Project.in_namespace(namespace_ids).joins(:namespace) + end end # Team membership in authorized projects diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb index 0bcc50c81a..e904cb6c6f 100644 --- a/app/services/search/global_service.rb +++ b/app/services/search/global_service.rb @@ -9,7 +9,7 @@ module Search def execute group = Group.find_by(id: params[:group_id]) if params[:group_id].present? projects = ProjectsFinder.new.execute(current_user) - projects = projects.where(namespace_id: group.id) if group + projects = projects.in_namespace(group.id) if group project_ids = projects.pluck(:id) Gitlab::SearchResults.new(project_ids, params[:search]) diff --git a/app/views/dashboard/_activities.html.haml b/app/views/dashboard/_activities.html.haml index ba49013d83..213b5d65b3 100644 --- a/app/views/dashboard/_activities.html.haml +++ b/app/views/dashboard/_activities.html.haml @@ -6,7 +6,6 @@ %li.pull-right = link_to dashboard_path(:atom, { private_token: current_user.private_token }), class: 'rss-btn' do %i.fa.fa-rss - Activity Feed = render 'shared/event_filter' %hr diff --git a/app/views/devise/sessions/_new_ldap.html.haml b/app/views/devise/sessions/_new_ldap.html.haml index 812e22373a..6ec741e488 100644 --- a/app/views/devise/sessions/_new_ldap.html.haml +++ b/app/views/devise/sessions/_new_ldap.html.haml @@ -1,4 +1,9 @@ = form_tag(user_omniauth_callback_path(server['provider_name']), id: 'new_ldap_user' ) do = text_field_tag :username, nil, {class: "form-control top", placeholder: "#{server['label']} Login", autofocus: "autofocus"} = password_field_tag :password, nil, {class: "form-control bottom", placeholder: "Password"} + - if devise_mapping.rememberable? + .remember-me.checkbox + %label{for: "remember_me"} + = check_box_tag :remember_me, '1', false, id: 'remember_me' + %span Remember me = button_tag "#{server['label']} Sign in", class: "btn-save btn" diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index f4a9e8cebb..243e70062a 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -27,7 +27,6 @@ %li = link_to group_path(@group, { format: :atom, private_token: current_user.private_token }), title: "Feed", class: 'rss-btn' do %i.fa.fa-rss - Activity Feed = render 'shared/event_filter' %hr diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index 172f5197b2..cbcf560d0a 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -56,6 +56,13 @@ Merge Requests %span.count.merge_counter= @project.merge_requests.opened.count + - if project_nav_tab? :settings + = nav_link(controller: [:project_members, :teams]) do + = link_to namespace_project_project_members_path(@project.namespace, @project), title: 'Members', class: 'team-tab tab', data: {placement: 'right'} do + = icon('users fw') + %span + Members + - if project_nav_tab? :labels = nav_link(controller: :labels) do = link_to namespace_project_labels_path(@project.namespace, @project), title: 'Labels', data: {placement: 'right'} do diff --git a/app/views/layouts/nav/_project_settings.html.haml b/app/views/layouts/nav/_project_settings.html.haml index be5fba68bb..cf64d7abd3 100644 --- a/app/views/layouts/nav/_project_settings.html.haml +++ b/app/views/layouts/nav/_project_settings.html.haml @@ -10,14 +10,9 @@ %ul.project-settings-nav.sidebar-subnav = nav_link(path: 'projects#edit') do = link_to edit_project_path(@project), title: 'Project', class: 'stat-tab tab', data: {placement: 'right'} do - = icon('pencil-square-o') + = icon('pencil-square-o fw') %span Project Settings - = nav_link(controller: [:project_members, :teams]) do - = link_to namespace_project_project_members_path(@project.namespace, @project), title: 'Members', class: 'team-tab tab', data: {placement: 'right'} do - = icon('users') - %span - Members = nav_link(controller: :group_links) do = link_to namespace_project_group_links_path(@project.namespace, @project) do %i.fa.fa-share-square-o @@ -25,12 +20,12 @@ Groups = nav_link(controller: :deploy_keys) do = link_to namespace_project_deploy_keys_path(@project.namespace, @project), title: 'Deploy Keys', data: {placement: 'right'} do - = icon('key') + = icon('key fw') %span Deploy Keys = nav_link(controller: :hooks) do = link_to namespace_project_hooks_path(@project.namespace, @project), title: 'Web Hooks', data: {placement: 'right'} do - = icon('link') + = icon('link fw') %span Web Hooks = nav_link(controller: :git_hooks) do @@ -40,12 +35,12 @@ Git Hooks = nav_link(controller: :services) do = link_to namespace_project_services_path(@project.namespace, @project), title: 'Services', data: {placement: 'right'} do - = icon('cogs') + = icon('cogs fw') %span Services = nav_link(controller: :protected_branches) do = link_to namespace_project_protected_branches_path(@project.namespace, @project), title: 'Protected Branches', data: {placement: 'right'} do - = icon('lock') + = icon('lock fw') %span Protected branches = nav_link(controller: :audit_events) do diff --git a/app/views/profiles/two_factor_auths/new.html.haml b/app/views/profiles/two_factor_auths/new.html.haml index b9f3e2380f..74268c9bde 100644 --- a/app/views/profiles/two_factor_auths/new.html.haml +++ b/app/views/profiles/two_factor_auths/new.html.haml @@ -2,8 +2,10 @@ %h2.page-title Two-Factor Authentication (2FA) %p - Download the Google Authenticator application from App Store for iOS or - Google Play for Android and scan this code. + Download the Google Authenticator application from App Store for iOS or Google + Play for Android and scan this code. + + More information is available in the #{link_to('documentation', help_page_path('workflow', 'two_factor_authentication'))}. %hr @@ -12,10 +14,9 @@ .alert.alert-danger = @error .form-group - .col-sm-2 - .col-sm-2 + .col-lg-2.col-lg-offset-2 = raw @qr_code - .col-sm-8.manual-instructions + .col-lg-7.col-lg-offset-1.manual-instructions %h3 Can't scan the code? %p @@ -33,7 +34,7 @@ %dd Yes .form-group = label_tag :pin_code, nil, class: "control-label" - .col-sm-10 + .col-lg-10 = text_field_tag :pin_code, nil, class: "form-control", required: true, autofocus: true .form-actions = submit_tag 'Submit', class: 'btn btn-success' diff --git a/app/views/projects/_md_preview.html.haml b/app/views/projects/_md_preview.html.haml index a831481cf8..b7bca6dae0 100644 --- a/app/views/projects/_md_preview.html.haml +++ b/app/views/projects/_md_preview.html.haml @@ -2,10 +2,10 @@ .md-header.clearfix %ul.nav.nav-tabs %li.active - = link_to '#md-write-holder', class: 'js-md-write-button' do + = link_to '#md-write-holder', class: 'js-md-write-button', tabindex: '-1' do Write %li - = link_to '#md-preview-holder', class: 'js-md-preview-button' do + = link_to '#md-preview-holder', class: 'js-md-preview-button', tabindex: '-1' do Preview - if defined?(referenced_users) && referenced_users diff --git a/app/views/projects/_section.html.haml b/app/views/projects/_section.html.haml index f4f876f380..d7b06197f6 100644 --- a/app/views/projects/_section.html.haml +++ b/app/views/projects/_section.html.haml @@ -18,7 +18,6 @@ %li = link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "Feed", class: 'rss-btn' do %i.fa.fa-rss - Activity Feed = render 'shared/event_filter' %hr diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index e043153795..c5638386b5 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -6,7 +6,7 @@ Project settings %hr .panel-body - = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "edit_project form-horizontal" }, authenticity_token: true do |f| + = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "edit_project form-horizontal fieldset-form" }, authenticity_token: true do |f| %fieldset .form-group.project_name_holder @@ -41,32 +41,40 @@ %legend Features: .form-group - = f.label :issues_enabled, "Issues", class: 'control-label' - .col-sm-10 + .col-sm-offset-2.col-sm-10 .checkbox - = f.check_box :issues_enabled - %span.descr Lightweight issue tracking system for this project + = f.label :issues_enabled do + = f.check_box :issues_enabled + %strong Issues + %br + %span.descr Lightweight issue tracking system for this project .form-group - = f.label :merge_requests_enabled, "Merge Requests", class: 'control-label' - .col-sm-10 + .col-sm-offset-2.col-sm-10 .checkbox - = f.check_box :merge_requests_enabled - %span.descr Submit changes to be merged upstream. + = f.label :merge_requests_enabled do + = f.check_box :merge_requests_enabled + %strong Merge Requests + %br + %span.descr Submit changes to be merged upstream. .form-group - = f.label :wiki_enabled, "Wiki", class: 'control-label' - .col-sm-10 + .col-sm-offset-2.col-sm-10 .checkbox - = f.check_box :wiki_enabled - %span.descr Pages for project documentation + = f.label :wiki_enabled do + = f.check_box :wiki_enabled + %strong Wiki + %br + %span.descr Pages for project documentation .form-group - = f.label :snippets_enabled, "Snippets", class: 'control-label' - .col-sm-10 + .col-sm-offset-2.col-sm-10 .checkbox - = f.check_box :snippets_enabled - %span.descr Share code pastes with others out of git repository + = f.label :snippets_enabled do + = f.check_box :snippets_enabled + %strong Snippets + %br + %span.descr Share code pastes with others out of git repository = render 'merge_request_settings', f: f diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml index 74f8b9950c..5d7e73f2b2 100644 --- a/app/views/projects/merge_requests/_show.html.haml +++ b/app/views/projects/merge_requests/_show.html.haml @@ -32,7 +32,7 @@ %li= link_to "Plain Diff", merge_request_path(@merge_request, format: :diff) = render "projects/merge_requests/show/how_to_merge" - = render "projects/merge_requests/show/state_widget" + = render "projects/merge_requests/widget/show.html.haml" - if @commits.present? %ul.nav.nav-tabs.merge-request-tabs @@ -69,10 +69,5 @@ var merge_request; merge_request = new MergeRequest({ - url_to_automerge_check: "#{automerge_check_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}", - check_enable: #{@merge_request.unchecked? ? "true" : "false"}, - url_to_ci_check: "#{ci_status_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}", - ci_enable: #{@project.ci_service ? "true" : "false"}, - current_status: "#{@merge_request.automerge_status}", action: "#{controller.action_name}" }); diff --git a/app/views/projects/merge_requests/automerge.js.haml b/app/views/projects/merge_requests/automerge.js.haml index a53cbb150a..33321651e3 100644 --- a/app/views/projects/merge_requests/automerge.js.haml +++ b/app/views/projects/merge_requests/automerge.js.haml @@ -1,6 +1,6 @@ --if @status +- if @status :plain - merge_request.mergeInProgress(); --else + merge_request_widget.mergeInProgress(); +- else :plain - merge_request.alreadyOrCannotBeMerged() + $('.mr-widget-body').html("#{escape_javascript(render('projects/merge_requests/widget/open/reload'))}"); diff --git a/app/views/projects/merge_requests/show/_approve.html.haml b/app/views/projects/merge_requests/show/_approve.html.haml deleted file mode 100644 index ed1a3b4b94..0000000000 --- a/app/views/projects/merge_requests/show/_approve.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.clearfix - - unless @merge_request.approved_by?(current_user) - .append-bottom-10 - = form_for [:approve, @project.namespace.becomes(Namespace), @project, @merge_request], method: :post do |f| - = f.submit "Approve Merge Request", class: "btn btn-reopen approve-btn" -%p This merge request must be approved by #{pluralize(@merge_request.approvals_required, 'user')} before it can be merged diff --git a/app/views/projects/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml deleted file mode 100644 index da378fab3e..0000000000 --- a/app/views/projects/merge_requests/show/_mr_accept.html.haml +++ /dev/null @@ -1,102 +0,0 @@ -- unless @allowed_to_merge - - if @project.archived? - %p - %strong Archived projects do not provide commit access. - - else - .automerge_widget.cannot_be_merged.hide - %strong This merge request contains merge conflicts that must be resolved. - Only those with write access to this repository can merge merge requests. - .automerge_widget.work_in_progress.hide - %strong This merge request is marked as Work In Progress. - Only those with write access to this repository can merge merge requests. - .automerge_widget.can_be_merged.hide - %strong This request can be merged automatically. - Only those with write access to this repository can merge merge requests. - - -- if @show_merge_controls - .automerge_widget.can_be_merged.hide - .clearfix - - if @merge_request.requires_approve? && !@merge_request.approved? - = render 'projects/merge_requests/show/approve' - - else - = form_for [:automerge, @project.namespace.becomes(Namespace), @project, @merge_request], remote: true, method: :post do |f| - .accept-merge-holder.clearfix.js-toggle-container - .accept-action - = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request" - - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && !@merge_request.for_fork? - .accept-control.checkbox - = label_tag :should_remove_source_branch, class: "remove_source_checkbox" do - = check_box_tag :should_remove_source_branch - Remove source-branch - - if @merge_request.target_project.merge_requests_rebase_enabled && can_rebase?(@merge_request.target_project, @merge_request.target_branch) - .accept-control.remove_branch_holder - = label_tag :should_rebase, class: "checkbox" do - = check_box_tag :should_rebase, "1", @project.merge_requests_rebase_default - Rebase before merge - .accept-control - = link_to "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message" do - %i.fa.fa-edit - Modify commit message - .js-toggle-content.hide.prepend-top-20 - = render 'shared/commit_message_container', params: params, - text: @merge_request.merge_commit_message, - rows: 14, hint: true - - %br - .light - If you want to merge this request manually, you can use the - %strong - = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal" - - - if @merge_request.approvals.any? - .approved-by-users - Approved by - - @merge_request.approved_by_users.each do |user| - = link_to_member(@project, user, name: false, size: 24) - - .automerge_widget.no_satellite.hide - %p - %span - %strong This repository does not have a satellite. Please ask an administrator to fix this issue! - - .automerge_widget.cannot_be_merged.hide - %h4 - This merge request contains merge conflicts that must be resolved. - You can try it manually on the - %strong - = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal" - - %p - %button.btn.disabled{:type => 'button'} - %i.fa.fa-warning - Accept Merge Request -   - This happens when Git is not able to automatically resolve conflicts between branches. - - .automerge_widget.work_in_progress.hide - %h4 - This merge request cannot be accepted because it is marked as Work In Progress. - - %p - %button.btn.disabled{:type => 'button'} - %i.fa.fa-warning - Accept Merge Request -   - When the merge request is ready, remove the "WIP" prefix from the title to allow it to be accepted. - - .automerge_widget.unchecked - %p - %strong - %i.fa.fa-spinner.fa-spin - Checking automatic merge… - - .automerge_widget.already_cannot_be_merged.hide - %p - %strong This merge request cannot be merged. Try to reload the page. - - .merge-in-progress.hide - %p - %i.fa.fa-spinner.fa-spin -   - Merge is in progress. Please wait… Page will be reloaded automatically.   diff --git a/app/views/projects/merge_requests/show/_mr_ci.html.haml b/app/views/projects/merge_requests/show/_mr_ci.html.haml deleted file mode 100644 index 3b1cd53df3..0000000000 --- a/app/views/projects/merge_requests/show/_mr_ci.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -- if @commits.any? - .ci_widget.ci-success{style: "display:none"} - = icon("check") - %span CI build passed - for #{@merge_request.last_commit_short_sha}. - = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" - - - .ci_widget.ci-failed{style: "display:none"} - = icon("times") - %span CI build failed - for #{@merge_request.last_commit_short_sha}. - = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" - - - [:running, :pending].each do |status| - .ci_widget{class: "ci-#{status}", style: "display:none"} - = icon("clock-o") - %span CI build #{status} - for #{@merge_request.last_commit_short_sha}. - = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" - - .ci_widget - = icon("spinner spin") - Checking for CI status for #{@merge_request.last_commit_short_sha} - - .ci_widget.ci-canceled{style: "display:none"} - = icon("times") - %span CI build canceled - for #{@merge_request.last_commit_short_sha}. - = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" - - .ci_widget.ci-error{style: "display:none"} - = icon("times") - %span Cannot connect to the CI server. Please check your settings and try again. diff --git a/app/views/projects/merge_requests/show/_remove_source_branch.html.haml b/app/views/projects/merge_requests/show/_remove_source_branch.html.haml deleted file mode 100644 index 59cb85edfc..0000000000 --- a/app/views/projects/merge_requests/show/_remove_source_branch.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -- if @source_branch.blank? - Source branch has been removed - -- elsif can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && @merge_request.merged? - .remove_source_branch_widget - %p Changes merged into #{@merge_request.target_branch}. You can remove source branch now - = link_to namespace_project_branch_path(@merge_request.source_project.namespace, @merge_request.source_project, @source_branch), remote: true, method: :delete, class: "btn btn-primary btn-sm remove_source_branch" do - %i.fa.fa-times - Remove Source Branch - - .remove_source_branch_widget.failed.hide - Failed to remove source branch '#{@merge_request.source_branch}' - - .remove_source_branch_in_progress.hide - %i.fa.fa-spinner.fa-spin -   - Removing source branch '#{@merge_request.source_branch}'. Please wait. Page will be automatically reloaded.   diff --git a/app/views/projects/merge_requests/show/_state_widget.html.haml b/app/views/projects/merge_requests/show/_state_widget.html.haml deleted file mode 100644 index 6396232db2..0000000000 --- a/app/views/projects/merge_requests/show/_state_widget.html.haml +++ /dev/null @@ -1,50 +0,0 @@ -.mr-state-widget - - if @merge_request.source_project.ci_service && @commits.any? - .mr-widget-heading - = render "projects/merge_requests/show/mr_ci" - .mr-widget-body - - if @merge_request.open? - - if @merge_request.source_branch_exists? && @merge_request.target_branch_exists? - = render "projects/merge_requests/show/mr_accept" - - else - = render "projects/merge_requests/show/no_accept" - - - if @merge_request.closed? - %h4 - Rejected - - if @merge_request.closed_event - by #{link_to_member(@project, @merge_request.closed_event.author, avatar: true)} - #{time_ago_with_tooltip(@merge_request.closed_event.created_at)} - %p Changes were not merged into target branch - - - if @merge_request.merged? - %h4 - Accepted - - if @merge_request.merge_event - by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)} - #{time_ago_with_tooltip(@merge_request.merge_event.created_at)} - = render "projects/merge_requests/show/remove_source_branch" - - - if @merge_request.locked? - %h4 - Merge in progress... - %p - Merging is in progress. While merging this request is locked and cannot be closed. - - - unless @commits.any? - %h4 Nothing to merge - %p - Nothing to merge from - %span.label-branch #{@merge_request.source_branch} - to - %span.label-branch #{@merge_request.target_branch} - %br - Try to use different branches or push new code. - - - if @closes_issues.present? && @merge_request.open? - .mr-widget-footer - %span - %i.fa.fa-check - Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'} - = succeed '.' do - != gfm(issues_sentence(@closes_issues)) diff --git a/app/views/projects/merge_requests/widget/_closed.html.haml b/app/views/projects/merge_requests/widget/_closed.html.haml new file mode 100644 index 0000000000..18164ba771 --- /dev/null +++ b/app/views/projects/merge_requests/widget/_closed.html.haml @@ -0,0 +1,9 @@ +.mr-state-widget + = render 'projects/merge_requests/widget/heading' + .mr-widget-body + %h4 + Rejected + - if @merge_request.closed_event + by #{link_to_member(@project, @merge_request.closed_event.author, avatar: true)} + #{time_ago_with_tooltip(@merge_request.closed_event.created_at)} + %p Changes were not merged into target branch diff --git a/app/views/projects/merge_requests/widget/_heading.html.haml b/app/views/projects/merge_requests/widget/_heading.html.haml new file mode 100644 index 0000000000..107c61477e --- /dev/null +++ b/app/views/projects/merge_requests/widget/_heading.html.haml @@ -0,0 +1,38 @@ +- if @merge_request.has_ci? + .mr-widget-heading + .ci_widget.ci-success{style: "display:none"} + = icon("check") + %span CI build passed + for #{@merge_request.last_commit_short_sha}. + = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" + + .ci_widget.ci-failed{style: "display:none"} + = icon("times") + %span CI build failed + for #{@merge_request.last_commit_short_sha}. + = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" + + - [:running, :pending].each do |status| + .ci_widget{class: "ci-#{status}", style: "display:none"} + = icon("clock-o") + %span CI build #{status} + for #{@merge_request.last_commit_short_sha}. + = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" + + .ci_widget + = icon("spinner spin") + Checking for CI status for #{@merge_request.last_commit_short_sha} + + .ci_widget.ci-canceled{style: "display:none"} + = icon("times") + %span CI build canceled + for #{@merge_request.last_commit_short_sha}. + = link_to "View build page", ci_build_details_path(@merge_request), :"data-no-turbolink" => "data-no-turbolink" + + .ci_widget.ci-error{style: "display:none"} + = icon("times") + %span Cannot connect to the CI server. Please check your settings and try again. + + :coffeescript + $ -> + merge_request_widget.getCiStatus() diff --git a/app/views/projects/merge_requests/widget/_locked.html.haml b/app/views/projects/merge_requests/widget/_locked.html.haml new file mode 100644 index 0000000000..13ec278847 --- /dev/null +++ b/app/views/projects/merge_requests/widget/_locked.html.haml @@ -0,0 +1,8 @@ +.mr-state-widget + = render 'projects/merge_requests/widget/heading' + .mr-widget-body + %h4 + Merge in progress... + %p + Merging is in progress. While merging this request is locked and cannot be closed. + diff --git a/app/views/projects/merge_requests/widget/_merged.html.haml b/app/views/projects/merge_requests/widget/_merged.html.haml new file mode 100644 index 0000000000..17c3fdacda --- /dev/null +++ b/app/views/projects/merge_requests/widget/_merged.html.haml @@ -0,0 +1,41 @@ +.mr-state-widget + = render 'projects/merge_requests/widget/heading' + .mr-widget-body + %h4 + Accepted + - if @merge_request.merge_event + by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)} + #{time_ago_with_tooltip(@merge_request.merge_event.created_at)} + %div + - if @source_branch.blank? + Source branch has been removed + + - elsif can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && @merge_request.merged? + .remove_source_branch_widget + %p Changes merged into #{@merge_request.target_branch}. You can remove source branch now + = link_to namespace_project_branch_path(@merge_request.source_project.namespace, @merge_request.source_project, @source_branch), remote: true, method: :delete, class: "btn btn-primary btn-sm remove_source_branch" do + %i.fa.fa-times + Remove Source Branch + + .remove_source_branch_widget.failed.hide + Failed to remove source branch '#{@merge_request.source_branch}' + + .remove_source_branch_in_progress.hide + %i.fa.fa-spinner.fa-spin +   + Removing source branch '#{@merge_request.source_branch}'. Please wait. Page will be automatically reloaded.   + + :coffeescript + $('.remove_source_branch').on 'click', -> + $('.remove_source_branch_widget').hide() + $('.remove_source_branch_in_progress').show() + + $(".remove_source_branch").on "ajax:success", (e, data, status, xhr) -> + location.reload() + + $(".remove_source_branch").on "ajax:error", (e, data, status, xhr) -> + $('.remove_source_branch_widget').hide() + $('.remove_source_branch_in_progress').hide() + $('.remove_source_branch_widget.failed').show() + + diff --git a/app/views/projects/merge_requests/widget/_open.html.haml b/app/views/projects/merge_requests/widget/_open.html.haml new file mode 100644 index 0000000000..eb2c830de6 --- /dev/null +++ b/app/views/projects/merge_requests/widget/_open.html.haml @@ -0,0 +1,31 @@ +.mr-state-widget + = render 'projects/merge_requests/widget/heading' + .mr-widget-body + - if @project.archived? + = render 'projects/merge_requests/widget/open/archived' + - elsif !@project.satellite.exists? + = render 'projects/merge_requests/widget/open/no_satellite' + - elsif @merge_request.commits.blank? + = render 'projects/merge_requests/widget/open/nothing' + - elsif @merge_request.branch_missing? + = render 'projects/merge_requests/widget/open/missing_branch' + - elsif @merge_request.unchecked? + = render 'projects/merge_requests/widget/open/check' + - elsif @merge_request.cannot_be_merged? + = render 'projects/merge_requests/widget/open/conflicts' + - elsif @merge_request.work_in_progress? + = render 'projects/merge_requests/widget/open/wip' + - elsif !@merge_request.can_be_merged_by?(current_user) + = render 'projects/merge_requests/widget/open/not_allowed' + - elsif @merge_request.requires_approve? && !@merge_request.approved? + = render 'projects/merge_requests/widget/open/approve' + - elsif @merge_request.can_be_merged? + = render 'projects/merge_requests/widget/open/accept' + + - if @closes_issues.present? + .mr-widget-footer + %span + %i.fa.fa-check + Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'} + = succeed '.' do + != gfm(issues_sentence(@closes_issues)) diff --git a/app/views/projects/merge_requests/widget/_show.html.haml b/app/views/projects/merge_requests/widget/_show.html.haml new file mode 100644 index 0000000000..263cab7a9e --- /dev/null +++ b/app/views/projects/merge_requests/widget/_show.html.haml @@ -0,0 +1,20 @@ +- if @merge_request.open? + = render 'projects/merge_requests/widget/open' +- elsif @merge_request.merged? + = render 'projects/merge_requests/widget/merged' +- elsif @merge_request.closed? + = render 'projects/merge_requests/widget/closed' +- elsif @merge_request.locked? + = render 'projects/merge_requests/widget/locked' + +:javascript + var merge_request_widget; + + merge_request_widget = new MergeRequestWidget({ + url_to_automerge_check: "#{automerge_check_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}", + check_enable: #{@merge_request.unchecked? ? "true" : "false"}, + url_to_ci_check: "#{ci_status_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}", + ci_enable: #{@project.ci_service ? "true" : "false"}, + current_status: "#{@merge_request.automerge_status}", + }); + diff --git a/app/views/projects/merge_requests/widget/open/_accept.html.haml b/app/views/projects/merge_requests/widget/open/_accept.html.haml new file mode 100644 index 0000000000..1604a7f6c0 --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_accept.html.haml @@ -0,0 +1,40 @@ += form_for [:automerge, @project.namespace.becomes(Namespace), @project, @merge_request], remote: true, method: :post, html: { class: 'accept-mr-form' } do |f| + = hidden_field_tag :authenticity_token, form_authenticity_token + .accept-merge-holder.clearfix.js-toggle-container + .accept-action + = f.button class: "btn btn-create accept_merge_request" do + Accept Merge Request + - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && !@merge_request.for_fork? + .accept-control.checkbox + = label_tag :should_remove_source_branch, class: "remove_source_checkbox" do + = check_box_tag :should_remove_source_branch + Remove source-branch + .accept-control + = link_to "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message" do + %i.fa.fa-edit + Modify commit message + .js-toggle-content.hide.prepend-top-20 + = render 'shared/commit_message_container', params: params, + text: @merge_request.merge_commit_message, + rows: 14, hint: true + + %br + .light + If you want to merge this request manually, you can use the + %strong + = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal" + + - if @merge_request.approvals.any? + .approved-by-users + Approved by + - @merge_request.approved_by_users.each do |user| + = link_to_member(@project, user, name: false, size: 24) + + :coffeescript + disableButtonIfEmptyField '#commit_message', '.accept_merge_request' + + $('.accept-mr-form').on 'ajax:before', -> + btn = $('.accept_merge_request') + btn.disable() + btn.html(" Merge in progress") + diff --git a/app/views/projects/merge_requests/widget/open/_approve.html.haml b/app/views/projects/merge_requests/widget/open/_approve.html.haml new file mode 100644 index 0000000000..2b374e6282 --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_approve.html.haml @@ -0,0 +1,13 @@ +%div + - unless @merge_request.approved_by?(current_user) + .append-bottom-10 + = form_for [:approve, @project.namespace.becomes(Namespace), @project, @merge_request], method: :post do |f| + = f.submit "Approve Merge Request", class: "btn btn-reopen approve-btn" + + %p This merge request must be approved by #{pluralize(@merge_request.approvals_required, 'user')} before it can be merged + + - if @merge_request.approvals.any? + .approved-by-users + Approved by + - @merge_request.approved_by_users.each do |user| + = link_to_member(@project, user, name: false, size: 24) diff --git a/app/views/projects/merge_requests/widget/open/_archived.html.haml b/app/views/projects/merge_requests/widget/open/_archived.html.haml new file mode 100644 index 0000000000..eaf113ee56 --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_archived.html.haml @@ -0,0 +1,2 @@ +%p + %strong Archived projects do not provide commit access. diff --git a/app/views/projects/merge_requests/widget/open/_check.html.haml b/app/views/projects/merge_requests/widget/open/_check.html.haml new file mode 100644 index 0000000000..e775447cb7 --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_check.html.haml @@ -0,0 +1,7 @@ +%strong + %i.fa.fa-spinner.fa-spin + Checking automatic merge… + +:coffeescript + $ -> + merge_request_widget.getMergeStatus() diff --git a/app/views/projects/merge_requests/widget/open/_conflicts.html.haml b/app/views/projects/merge_requests/widget/open/_conflicts.html.haml new file mode 100644 index 0000000000..d1db5fec43 --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_conflicts.html.haml @@ -0,0 +1,9 @@ +- if @merge_request.can_be_merged_by?(current_user) + %h4 + This merge request contains merge conflicts that must be resolved. + You can try it manually on the + %strong + = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal" +- else + %strong This merge request contains merge conflicts that must be resolved. + Only those with write access to this repository can merge merge requests. diff --git a/app/views/projects/merge_requests/show/_no_accept.html.haml b/app/views/projects/merge_requests/widget/open/_missing_branch.html.haml similarity index 100% rename from app/views/projects/merge_requests/show/_no_accept.html.haml rename to app/views/projects/merge_requests/widget/open/_missing_branch.html.haml diff --git a/app/views/projects/merge_requests/widget/open/_no_satellite.html.haml b/app/views/projects/merge_requests/widget/open/_no_satellite.html.haml new file mode 100644 index 0000000000..3718cfd833 --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_no_satellite.html.haml @@ -0,0 +1,3 @@ +%p + %span + %strong This repository does not have a satellite. Please ask an administrator to fix this issue! diff --git a/app/views/projects/merge_requests/widget/open/_not_allowed.html.haml b/app/views/projects/merge_requests/widget/open/_not_allowed.html.haml new file mode 100644 index 0000000000..82f6ffd8fc --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_not_allowed.html.haml @@ -0,0 +1,2 @@ +%strong This request can be merged automatically. +Only those with write access to this repository can merge merge requests. diff --git a/app/views/projects/merge_requests/widget/open/_nothing.html.haml b/app/views/projects/merge_requests/widget/open/_nothing.html.haml new file mode 100644 index 0000000000..4d526576bc --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_nothing.html.haml @@ -0,0 +1,8 @@ +%h4 Nothing to merge +%p + Nothing to merge from + %span.label-branch #{@merge_request.source_branch} + to + %span.label-branch #{@merge_request.target_branch} + %br + Try to use different branches or push new code. diff --git a/app/views/projects/merge_requests/widget/open/_reload.html.haml b/app/views/projects/merge_requests/widget/open/_reload.html.haml new file mode 100644 index 0000000000..5787f6efea --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_reload.html.haml @@ -0,0 +1 @@ +This merge request cannot be merged. Try to reload the page. diff --git a/app/views/projects/merge_requests/widget/open/_wip.html.haml b/app/views/projects/merge_requests/widget/open/_wip.html.haml new file mode 100644 index 0000000000..4ce3ab3127 --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_wip.html.haml @@ -0,0 +1,13 @@ +- if @merge_request.can_be_merged_by?(current_user) + %h4 + This merge request cannot be accepted because it is marked as Work In Progress. + + %p + %button.btn.disabled{:type => 'button'} + %i.fa.fa-warning + Accept Merge Request +   + When the merge request is ready, remove the "WIP" prefix from the title to allow it to be accepted. +- else + %strong This merge request is marked as Work In Progress. + Only those with write access to this repository can merge merge requests. diff --git a/config/aws.yml.example b/config/aws.yml.example index 29d029b078..bb10c3cec7 100644 --- a/config/aws.yml.example +++ b/config/aws.yml.example @@ -1,5 +1,8 @@ # See https://github.com/jnicklas/carrierwave#using-amazon-s3 # for more options +# If you change this file in a Merge Request, please also create +# a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests +# production: access_key_id: AKIA1111111111111UA secret_access_key: secret diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index a9ebc4e25b..c233dcc467 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -4,9 +4,13 @@ # ########################### NOTE ##################################### # This file should not receive new settings. All configuration options # -# are being moved to ApplicationSetting model! # +# that do not require application restart are being moved to # +# ApplicationSetting model! # +# If you change this file in a Merge Request, please also create # +# a MR on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests # ######################################################################## # +# # How to use: # 1. Copy file as gitlab.yml # 2. Update gitlab -> host with your fully qualified domain name @@ -157,7 +161,7 @@ production: &base allow_username_or_email_login: false # To maintain tight control over the number of active users on your GitLab installation, - # enable this setting to keep new users blocked until they have been cleared by the admin + # enable this setting to keep new users blocked until they have been cleared by the admin # (default: false). block_auto_created_users: false @@ -290,6 +294,9 @@ production: &base # aws_secret_access_key: 'secret123' # # The remote 'directory' to store your backups. For S3, this would be the bucket name. # remote_directory: 'my.s3.bucket' + # # Use multipart uploads when file size reaches 100MB, see + # # http://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html + # multipart_chunk_size: 104857600 ## GitLab Shell settings gitlab_shell: diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 1317c31488..92b4fa4e34 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -207,6 +207,7 @@ Settings.backup['upload'] ||= Settingslogic.new({ 'remote_directory' => nil, 'co if Settings.backup['upload']['connection'] Settings.backup['upload']['connection'] = Hash[Settings.backup['upload']['connection'].map { |k, v| [k.to_sym, v] }] end +Settings.backup['upload']['multipart_chunk_size'] ||= 104857600 # # Git diff --git a/config/initializers/rack_attack.rb.example b/config/initializers/rack_attack.rb.example index 332865d288..b1bbcca1d6 100644 --- a/config/initializers/rack_attack.rb.example +++ b/config/initializers/rack_attack.rb.example @@ -1,6 +1,7 @@ # 1. Rename this file to rack_attack.rb # 2. Review the paths_to_be_protected and add any other path you need protecting # +# If you change this file in a Merge Request, please also create a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests paths_to_be_protected = [ "#{Rails.application.config.relative_url_root}/users/password", diff --git a/config/initializers/smtp_settings.rb.sample b/config/initializers/smtp_settings.rb.sample index f0fe2fdfa4..25ec247a09 100644 --- a/config/initializers/smtp_settings.rb.sample +++ b/config/initializers/smtp_settings.rb.sample @@ -5,6 +5,7 @@ # # For full list of options and their values see http://api.rubyonrails.org/classes/ActionMailer/Base.html # +# If you change this file in a Merge Request, please also create a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests if Rails.env.production? Gitlab::Application.config.action_mailer.delivery_method = :smtp diff --git a/config/resque.yml.example b/config/resque.yml.example index 347f3599b2..d98f43f71b 100644 --- a/config/resque.yml.example +++ b/config/resque.yml.example @@ -1,3 +1,6 @@ +# If you change this file in a Merge Request, please also create +# a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests +# development: redis://localhost:6379 test: redis://localhost:6379 production: unix:/var/run/redis/redis.sock diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example index 86a5512e76..b937b09278 100644 --- a/config/unicorn.rb.example +++ b/config/unicorn.rb.example @@ -8,6 +8,9 @@ # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete # documentation. +# Note: If you change this file in a Merge Request, please also create a +# Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests +# # WARNING: See config/application.rb under "Relative url support" for the list of # other files that need to be changed for relative url support # diff --git a/db/schema.rb b/db/schema.rb index 085dff57a8..ccc6f7beaf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -40,11 +40,11 @@ ActiveRecord::Schema.define(version: 20150609125332) do t.boolean "twitter_sharing_enabled", default: true t.text "help_text" t.text "restricted_visibility_levels" - t.boolean "version_check_enabled", default: true t.integer "max_attachment_size", default: 10, null: false t.integer "default_project_visibility" t.integer "default_snippet_visibility" t.text "restricted_signup_domains" + t.boolean "version_check_enabled", default: true t.boolean "user_oauth_applications", default: true t.string "after_sign_out_path" end @@ -579,12 +579,12 @@ ActiveRecord::Schema.define(version: 20150609125332) do t.string "bitbucket_access_token" t.string "bitbucket_access_token_secret" t.string "location" + t.string "public_email", default: "", null: false t.string "encrypted_otp_secret" t.string "encrypted_otp_secret_iv" t.string "encrypted_otp_secret_salt" t.boolean "otp_required_for_login" t.text "otp_backup_codes" - t.string "public_email", default: "", null: false end add_index "users", ["admin"], name: "index_users_on_admin", using: :btree diff --git a/doc/api/groups.md b/doc/api/groups.md index 5ec0c00db8..d431f02955 100644 --- a/doc/api/groups.md +++ b/doc/api/groups.md @@ -215,4 +215,4 @@ Parameters: - `id` (required) - The ID of a group - `cn` (required) - The CN of a LDAP group -- `provider` (required) - Name of a LDAP provider \ No newline at end of file +- `provider` (required) - Name of a LDAP provider diff --git a/doc/release/monthly.md b/doc/release/monthly.md index eb97f3cd7f..97418db747 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -39,7 +39,7 @@ Xth: (6 working days before the 22nd) - [ ] Merge CE master in to EE master via merge request (#LINK) - [ ] Determine QA person and notify this person -- [ ] Check the tasks in [how to rc1 guide](howto_rc1.md) and delegate tasks if necessary +- [ ] Check the tasks in [how to rc1 guide](https://dev.gitlab.org/gitlab/gitlabhq/blob/master/doc/release/howto_rc1.md) and delegate tasks if necessary - [ ] Create CE, EE, CI RC1 versions (#LINK) Xth: (5 working days before the 22nd) @@ -71,9 +71,14 @@ Xth: (1 working day before the 22nd) - [ ] Update GitLab.com with the stable version (#LINK) - [ ] Update ci.gitLab.com with the stable version (#LINK) -22nd: +22nd before 12AM CET: + +Release before 12AM CET / 3AM PST, to make sure the majority of our users +get the new version on the 22nd and there is sufficient time in the European +workday to quickly fix any issues. - [ ] Release CE, EE and CI (#LINK) +- [ ] Schedule a second tweet of the release announcement at 6PM CET / 9AM PST ``` diff --git a/doc/workflow/bitbucket_importer/bitbucket_import_grant_access.jpg b/doc/workflow/bitbucket_importer/bitbucket_import_grant_access.jpg deleted file mode 100644 index f3432e923c..0000000000 Binary files a/doc/workflow/bitbucket_importer/bitbucket_import_grant_access.jpg and /dev/null differ diff --git a/doc/workflow/bitbucket_importer/bitbucket_import_new_project.jpg b/doc/workflow/bitbucket_importer/bitbucket_import_new_project.jpg deleted file mode 100644 index d0befa430b..0000000000 Binary files a/doc/workflow/bitbucket_importer/bitbucket_import_new_project.jpg and /dev/null differ diff --git a/doc/workflow/bitbucket_importer/bitbucket_import_select_bitbucket.jpg b/doc/workflow/bitbucket_importer/bitbucket_import_select_bitbucket.jpg deleted file mode 100644 index 53080e8104..0000000000 Binary files a/doc/workflow/bitbucket_importer/bitbucket_import_select_bitbucket.jpg and /dev/null differ diff --git a/doc/workflow/bitbucket_importer/bitbucket_import_select_project.png b/doc/workflow/bitbucket_importer/bitbucket_import_select_project.png deleted file mode 100644 index 8312825eb1..0000000000 Binary files a/doc/workflow/bitbucket_importer/bitbucket_import_select_project.png and /dev/null differ diff --git a/doc/workflow/importing/README.md b/doc/workflow/importing/README.md index 3cab541f95..2b2e903742 100644 --- a/doc/workflow/importing/README.md +++ b/doc/workflow/importing/README.md @@ -1,6 +1,6 @@ -# Migrating projects to a GitLab instance - -1. [Bitbucket](doc/workflow/import_projects_from_bitbucket.md) -2. [GitHub](doc/workflow/import_projects_from_github.md) -3. [GitLab.com](doc/workflow/import_projects_from_gitlab_com.md) -4. [SVN](doc/workflow/migrating_from_svn.md) +# Migrating projects to a GitLab instance + +1. [Bitbucket](import_projects_from_bitbucket.md) +2. [GitHub](import_projects_from_github.md) +3. [GitLab.com](import_projects_from_gitlab_com.md) +4. [SVN](migrating_from_svn.md) diff --git a/doc/workflow/importing/bitbucket_importer/bitbucket_import_grant_access.png b/doc/workflow/importing/bitbucket_importer/bitbucket_import_grant_access.png new file mode 100644 index 0000000000..df55a08180 Binary files /dev/null and b/doc/workflow/importing/bitbucket_importer/bitbucket_import_grant_access.png differ diff --git a/doc/workflow/importing/bitbucket_importer/bitbucket_import_new_project.png b/doc/workflow/importing/bitbucket_importer/bitbucket_import_new_project.png new file mode 100644 index 0000000000..5253889d25 Binary files /dev/null and b/doc/workflow/importing/bitbucket_importer/bitbucket_import_new_project.png differ diff --git a/doc/workflow/importing/bitbucket_importer/bitbucket_import_select_bitbucket.png b/doc/workflow/importing/bitbucket_importer/bitbucket_import_select_bitbucket.png new file mode 100644 index 0000000000..ffa87ce5b2 Binary files /dev/null and b/doc/workflow/importing/bitbucket_importer/bitbucket_import_select_bitbucket.png differ diff --git a/doc/workflow/importing/bitbucket_importer/bitbucket_import_select_project.png b/doc/workflow/importing/bitbucket_importer/bitbucket_import_select_project.png new file mode 100644 index 0000000000..0e08703f42 Binary files /dev/null and b/doc/workflow/importing/bitbucket_importer/bitbucket_import_select_project.png differ diff --git a/doc/workflow/github_importer/importer.png b/doc/workflow/importing/github_importer/importer.png similarity index 100% rename from doc/workflow/github_importer/importer.png rename to doc/workflow/importing/github_importer/importer.png diff --git a/doc/workflow/github_importer/new_project_page.png b/doc/workflow/importing/github_importer/new_project_page.png similarity index 100% rename from doc/workflow/github_importer/new_project_page.png rename to doc/workflow/importing/github_importer/new_project_page.png diff --git a/doc/workflow/gitlab_importer/importer.png b/doc/workflow/importing/gitlab_importer/importer.png similarity index 100% rename from doc/workflow/gitlab_importer/importer.png rename to doc/workflow/importing/gitlab_importer/importer.png diff --git a/doc/workflow/gitlab_importer/new_project_page.png b/doc/workflow/importing/gitlab_importer/new_project_page.png similarity index 100% rename from doc/workflow/gitlab_importer/new_project_page.png rename to doc/workflow/importing/gitlab_importer/new_project_page.png diff --git a/doc/workflow/import_projects_from_bitbucket.md b/doc/workflow/importing/import_projects_from_bitbucket.md similarity index 88% rename from doc/workflow/import_projects_from_bitbucket.md rename to doc/workflow/importing/import_projects_from_bitbucket.md index 20d65f1925..1e9825e2e1 100644 --- a/doc/workflow/import_projects_from_bitbucket.md +++ b/doc/workflow/importing/import_projects_from_bitbucket.md @@ -6,15 +6,15 @@ It takes just a few steps to import your existing Bitbucket projects to GitLab. * Click on "New project" -![New project in GitLab](bitbucket_importer/bitbucket_import_new_project.jpg) +![New project in GitLab](bitbucket_importer/bitbucket_import_new_project.png) * Click on the "Bitbucket" button -![Bitbucket](bitbucket_importer/bitbucket_import_select_bitbucket.jpg) +![Bitbucket](bitbucket_importer/bitbucket_import_select_bitbucket.png) * Grant GitLab access to your Bitbucket account -![Grant access](bitbucket_importer/bitbucket_import_grant_access.jpg) +![Grant access](bitbucket_importer/bitbucket_import_grant_access.png) * Click on the projects that you'd like to import or "Import all projects" @@ -23,4 +23,4 @@ It takes just a few steps to import your existing Bitbucket projects to GitLab. A new GitLab project will be created with your imported data. ### Note -Milestones and wiki pages are not imported from Bitbucket. \ No newline at end of file +Milestones and wiki pages are not imported from Bitbucket. diff --git a/doc/workflow/import_projects_from_github.md b/doc/workflow/importing/import_projects_from_github.md similarity index 100% rename from doc/workflow/import_projects_from_github.md rename to doc/workflow/importing/import_projects_from_github.md diff --git a/doc/workflow/import_projects_from_gitlab_com.md b/doc/workflow/importing/import_projects_from_gitlab_com.md similarity index 100% rename from doc/workflow/import_projects_from_gitlab_com.md rename to doc/workflow/importing/import_projects_from_gitlab_com.md diff --git a/doc/workflow/migrating_from_svn.md b/doc/workflow/importing/migrating_from_svn.md similarity index 100% rename from doc/workflow/migrating_from_svn.md rename to doc/workflow/importing/migrating_from_svn.md diff --git a/doc/workflow/two_factor_authentication.md b/doc/workflow/two_factor_authentication.md index 7c45d23c99..fb215c8b26 100644 --- a/doc/workflow/two_factor_authentication.md +++ b/doc/workflow/two_factor_authentication.md @@ -45,7 +45,7 @@ storage in a safe place. **Each code can be used only once** to log in to your account. If you lose the recovery codes or just want to generate new ones, you can do so -from the **Profile Settings** > **Acount** page where you first enabled 2FA. +from the **Profile Settings** > **Account** page where you first enabled 2FA. ## Logging in with 2FA Enabled @@ -60,8 +60,8 @@ your phone's application or a recovery code to log in. 1. Log in to your GitLab account. 1. Go to your **Profile Settings**. -1. Go to **Acount**. +1. Go to **Account**. 1. Click **Disable Two-factor Authentication**. [Google Authenticator]: https://support.google.com/accounts/answer/1066447?hl=en -[FreeOTP]: https://fedorahosted.org/freeotp/ \ No newline at end of file +[FreeOTP]: https://fedorahosted.org/freeotp/ diff --git a/docker/README.md b/docker/README.md index 46b2134836..fb3bde5016 100644 --- a/docker/README.md +++ b/docker/README.md @@ -80,7 +80,7 @@ sudo docker pull sytse/gitlab-app:7.10.1 ```bash sudo docker run --name gitlab-data sytse/gitlab-data /bin/true -sudo docker run --detach --name gitlab_app --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data sytse/gitlab-app:7.10.1 +sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab-data sytse/gitlab-app:7.10.1 ``` After this you can login to the web interface as explained above in 'After starting a container'. @@ -94,7 +94,12 @@ sudo docker build --tag gitlab-data docker/data/ sudo docker build --tag gitlab-app:7.10.1 docker/app/ ``` -After this run the images as described in the previous section. +After this run the images: + +```bash +sudo docker run --name gitlab-data gitlab-data /bin/true +sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab-data gitlab-app:7.10.1 +``` We assume using a data volume container, this will simplify migrations and backups. This empty container will exist to persist as volumes the 3 directories used by GitLab, so remember not to delete it. @@ -130,7 +135,7 @@ It Assumes that you're upgrading from 7.8.1 to 7.10.1 and you're in the updated sudo docker stop gitlab-app sudo docker rm gitlab-app sudo docker build --tag gitlab-app:7.10.1 docker/app/ -sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data gitlab-app:7.10.1 +sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab-data gitlab-app:7.10.1 ``` On the first run GitLab will reconfigure and update itself. If everything runs OK don't forget to cleanup the app image: @@ -143,13 +148,13 @@ sudo docker rmi gitlab-app:7.8.1 - Ensure the containers are running - Login to Dockerhub with `sudo docker login` -- Run the following (replace '7.9.2' with the version you're using and 'Sytse Sijbrandij' with your name): +- Run the following (replace '7.10.1' with the version you're using and 'Sytse Sijbrandij' with your name): ```bash sudo docker commit -m "Initial commit" -a "Sytse Sijbrandij" gitlab-app sytse/gitlab-app:7.10.1 sudo docker push sytse/gitlab-app:7.10.1 -sudo docker commit -m "Initial commit" -a "Sytse Sijbrandij" gitlab_data sytse/gitlab_data -sudo docker push sytse/gitlab_data +sudo docker commit -m "Initial commit" -a "Sytse Sijbrandij" gitlab-data sytse/gitlab-data +sudo docker push sytse/gitlab-data ``` ## Troubleshooting diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature index 05faad4e64..8661ea98c2 100644 --- a/features/project/active_tab.feature +++ b/features/project/active_tab.feature @@ -35,6 +35,11 @@ Feature: Project Active Tab Then the active main tab should be Merge Requests And no other main tabs should be active + Scenario: On Project Members + Given I visit my project's members page + Then the active main tab should be Members + And no other main tabs should be active + Scenario: On Project Wiki Given I visit my project's wiki page Then the active main tab should be Wiki @@ -49,13 +54,6 @@ Feature: Project Active Tab # Sub Tabs: Settings - Scenario: On Project Settings/Team - Given I visit my project's settings page - And I click the "Team" tab - Then the active sub nav should be Team - And no other sub navs should be active - And the active main tab should be Settings - Scenario: On Project Settings/Edit Given I visit my project's settings page And I click the "Edit" tab diff --git a/features/project/project.feature b/features/project/project.feature index 3c185c81e0..1e334bc8ce 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -67,9 +67,10 @@ Feature: Project Scenario: I should see audit events And gitlab user "Pete" And "Pete" is "Shop" developer - When I visit project "Shop" settings page + When I visit project "Shop" page And I go to "Members" And I change "Pete" access level to master + And I visit project "Shop" settings page And I go to "Audit Events" Then I should see the audit event listed diff --git a/features/steps/admin/applications.rb b/features/steps/admin/applications.rb index d59088fa3c..7c12cb9692 100644 --- a/features/steps/admin/applications.rb +++ b/features/steps/admin/applications.rb @@ -8,7 +8,7 @@ class Spinach::Features::AdminApplications < Spinach::FeatureSteps end step 'I should see application form' do - page.should have_content "New application" + expect(page).to have_content "New application" end step 'I fill application form out and submit' do @@ -18,9 +18,9 @@ class Spinach::Features::AdminApplications < Spinach::FeatureSteps end step 'I see application' do - page.should have_content "Application: test" - page.should have_content "Application Id" - page.should have_content "Secret" + expect(page).to have_content "Application: test" + expect(page).to have_content "Application Id" + expect(page).to have_content "Secret" end step 'I click edit' do @@ -28,28 +28,28 @@ class Spinach::Features::AdminApplications < Spinach::FeatureSteps end step 'I see edit application form' do - page.should have_content "Edit application" + expect(page).to have_content "Edit application" end step 'I change name of application and submit' do - page.should have_content "Edit application" + expect(page).to have_content "Edit application" fill_in :doorkeeper_application_name, with: 'test_changed' click_on "Submit" end step 'I see that application was changed' do - page.should have_content "test_changed" - page.should have_content "Application Id" - page.should have_content "Secret" + expect(page).to have_content "test_changed" + expect(page).to have_content "Application Id" + expect(page).to have_content "Secret" end step 'I click to remove application' do - within '.oauth-applications' do + page.within '.oauth-applications' do click_on "Destroy" end end step "I see that application is removed" do - page.find(".oauth-applications").should_not have_content "test_changed" + expect(page.find(".oauth-applications")).not_to have_content "test_changed" end end diff --git a/features/steps/admin/broadcast_messages.rb b/features/steps/admin/broadcast_messages.rb index a35fa34a3a..2ecb6f0191 100644 --- a/features/steps/admin/broadcast_messages.rb +++ b/features/steps/admin/broadcast_messages.rb @@ -8,7 +8,7 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps end step 'I should be all broadcast messages' do - page.should have_content "Migration to new server" + expect(page).to have_content "Migration to new server" end step 'submit form with new broadcast message' do @@ -18,11 +18,11 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps end step 'I should be redirected to admin messages page' do - current_path.should == admin_broadcast_messages_path + expect(current_path).to eq admin_broadcast_messages_path end step 'I should see newly created broadcast message' do - page.should have_content 'Application update from 4:00 CST to 5:00 CST' + expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' end step 'submit form with new customized broadcast message' do @@ -35,7 +35,7 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps end step 'I should see a customized broadcast message' do - page.should have_content 'Application update from 4:00 CST to 5:00 CST' - page.should have_selector %(div[style="background-color:#f2dede;color:#b94a48"]) + expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' + expect(page).to have_selector %(div[style="background-color:#f2dede;color:#b94a48"]) end end diff --git a/features/steps/admin/deploy_keys.rb b/features/steps/admin/deploy_keys.rb index 844837d177..56787eeb6b 100644 --- a/features/steps/admin/deploy_keys.rb +++ b/features/steps/admin/deploy_keys.rb @@ -10,7 +10,7 @@ class Spinach::Features::AdminDeployKeys < Spinach::FeatureSteps step 'I should see all public deploy keys' do DeployKey.are_public.each do |p| - page.should have_content p.title + expect(page).to have_content p.title end end @@ -33,11 +33,11 @@ class Spinach::Features::AdminDeployKeys < Spinach::FeatureSteps end step 'I should be on admin deploy keys page' do - current_path.should == admin_deploy_keys_path + expect(current_path).to eq admin_deploy_keys_path end step 'I should see newly created deploy key' do - page.should have_content(deploy_key.title) + expect(page).to have_content(deploy_key.title) end def deploy_key diff --git a/features/steps/admin/groups.rb b/features/steps/admin/groups.rb index c4b05f5620..f420c83d69 100644 --- a/features/steps/admin/groups.rb +++ b/features/steps/admin/groups.rb @@ -28,32 +28,32 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps end step 'I should see newly created group' do - page.should have_content "Group: gitlab" - page.should have_content "Group description" + expect(page).to have_content "Group: gitlab" + expect(page).to have_content "Group description" end step 'I should be redirected to group page' do - current_path.should == admin_group_path(Group.find_by(path: 'gitlab')) + expect(current_path).to eq admin_group_path(Group.find_by(path: 'gitlab')) end When 'I select user "John Doe" from user list as "Reporter"' do select2(user_john.id, from: "#user_ids", multiple: true) - within "#new_project_member" do + page.within "#new_project_member" do select "Reporter", from: "access_level" end click_button "Add users to group" end step 'I should see "John Doe" in team list in every project as "Reporter"' do - within ".group-users-list" do - page.should have_content "John Doe" - page.should have_content "Reporter" + page.within ".group-users-list" do + expect(page).to have_content "John Doe" + expect(page).to have_content "Reporter" end end step 'I should be all groups' do Group.all.each do |group| - page.should have_content group.name + expect(page).to have_content group.name end end @@ -77,14 +77,14 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps end step 'I remove user "John Doe" from group' do - within "#user_#{user_john.id}" do + page.within "#user_#{user_john.id}" do click_link 'Remove user from group' end end step 'I should not see "John Doe" in team list' do - within ".group-users-list" do - page.should_not have_content "John Doe" + page.within ".group-users-list" do + expect(page).not_to have_content "John Doe" end end diff --git a/features/steps/admin/logs.rb b/features/steps/admin/logs.rb index 904e546865..f9e49588c7 100644 --- a/features/steps/admin/logs.rb +++ b/features/steps/admin/logs.rb @@ -4,8 +4,8 @@ class Spinach::Features::AdminLogs < Spinach::FeatureSteps include SharedAdmin step 'I should see tabs with available logs' do - page.should have_content 'production.log' - page.should have_content 'githost.log' - page.should have_content 'application.log' + expect(page).to have_content 'production.log' + expect(page).to have_content 'githost.log' + expect(page).to have_content 'application.log' end end diff --git a/features/steps/admin/projects.rb b/features/steps/admin/projects.rb index 9be4d39d2d..655f189527 100644 --- a/features/steps/admin/projects.rb +++ b/features/steps/admin/projects.rb @@ -5,7 +5,7 @@ class Spinach::Features::AdminProjects < Spinach::FeatureSteps step 'I should see all projects' do Project.all.each do |p| - page.should have_content p.name_with_namespace + expect(page).to have_content p.name_with_namespace end end @@ -15,9 +15,9 @@ class Spinach::Features::AdminProjects < Spinach::FeatureSteps step 'I should see project details' do project = Project.first - current_path.should == admin_namespace_project_path(project.namespace, project) - page.should have_content(project.name_with_namespace) - page.should have_content(project.creator.name) + expect(current_path).to eq admin_namespace_project_path(project.namespace, project) + expect(page).to have_content(project.name_with_namespace) + expect(page).to have_content(project.creator.name) end step 'I visit admin project page' do @@ -34,8 +34,8 @@ class Spinach::Features::AdminProjects < Spinach::FeatureSteps end step 'I should see project transfered' do - page.should have_content 'Web / ' + project.name - page.should have_content 'Namespace: Web' + expect(page).to have_content 'Web / ' + project.name + expect(page).to have_content 'Namespace: Web' end def project diff --git a/features/steps/admin/settings.rb b/features/steps/admin/settings.rb index 39a4849836..277f8eaafd 100644 --- a/features/steps/admin/settings.rb +++ b/features/steps/admin/settings.rb @@ -11,9 +11,9 @@ class Spinach::Features::AdminSettings < Spinach::FeatureSteps end step 'I should see application settings saved' do - current_application_settings.gravatar_enabled.should be_false - current_application_settings.home_page_url.should == 'https://about.gitlab.com/' - page.should have_content 'Application settings saved successfully' + expect(current_application_settings.gravatar_enabled).to be_false + expect(current_application_settings.home_page_url).to eq 'https://about.gitlab.com/' + expect(page).to have_content 'Application settings saved successfully' end step 'I set the help text' do @@ -54,19 +54,19 @@ class Spinach::Features::AdminSettings < Spinach::FeatureSteps end step 'I should see service template settings saved' do - page.should have_content 'Application settings saved successfully' + expect(page).to have_content 'Application settings saved successfully' end step 'I should see all checkboxes checked' do - all('input[type=checkbox]').each do |checkbox| - checkbox.should be_checked + page.all('input[type=checkbox]').each do |checkbox| + expect(checkbox).to be_checked end end step 'I should see Slack settings saved' do - find_field('Webhook').value.should eq 'http://localhost' - find_field('Username').value.should eq 'test_user' - find_field('Channel').value.should eq '#test_channel' + expect(find_field('Webhook').value).to eq 'http://localhost' + expect(find_field('Username').value).to eq 'test_user' + expect(find_field('Channel').value).to eq '#test_channel' end def help_text diff --git a/features/steps/admin/users.rb b/features/steps/admin/users.rb index e138309724..34a3ed9f61 100644 --- a/features/steps/admin/users.rb +++ b/features/steps/admin/users.rb @@ -5,7 +5,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps step 'I should see all users' do User.all.each do |user| - page.should have_content user.name + expect(page).to have_content user.name end end @@ -23,13 +23,13 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps end step 'See username error message' do - within "#error_explanation" do - page.should have_content "Username" + page.within "#error_explanation" do + expect(page).to have_content "Username" end end step 'Not changed form action url' do - page.should have_selector %(form[action="/admin/users/#{@user.username}"]) + expect(page).to have_selector %(form[action="/admin/users/#{@user.username}"]) end step 'I submit modified user' do @@ -38,7 +38,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps end step 'I see user attributes changed' do - page.should have_content 'Can create groups: Yes' + expect(page).to have_content 'Can create groups: Yes' end step 'click edit on my user' do @@ -53,7 +53,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps end step 'I see the secondary email' do - page.should have_content "Secondary email: #{@user_with_secondary_email.emails.last.email}" + expect(page).to have_content "Secondary email: #{@user_with_secondary_email.emails.last.email}" end step 'I click remove secondary email' do @@ -61,7 +61,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps end step 'I should not see secondary email anymore' do - page.should_not have_content "Secondary email:" + expect(page).not_to have_content "Secondary email:" end step 'user "Mike" with groups and projects' do @@ -79,8 +79,8 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps end step 'I should see user "Mike" details' do - page.should have_content 'Account' - page.should have_content 'Personal projects limit' + expect(page).to have_content 'Account' + expect(page).to have_content 'Personal projects limit' end step 'user "Pete" with ssh keys' do @@ -94,8 +94,8 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps end step 'I should see key list' do - page.should have_content 'ssh-rsa Key2' - page.should have_content 'ssh-rsa Key1' + expect(page).to have_content 'ssh-rsa Key2' + expect(page).to have_content 'ssh-rsa Key1' end step 'I click on the key title' do @@ -103,8 +103,8 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps end step 'I should see key details' do - page.should have_content 'ssh-rsa Key2' - page.should have_content 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQSTWXhJAX/He+nG78MiRRRn7m0Pb0XbcgTxE0etArgoFoh9WtvDf36HG6tOSg/0UUNcp0dICsNAmhBKdncp6cIyPaXJTURPRAGvhI0/VDk4bi27bRnccGbJ/hDaUxZMLhhrzY0r22mjVf8PF6dvv5QUIQVm1/LeaWYsHHvLgiIjwrXirUZPnFrZw6VLREoBKG8uWvfSXw1L5eapmstqfsME8099oi+vWLR8MgEysZQmD28M73fgW4zek6LDQzKQyJx9nB+hJkKUDvcuziZjGmRFlNgSA2mguERwL1OXonD8WYUrBDGKroIvBT39zS5d9tQDnidEJZ9Y8gv5ViYP7x Key2' + expect(page).to have_content 'ssh-rsa Key2' + expect(page).to have_content 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQSTWXhJAX/He+nG78MiRRRn7m0Pb0XbcgTxE0etArgoFoh9WtvDf36HG6tOSg/0UUNcp0dICsNAmhBKdncp6cIyPaXJTURPRAGvhI0/VDk4bi27bRnccGbJ/hDaUxZMLhhrzY0r22mjVf8PF6dvv5QUIQVm1/LeaWYsHHvLgiIjwrXirUZPnFrZw6VLREoBKG8uWvfSXw1L5eapmstqfsME8099oi+vWLR8MgEysZQmD28M73fgW4zek6LDQzKQyJx9nB+hJkKUDvcuziZjGmRFlNgSA2mguERwL1OXonD8WYUrBDGKroIvBT39zS5d9tQDnidEJZ9Y8gv5ViYP7x Key2' end step 'I click on remove key' do @@ -112,6 +112,6 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps end step 'I should see the key removed' do - page.should_not have_content 'ssh-rsa Key2' + expect(page).not_to have_content 'ssh-rsa Key2' end end diff --git a/features/steps/dashboard/archived_projects.rb b/features/steps/dashboard/archived_projects.rb index 969baf9228..36e092f50c 100644 --- a/features/steps/dashboard/archived_projects.rb +++ b/features/steps/dashboard/archived_projects.rb @@ -9,14 +9,14 @@ class Spinach::Features::DashboardArchivedProjects < Spinach::FeatureSteps end step 'I should see "Shop" project link' do - page.should have_link "Shop" + expect(page).to have_link "Shop" end step 'I should not see "Forum" project link' do - page.should_not have_link "Forum" + expect(page).not_to have_link "Forum" end step 'I should see "Forum" project link' do - page.should have_link "Forum" + expect(page).to have_link "Forum" end end diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index bb1f2f444f..945bf35ff2 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -4,16 +4,16 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps include SharedProject step 'I should see "New Project" link' do - page.should have_link "New project" + expect(page).to have_link "New project" end step 'I should see "Shop" project link' do - page.should have_link "Shop" + expect(page).to have_link "Shop" end step 'I should see last push widget' do - page.should have_content "You pushed to fix" - page.should have_link "Create Merge Request" + expect(page).to have_content "You pushed to fix" + expect(page).to have_link "Create Merge Request" end step 'I click "Create Merge Request" link' do @@ -21,10 +21,10 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps end step 'I see prefilled new Merge Request page' do - current_path.should == new_namespace_project_merge_request_path(@project.namespace, @project) - find("#merge_request_target_project_id").value.should == @project.id.to_s - find("input#merge_request_source_branch").value.should == "fix" - find("input#merge_request_target_branch").value.should == "master" + expect(current_path).to eq new_namespace_project_merge_request_path(@project.namespace, @project) + expect(find("#merge_request_target_project_id").value).to eq @project.id.to_s + expect(find("input#merge_request_source_branch").value).to eq "fix" + expect(find("input#merge_request_target_branch").value).to eq "master" end step 'user with name "John Doe" joined project "Shop"' do @@ -38,7 +38,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps end step 'I should see "John Doe joined project Shop" event' do - page.should have_content "John Doe joined project #{project.name_with_namespace}" + expect(page).to have_content "John Doe joined project #{project.name_with_namespace}" end step 'user with name "John Doe" left project "Shop"' do @@ -51,7 +51,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps end step 'I should see "John Doe left project Shop" event' do - page.should have_content "John Doe left project #{project.name_with_namespace}" + expect(page).to have_content "John Doe left project #{project.name_with_namespace}" end step 'I have group with projects' do @@ -64,13 +64,13 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps step 'I should see projects list' do @user.authorized_projects.all.each do |project| - page.should have_link project.name_with_namespace + expect(page).to have_link project.name_with_namespace end end step 'I should see groups list' do Group.all.each do |group| - page.should have_link group.name + expect(page).to have_link group.name end end @@ -80,6 +80,6 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps end step 'I should see 1 project at group list' do - find('span.last_activity/span').should have_content('1') + expect(find('span.last_activity/span')).to have_content('1') end end diff --git a/features/steps/dashboard/event_filters.rb b/features/steps/dashboard/event_filters.rb index 3da3d62d0c..834afa439a 100644 --- a/features/steps/dashboard/event_filters.rb +++ b/features/steps/dashboard/event_filters.rb @@ -4,27 +4,27 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps include SharedProject step 'I should see push event' do - page.should have_selector('span.pushed') + expect(page).to have_selector('span.pushed') end step 'I should not see push event' do - page.should_not have_selector('span.pushed') + expect(page).not_to have_selector('span.pushed') end step 'I should see new member event' do - page.should have_selector('span.joined') + expect(page).to have_selector('span.joined') end step 'I should not see new member event' do - page.should_not have_selector('span.joined') + expect(page).not_to have_selector('span.joined') end step 'I should see merge request event' do - page.should have_selector('span.accepted') + expect(page).to have_selector('span.accepted') end step 'I should not see merge request event' do - page.should_not have_selector('span.accepted') + expect(page).not_to have_selector('span.accepted') end step 'this project has push event' do diff --git a/features/steps/dashboard/group.rb b/features/steps/dashboard/group.rb index aeea49320f..0c6a0ae372 100644 --- a/features/steps/dashboard/group.rb +++ b/features/steps/dashboard/group.rb @@ -17,29 +17,29 @@ class Spinach::Features::DashboardGroup < Spinach::FeatureSteps end step 'I should not see the "Leave" button for group "Owned"' do - find(:css, 'li', text: "Owner").should_not have_selector(:css, 'i.fa.fa-sign-out') + expect(find(:css, 'li', text: "Owner")).not_to have_selector(:css, 'i.fa.fa-sign-out') # poltergeist always confirms popups. end step 'I should not see the "Leave" button for groupr "Guest"' do - find(:css, 'li', text: "Guest").should_not have_selector(:css, 'i.fa.fa-sign-out') + expect(find(:css, 'li', text: "Guest")).not_to have_selector(:css, 'i.fa.fa-sign-out') # poltergeist always confirms popups. end step 'I should see group "Owned" in group list' do - page.should have_content("Owned") + expect(page).to have_content("Owned") end step 'I should not see group "Owned" in group list' do - page.should_not have_content("Owned") + expect(page).not_to have_content("Owned") end step 'I should see group "Guest" in group list' do - page.should have_content("Guest") + expect(page).to have_content("Guest") end step 'I should not see group "Guest" in group list' do - page.should_not have_content("Guest") + expect(page).not_to have_content("Guest") end step 'I click new group link' do @@ -53,15 +53,15 @@ class Spinach::Features::DashboardGroup < Spinach::FeatureSteps end step 'I should be redirected to group "Samurai" page' do - current_path.should == group_path(Group.find_by(name: 'Samurai')) + expect(current_path).to eq group_path(Group.find_by(name: 'Samurai')) end step 'I should see newly created group "Samurai"' do - page.should have_content "Samurai" - page.should have_content "Tokugawa Shogunate" + expect(page).to have_content "Samurai" + expect(page).to have_content "Tokugawa Shogunate" end step 'I should see the "Can not leave message"' do - page.should have_content "You can not leave Owned group because you're the last owner" + expect(page).to have_content "You can not leave Owned group because you're the last owner" end end diff --git a/features/steps/dashboard/help.rb b/features/steps/dashboard/help.rb index ef433c57c6..86ab31a58a 100644 --- a/features/steps/dashboard/help.rb +++ b/features/steps/dashboard/help.rb @@ -12,7 +12,7 @@ class Spinach::Features::DashboardHelp < Spinach::FeatureSteps end step 'I should see "Rake Tasks" page markdown rendered' do - page.should have_content "Gather information about GitLab and the system it runs on" + expect(page).to have_content "Gather information about GitLab and the system it runs on" end step 'Header "Rebuild project satellites" should have correct ids and links' do diff --git a/features/steps/dashboard/issues.rb b/features/steps/dashboard/issues.rb index 60da36e86d..cbe54e2dc7 100644 --- a/features/steps/dashboard/issues.rb +++ b/features/steps/dashboard/issues.rb @@ -46,11 +46,11 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps end def should_see(issue) - page.should have_content(issue.title[0..10]) + expect(page).to have_content(issue.title[0..10]) end def should_not_see(issue) - page.should_not have_content(issue.title[0..10]) + expect(page).not_to have_content(issue.title[0..10]) end def assigned_issue diff --git a/features/steps/dashboard/merge_requests.rb b/features/steps/dashboard/merge_requests.rb index 9d92082bb8..cec8d06ade 100644 --- a/features/steps/dashboard/merge_requests.rb +++ b/features/steps/dashboard/merge_requests.rb @@ -50,11 +50,11 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps end def should_see(merge_request) - page.should have_content(merge_request.title[0..10]) + expect(page).to have_content(merge_request.title[0..10]) end def should_not_see(merge_request) - page.should_not have_content(merge_request.title[0..10]) + expect(page).not_to have_content(merge_request.title[0..10]) end def assigned_merge_request diff --git a/features/steps/dashboard/new_project.rb b/features/steps/dashboard/new_project.rb index 93456a81ec..b4ade65ee5 100644 --- a/features/steps/dashboard/new_project.rb +++ b/features/steps/dashboard/new_project.rb @@ -4,13 +4,13 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps include SharedProject step 'I click "New project" link' do - within('.content') do + page.within('.content') do click_link "New project" end end step 'I see "New project" page' do - page.should have_content("Project path") + expect(page).to have_content("Project path") end step 'I click on "Import project from GitHub"' do @@ -19,11 +19,11 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps step 'I see instructions on how to import from GitHub' do github_modal = first('.modal-body') - github_modal.should be_visible - github_modal.should have_content "To enable importing projects from GitHub" + expect(github_modal).to be_visible + expect(github_modal).to have_content "To enable importing projects from GitHub" - all('.modal-body').each do |element| - element.should_not be_visible unless element == github_modal + page.all('.modal-body').each do |element| + expect(element).not_to be_visible unless element == github_modal end end end diff --git a/features/steps/dashboard/starred_projects.rb b/features/steps/dashboard/starred_projects.rb index b9ad2f13e2..59c73fe63f 100644 --- a/features/steps/dashboard/starred_projects.rb +++ b/features/steps/dashboard/starred_projects.rb @@ -8,8 +8,8 @@ class Spinach::Features::DashboardStarredProjects < Spinach::FeatureSteps end step 'I should not see project "Shop"' do - within 'aside' do - page.should_not have_content('Shop') + page.within 'aside' do + expect(page).not_to have_content('Shop') end end end diff --git a/features/steps/explore/groups.rb b/features/steps/explore/groups.rb index 0c2127d4c4..89b82293ef 100644 --- a/features/steps/explore/groups.rb +++ b/features/steps/explore/groups.rb @@ -39,19 +39,19 @@ class Spinach::Features::ExploreGroups < Spinach::FeatureSteps end step 'I should not see project "Enterprise" items' do - page.should_not have_content "Enterprise" + expect(page).not_to have_content "Enterprise" end step 'I should see project "Internal" items' do - page.should have_content "Internal" + expect(page).to have_content "Internal" end step 'I should not see project "Internal" items' do - page.should_not have_content "Internal" + expect(page).not_to have_content "Internal" end step 'I should see project "Community" items' do - page.should have_content "Community" + expect(page).to have_content "Community" end step 'I change filter to Everyone\'s' do @@ -59,11 +59,11 @@ class Spinach::Features::ExploreGroups < Spinach::FeatureSteps end step 'I should see group member "John Doe"' do - page.should have_content "John Doe" + expect(page).to have_content "John Doe" end step 'I should not see member roles' do - body.should_not match(%r{owner|developer|reporter|guest}i) + expect(body).not_to match(%r{owner|developer|reporter|guest}i) end protected diff --git a/features/steps/explore/projects.rb b/features/steps/explore/projects.rb index 26b71406bd..49c2f6a125 100644 --- a/features/steps/explore/projects.rb +++ b/features/steps/explore/projects.rb @@ -4,56 +4,56 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps include SharedProject step 'I should see project "Empty Public Project"' do - page.should have_content "Empty Public Project" + expect(page).to have_content "Empty Public Project" end step 'I should see public project details' do - page.should have_content '32 branches' - page.should have_content '16 tags' + expect(page).to have_content '32 branches' + expect(page).to have_content '16 tags' end step 'I should see project readme' do - page.should have_content 'README.md' + expect(page).to have_content 'README.md' end step 'I should see empty public project details' do - page.should have_content 'Git global setup' + expect(page).to have_content 'Git global setup' end step 'I should see empty public project details with http clone info' do project = Project.find_by(name: 'Empty Public Project') - all(:css, '.git-empty .clone').each do |element| - element.text.should include(project.http_url_to_repo) + page.all(:css, '.git-empty .clone').each do |element| + expect(element.text).to include(project.http_url_to_repo) end end step 'I should see empty public project details with ssh clone info' do project = Project.find_by(name: 'Empty Public Project') - all(:css, '.git-empty .clone').each do |element| - element.text.should include(project.url_to_repo) + page.all(:css, '.git-empty .clone').each do |element| + expect(element.text).to include(project.url_to_repo) end end step 'I should see project "Community" home page' do - within '.navbar-gitlab .title' do - page.should have_content 'Community' + page.within '.navbar-gitlab .title' do + expect(page).to have_content 'Community' end end step 'I should see project "Internal" home page' do - within '.navbar-gitlab .title' do - page.should have_content 'Internal' + page.within '.navbar-gitlab .title' do + expect(page).to have_content 'Internal' end end step 'I should see an http link to the repository' do project = Project.find_by(name: 'Community') - page.should have_field('project_clone', with: project.http_url_to_repo) + expect(page).to have_field('project_clone', with: project.http_url_to_repo) end step 'I should see an ssh link to the repository' do project = Project.find_by(name: 'Community') - page.should have_field('project_clone', with: project.url_to_repo) + expect(page).to have_field('project_clone', with: project.url_to_repo) end step 'I visit "Community" issues page' do @@ -70,9 +70,9 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps step 'I should see list of issues for "Community" project' do - page.should have_content "Bug" - page.should have_content public_project.name - page.should have_content "New feature" + expect(page).to have_content "Bug" + expect(page).to have_content public_project.name + expect(page).to have_content "New feature" end step 'I visit "Internal" issues page' do @@ -89,9 +89,9 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps step 'I should see list of issues for "Internal" project' do - page.should have_content "Internal Bug" - page.should have_content internal_project.name - page.should have_content "New internal feature" + expect(page).to have_content "Internal Bug" + expect(page).to have_content internal_project.name + expect(page).to have_content "New internal feature" end step 'I visit "Community" merge requests page' do @@ -107,8 +107,8 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps end step 'I should see list of merge requests for "Community" project' do - page.should have_content public_project.name - page.should have_content public_merge_request.source_project.name + expect(page).to have_content public_project.name + expect(page).to have_content public_merge_request.source_project.name end step 'I visit "Internal" merge requests page' do @@ -124,8 +124,8 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps end step 'I should see list of merge requests for "Internal" project' do - page.should have_content internal_project.name - page.should have_content internal_merge_request.source_project.name + expect(page).to have_content internal_project.name + expect(page).to have_content internal_merge_request.source_project.name end def internal_project diff --git a/features/steps/groups.rb b/features/steps/groups.rb index 0568c99c8d..907679f1b5 100644 --- a/features/steps/groups.rb +++ b/features/steps/groups.rb @@ -16,7 +16,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps step 'I select "Mike" as "Reporter"' do user = User.find_by(name: "Mike") - within ".users-group-form" do + page.within ".users-group-form" do select2(user.id, from: "#user_ids", multiple: true) select "Reporter", from: "access_level" end @@ -25,14 +25,14 @@ class Spinach::Features::Groups < Spinach::FeatureSteps end step 'I should see "Mike" in team list as "Reporter"' do - within '.well-list' do - page.should have_content('Mike') - page.should have_content('Reporter') + page.within '.well-list' do + expect(page).to have_content('Mike') + expect(page).to have_content('Reporter') end end step 'I select "sjobs@apple.com" as "Reporter"' do - within ".users-group-form" do + page.within ".users-group-form" do select2("sjobs@apple.com", from: "#user_ids", multiple: true) select "Reporter", from: "access_level" end @@ -41,39 +41,39 @@ class Spinach::Features::Groups < Spinach::FeatureSteps end step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do - within '.well-list' do - page.should have_content('sjobs@apple.com') - page.should have_content('invited') - page.should have_content('Reporter') + page.within '.well-list' do + expect(page).to have_content('sjobs@apple.com') + expect(page).to have_content('invited') + expect(page).to have_content('Reporter') end end step 'I should see group "Owned" projects list' do Group.find_by(name: "Owned").projects.each do |project| - page.should have_link project.name + expect(page).to have_link project.name end end step 'I should see projects activity feed' do - page.should have_content 'closed issue' + expect(page).to have_content 'closed issue' end step 'I should see issues from group "Owned" assigned to me' do assigned_to_me(:issues).each do |issue| - page.should have_content issue.title + expect(page).to have_content issue.title end end step 'I should see merge requests from group "Owned" assigned to me' do assigned_to_me(:merge_requests).each do |issue| - page.should have_content issue.title[0..80] + expect(page).to have_content issue.title[0..80] end end step 'I select user "Mary Jane" from list with role "Reporter"' do user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane") click_button 'Add members' - within ".users-group-form" do + page.within ".users-group-form" do select2(user.id, from: "#user_ids", multiple: true) select "Reporter", from: "access_level" end @@ -82,22 +82,22 @@ class Spinach::Features::Groups < Spinach::FeatureSteps step 'I should see user "John Doe" in team list' do projects_with_access = find(".panel .well-list") - projects_with_access.should have_content("John Doe") + expect(projects_with_access).to have_content("John Doe") end step 'I should not see user "John Doe" in team list' do projects_with_access = find(".panel .well-list") - projects_with_access.should_not have_content("John Doe") + expect(projects_with_access).not_to have_content("John Doe") end step 'I should see user "Mary Jane" in team list' do projects_with_access = find(".panel .well-list") - projects_with_access.should have_content("Mary Jane") + expect(projects_with_access).to have_content("Mary Jane") end step 'I should not see user "Mary Jane" in team list' do projects_with_access = find(".panel .well-list") - projects_with_access.should_not have_content("Mary Jane") + expect(projects_with_access).not_to have_content("Mary Jane") end step 'I change the role to "Developer"' do @@ -160,8 +160,8 @@ class Spinach::Features::Groups < Spinach::FeatureSteps end step 'I should see new group "Owned" name' do - within ".navbar-gitlab" do - page.should have_content "new-name" + page.within ".navbar-gitlab" do + expect(page).to have_content "new-name" end end @@ -172,12 +172,12 @@ class Spinach::Features::Groups < Spinach::FeatureSteps end step 'I should see new group "Owned" avatar' do - Group.find_by(name: "Owned").avatar.should be_instance_of AvatarUploader - Group.find_by(name: "Owned").avatar.url.should == "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/gitlab_logo.png" + expect(Group.find_by(name: "Owned").avatar).to be_instance_of AvatarUploader + expect(Group.find_by(name: "Owned").avatar.url).to eq "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/gitlab_logo.png" end step 'I should see the "Remove avatar" button' do - page.should have_link("Remove avatar") + expect(page).to have_link("Remove avatar") end step 'I have group "Owned" avatar' do @@ -192,11 +192,11 @@ class Spinach::Features::Groups < Spinach::FeatureSteps end step 'I should not see group "Owned" avatar' do - Group.find_by(name: "Owned").avatar?.should be_false + expect(Group.find_by(name: "Owned").avatar?).to be_false end step 'I should not see the "Remove avatar" button' do - page.should_not have_link("Remove avatar") + expect(page).not_to have_link("Remove avatar") end step 'I click on the "Remove User From Group" button for "John Doe"' do @@ -210,17 +210,17 @@ class Spinach::Features::Groups < Spinach::FeatureSteps end step 'I should not see the "Remove User From Group" button for "John Doe"' do - find(:css, 'li', text: "John Doe").should_not have_selector(:css, 'a.btn-remove') + expect(find(:css, 'li', text: "John Doe")).not_to have_selector(:css, 'a.btn-remove') # poltergeist always confirms popups. end step 'I should not see the "Remove User From Group" button for "Mary Jane"' do - find(:css, 'li', text: "Mary Jane").should_not have_selector(:css, 'a.btn-remove') + expect(find(:css, 'li', text: "Mary Jane")).not_to have_selector(:css, 'a.btn-remove') # poltergeist always confirms popups. end step 'I search for \'Mary\' member' do - within '.member-search-form' do + page.within '.member-search-form' do fill_in 'search', with: 'Mary' click_button 'Search' end @@ -231,7 +231,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps end step 'I should see group milestones index page has no milestones' do - page.should have_content('No milestones to show') + expect(page).to have_content('No milestones to show') end step 'Group has projects with milestones' do @@ -239,10 +239,10 @@ class Spinach::Features::Groups < Spinach::FeatureSteps end step 'I should see group milestones index page with milestones' do - page.should have_content('Version 7.2') - page.should have_content('GL-113') - page.should have_link('2 Issues', href: issues_group_path("owned", milestone_title: "Version 7.2")) - page.should have_link('3 Merge Requests', href: merge_requests_group_path("owned", milestone_title: "GL-113")) + expect(page).to have_content('Version 7.2') + expect(page).to have_content('GL-113') + expect(page).to have_link('2 Issues', href: issues_group_path("owned", milestone_title: "Version 7.2")) + expect(page).to have_link('3 Merge Requests', href: merge_requests_group_path("owned", milestone_title: "GL-113")) end step 'I click on one group milestone' do @@ -250,14 +250,14 @@ class Spinach::Features::Groups < Spinach::FeatureSteps end step 'I should see group milestone with descriptions and expiry date' do - page.should have_content('expires at Aug 20, 2114') + expect(page).to have_content('expires at Aug 20, 2114') end step 'I should see group milestone with all issues and MRs assigned to that milestone' do - page.should have_content('Milestone GL-113') - page.should have_content('Progress: 0 closed – 4 open') - page.should have_link(@issue1.title, href: namespace_project_issue_path(@project1.namespace, @project1, @issue1)) - page.should have_link(@mr3.title, href: namespace_project_merge_request_path(@project3.namespace, @project3, @mr3)) + expect(page).to have_content('Milestone GL-113') + expect(page).to have_content('Progress: 0 closed – 4 open') + expect(page).to have_link(@issue1.title, href: namespace_project_issue_path(@project1.namespace, @project1, @issue1)) + expect(page).to have_link(@mr3.title, href: namespace_project_merge_request_path(@project3.namespace, @project3, @mr3)) end protected diff --git a/features/steps/groups_management.rb b/features/steps/groups_management.rb index 31ef91e953..3a6562d550 100644 --- a/features/steps/groups_management.rb +++ b/features/steps/groups_management.rb @@ -24,7 +24,6 @@ class Spinach::Features::GroupsManagement < Spinach::FeatureSteps step 'I go to "Open" project members page' do click_link 'Sourcing / Open' - click_link 'Settings' click_link 'Members' end diff --git a/features/steps/profile/emails.rb b/features/steps/profile/emails.rb index 2b6ac37d86..10ebe70536 100644 --- a/features/steps/profile/emails.rb +++ b/features/steps/profile/emails.rb @@ -6,9 +6,9 @@ class Spinach::Features::ProfileEmails < Spinach::FeatureSteps end step 'I should see my emails' do - page.should have_content(@user.email) + expect(page).to have_content(@user.email) @user.emails.each do |email| - page.should have_content(email.email) + expect(page).to have_content(email.email) end end @@ -19,14 +19,14 @@ class Spinach::Features::ProfileEmails < Spinach::FeatureSteps step 'I should see new email "my@email.com"' do email = @user.emails.find_by(email: "my@email.com") - email.should_not be_nil - page.should have_content("my@email.com") + expect(email).not_to be_nil + expect(page).to have_content("my@email.com") end step 'I should not see email "my@email.com"' do email = @user.emails.find_by(email: "my@email.com") - email.should be_nil - page.should_not have_content("my@email.com") + expect(email).to be_nil + expect(page).not_to have_content("my@email.com") end step 'I click link "Remove" for "my@email.com"' do @@ -43,6 +43,6 @@ class Spinach::Features::ProfileEmails < Spinach::FeatureSteps step 'I should not have @user.email added' do email = @user.emails.find_by(email: @user.email) - email.should be_nil + expect(email).to be_nil end end diff --git a/features/steps/profile/notifications.rb b/features/steps/profile/notifications.rb index b6e03b549a..447ea6d9d1 100644 --- a/features/steps/profile/notifications.rb +++ b/features/steps/profile/notifications.rb @@ -7,6 +7,6 @@ class Spinach::Features::ProfileNotifications < Spinach::FeatureSteps end step 'I should see global notifications settings' do - page.should have_content "Notifications" + expect(page).to have_content "Notifications" end end diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index d16e6bbea5..32e6859eff 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -3,7 +3,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps include SharedPaths step 'I should see my profile info' do - page.should have_content "This information will appear on your profile" + expect(page).to have_content "This information will appear on your profile" end step 'I change my profile info' do @@ -23,7 +23,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps expect(@user.twitter).to eq 'testtwitter' expect(@user.website_url).to eq 'testurl' expect(@user.bio).to eq 'I <3 GitLab' - find('#user_location').value.should == 'Ukraine' + expect(find('#user_location').value).to eq 'Ukraine' end step 'I change my avatar' do @@ -33,12 +33,12 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I should see new avatar' do - @user.avatar.should be_instance_of AvatarUploader - @user.avatar.url.should == "/uploads/user/avatar/#{ @user.id }/gitlab_logo.png" + expect(@user.avatar).to be_instance_of AvatarUploader + expect(@user.avatar.url).to eq "/uploads/user/avatar/#{ @user.id }/gitlab_logo.png" end step 'I should see the "Remove avatar" button' do - page.should have_link("Remove avatar") + expect(page).to have_link("Remove avatar") end step 'I have an avatar' do @@ -53,15 +53,15 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I should see my gravatar' do - @user.avatar?.should be_false + expect(@user.avatar?).to be_false end step 'I should not see the "Remove avatar" button' do - page.should_not have_link("Remove avatar") + expect(page).not_to have_link("Remove avatar") end step 'I try change my password w/o old one' do - within '.update-password' do + page.within '.update-password' do fill_in "user_password", with: "22233344" fill_in "user_password_confirmation", with: "22233344" click_button "Save" @@ -69,7 +69,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I change my password' do - within '.update-password' do + page.within '.update-password' do fill_in "user_current_password", with: "12345678" fill_in "user_password", with: "22233344" fill_in "user_password_confirmation", with: "22233344" @@ -78,7 +78,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I unsuccessfully change my password' do - within '.update-password' do + page.within '.update-password' do fill_in "user_current_password", with: "12345678" fill_in "user_password", with: "password" fill_in "user_password_confirmation", with: "confirmation" @@ -87,23 +87,23 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step "I should see a missing password error message" do - page.should have_content "You must provide a valid current password" + expect(page).to have_content "You must provide a valid current password" end step "I should see a password error message" do - page.should have_content "Password confirmation doesn't match" + expect(page).to have_content "Password confirmation doesn't match" end step 'I reset my token' do - within '.update-token' do + page.within '.update-token' do @old_token = @user.private_token click_button "Reset" end end step 'I should see new token' do - find("#token").value.should_not == @old_token - find("#token").value.should == @user.reload.private_token + expect(find("#token").value).not_to eq @old_token + expect(find("#token").value).to eq @user.reload.private_token end step 'I have activity' do @@ -111,28 +111,28 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I should see my activity' do - page.should have_content "#{current_user.name} closed issue" + expect(page).to have_content "#{current_user.name} closed issue" end step "I change my application theme" do - within '.application-theme' do + page.within '.application-theme' do choose "Violet" end end step "I change my code preview theme" do - within '.code-preview-theme' do + page.within '.code-preview-theme' do choose "Solarized dark" end end step "I should see the theme change immediately" do - page.should have_selector('body.ui_color') - page.should_not have_selector('body.ui_basic') + expect(page).to have_selector('body.ui_color') + expect(page).not_to have_selector('body.ui_basic') end step "I should receive feedback that the changes were saved" do - page.should have_content("saved") + expect(page).to have_content("saved") end step 'my password is expired' do @@ -141,11 +141,11 @@ class Spinach::Features::Profile < Spinach::FeatureSteps step "I am not an ldap user" do current_user.identities.delete - current_user.ldap_user?.should be_false + expect(current_user.ldap_user?).to be_false end step 'I redirected to expired password page' do - current_path.should == new_profile_password_path + expect(current_path).to eq new_profile_password_path end step 'I submit new password' do @@ -156,15 +156,15 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I redirected to sign in page' do - current_path.should == new_user_session_path + expect(current_path).to eq new_user_session_path end step 'I should be redirected to password page' do - current_path.should == edit_profile_password_path + expect(current_path).to eq edit_profile_password_path end step 'I should be redirected to account page' do - current_path.should == profile_account_path + expect(current_path).to eq profile_account_path end step 'I click on my profile picture' do @@ -172,10 +172,10 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I should see my user page' do - page.should have_content "User Activity" + expect(page).to have_content "User Activity" - within '.navbar-gitlab' do - page.should have_content current_user.name + page.within '.navbar-gitlab' do + expect(page).to have_content current_user.name end end @@ -189,7 +189,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I should see groups I belong to' do - page.should have_css('.profile-groups-avatars', visible: true) + expect(page).to have_css('.profile-groups-avatars', visible: true) end step 'I click on new application button' do @@ -197,7 +197,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I should see application form' do - page.should have_content "New application" + expect(page).to have_content "New application" end step 'I fill application form out and submit' do @@ -207,9 +207,9 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I see application' do - page.should have_content "Application: test" - page.should have_content "Application Id" - page.should have_content "Secret" + expect(page).to have_content "Application: test" + expect(page).to have_content "Application Id" + expect(page).to have_content "Secret" end step 'I click edit' do @@ -217,28 +217,28 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I see edit application form' do - page.should have_content "Edit application" + expect(page).to have_content "Edit application" end step 'I change name of application and submit' do - page.should have_content "Edit application" + expect(page).to have_content "Edit application" fill_in :doorkeeper_application_name, with: 'test_changed' click_on "Submit" end step 'I see that application was changed' do - page.should have_content "test_changed" - page.should have_content "Application Id" - page.should have_content "Secret" + expect(page).to have_content "test_changed" + expect(page).to have_content "Application Id" + expect(page).to have_content "Secret" end step 'I click to remove application' do - within '.oauth-applications' do + page.within '.oauth-applications' do click_on "Destroy" end end step "I see that application is removed" do - page.find(".oauth-applications").should_not have_content "test_changed" + expect(page.find(".oauth-applications")).not_to have_content "test_changed" end end diff --git a/features/steps/profile/ssh_keys.rb b/features/steps/profile/ssh_keys.rb index ea912e5b4d..c7f879d247 100644 --- a/features/steps/profile/ssh_keys.rb +++ b/features/steps/profile/ssh_keys.rb @@ -3,7 +3,7 @@ class Spinach::Features::ProfileSshKeys < Spinach::FeatureSteps step 'I should see my ssh keys' do @user.keys.each do |key| - page.should have_content(key.title) + expect(page).to have_content(key.title) end end @@ -19,9 +19,9 @@ class Spinach::Features::ProfileSshKeys < Spinach::FeatureSteps step 'I should see new ssh key "Laptop"' do key = Key.find_by(title: "Laptop") - page.should have_content(key.title) - page.should have_content(key.key) - current_path.should == profile_key_path(key) + expect(page).to have_content(key.title) + expect(page).to have_content(key.key) + expect(current_path).to eq profile_key_path(key) end step 'I click link "Work"' do @@ -37,7 +37,7 @@ class Spinach::Features::ProfileSshKeys < Spinach::FeatureSteps end step 'I should not see "Work" ssh key' do - page.should_not have_content "Work" + expect(page).not_to have_content "Work" end step 'I have ssh key "ssh-rsa Work"' do diff --git a/features/steps/project/active_tab.rb b/features/steps/project/active_tab.rb index dd3215adb1..fabbc1d3d8 100644 --- a/features/steps/project/active_tab.rb +++ b/features/steps/project/active_tab.rb @@ -20,7 +20,7 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps end step 'I click the "Edit" tab' do - within '.project-settings-nav' do + page.within '.project-settings-nav' do click_link('Project') end end diff --git a/features/steps/project/archived.rb b/features/steps/project/archived.rb index 37ad0c7765..db1387763d 100644 --- a/features/steps/project/archived.rb +++ b/features/steps/project/archived.rb @@ -19,11 +19,11 @@ class Spinach::Features::ProjectArchived < Spinach::FeatureSteps end step 'I should not see "Archived"' do - page.should_not have_content "Archived" + expect(page).not_to have_content "Archived" end step 'I should see "Archived"' do - page.should have_content "Archived" + expect(page).to have_content "Archived" end When 'I set project archived' do diff --git a/features/steps/project/commits/branches.rb b/features/steps/project/commits/branches.rb index 07f7e5796a..338f5e8d3e 100644 --- a/features/steps/project/commits/branches.rb +++ b/features/steps/project/commits/branches.rb @@ -8,8 +8,8 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps end step 'I should see "Shop" all branches list' do - page.should have_content "Branches" - page.should have_content "master" + expect(page).to have_content "Branches" + expect(page).to have_content "master" end step 'I click link "Protected"' do @@ -17,9 +17,9 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps end 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" + page.within ".protected-branches-list" do + expect(page).to have_content "stable" + expect(page).not_to have_content "master" end end @@ -57,29 +57,29 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps end step 'I should see new branch created' do - page.should have_content 'deploy_keys' + expect(page).to have_content 'deploy_keys' end step 'I should see new an error that branch is invalid' do - page.should have_content 'Branch name invalid' + expect(page).to have_content 'Branch name invalid' end step 'I should see new an error that ref is invalid' do - page.should have_content 'Invalid reference name' + expect(page).to have_content 'Invalid reference name' end step 'I should see new an error that branch already exists' do - page.should have_content 'Branch already exists' + expect(page).to have_content 'Branch already exists' end step "I click branch 'improve/awesome' delete link" do - within '.js-branch-improve\/awesome' do + page.within '.js-branch-improve\/awesome' do find('.btn-remove').click sleep 0.05 end end step "I should not see branch 'improve/awesome'" do - all(visible: true).should_not have_content 'improve/awesome' + expect(page.all(visible: true)).not_to have_content 'improve/awesome' end end diff --git a/features/steps/project/commits/commits.rb b/features/steps/project/commits/commits.rb index c888e82e20..4b19e3beed 100644 --- a/features/steps/project/commits/commits.rb +++ b/features/steps/project/commits/commits.rb @@ -6,9 +6,9 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps step 'I see project commits' do commit = @project.repository.commit - page.should have_content(@project.name) - page.should have_content(commit.message[0..20]) - page.should have_content(commit.short_id) + 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 @@ -17,10 +17,10 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps step 'I see commits atom feed' do commit = @project.repository.commit - response_headers['Content-Type'].should have_content("application/atom+xml") - body.should have_selector("title", text: "#{@project.name}:master commits") - body.should have_selector("author email", text: commit.author_email) - body.should have_selector("entry summary", text: commit.description[0..10]) + 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]) end step 'I click on commit link' do @@ -28,8 +28,8 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps end step 'I see commit info' do - page.should have_content sample_commit.message - page.should have_content "Showing #{sample_commit.files_changed_count} changed files" + 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 refs' do @@ -45,38 +45,37 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps end step 'I should see additional file lines' do - within @diff.parent do - first('.new_line').text.should_not have_content "..." + page.within @diff.parent do + expect(first('.new_line').text).not_to have_content "..." end end step 'I see compared refs' do - page.should have_content "Compare View" - page.should have_content "Commits (1)" - page.should have_content "Showing 2 changed files" + expect(page).to have_content "Compare View" + expect(page).to have_content "Commits (1)" + expect(page).to have_content "Showing 2 changed files" end step 'I see breadcrumb links' do - page.should have_selector('ul.breadcrumb') - page.should have_selector('ul.breadcrumb a', count: 4) + expect(page).to have_selector('ul.breadcrumb') + expect(page).to have_selector('ul.breadcrumb a', count: 4) end step 'I see commits stats' do - page.should have_content 'Top 50 Committers' - page.should have_content 'Committers' - page.should have_content 'Total commits' - page.should have_content 'Authors' + 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 big commit page' do - Commit::DIFF_SAFE_FILES = 20 + stub_const('Commit::DIFF_SAFE_FILES', 20) visit namespace_project_commit_path(@project.namespace, @project, sample_big_commit.id) end step 'I see big commit warning' do - page.should have_content sample_big_commit.message - page.should have_content "Too many changes" - Commit::DIFF_SAFE_FILES = 100 + expect(page).to have_content sample_big_commit.message + expect(page).to have_content "Too many changes" end step 'I visit a commit with an image that changed' do @@ -84,9 +83,9 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps end step 'The diff links to both the previous and current image' do - links = all('.two-up span div a') - links[0]['href'].should =~ %r{blob/#{sample_image_commit.old_blob_id}} - links[1]['href'].should =~ %r{blob/#{sample_image_commit.new_blob_id}} + links = page.all('.two-up span div 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 click side-by-side diff button' do @@ -94,10 +93,10 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps end step 'I see side-by-side diff button' do - page.should have_content "Side-by-side" + expect(page).to have_content "Side-by-side" end step 'I see inline diff button' do - page.should have_content "Inline" + expect(page).to have_content "Inline" end end diff --git a/features/steps/project/commits/tags.rb b/features/steps/project/commits/tags.rb index 3465fcbfd0..e6f8faf50f 100644 --- a/features/steps/project/commits/tags.rb +++ b/features/steps/project/commits/tags.rb @@ -4,8 +4,8 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps include SharedPaths step 'I should see "Shop" all tags list' do - page.should have_content "Tags" - page.should have_content "v1.0.0" + expect(page).to have_content "Tags" + expect(page).to have_content "v1.0.0" end step 'I click new tag link' do @@ -37,37 +37,37 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps end step 'I should see new tag created' do - page.should have_content 'v7.0' + expect(page).to have_content 'v7.0' end step 'I should see new an error that tag is invalid' do - page.should have_content 'Tag name invalid' + expect(page).to have_content 'Tag name invalid' end step 'I should see new an error that tag ref is invalid' do - page.should have_content 'Invalid reference name' + expect(page).to have_content 'Invalid reference name' end step 'I should see new an error that tag already exists' do - page.should have_content 'Tag already exists' + expect(page).to have_content 'Tag already exists' end step "I delete tag 'v1.1.0'" do - within '.tags' do + page.within '.tags' do first('.btn-remove').click sleep 0.05 end end step "I should not see tag 'v1.1.0'" do - within '.tags' do - all(visible: true).should_not have_content 'v1.1.0' + page.within '.tags' do + expect(page.all(visible: true)).not_to have_content 'v1.1.0' end end step 'I delete all tags' do - within '.tags' do - all('.btn-remove').each do |remove| + page.within '.tags' do + page.all('.btn-remove').each do |remove| remove.click sleep 0.05 end @@ -75,8 +75,8 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps end step 'I should see tags info message' do - within '.tags' do - page.should have_content 'Repository has no tags yet.' + page.within '.tags' do + expect(page).to have_content 'Repository has no tags yet.' end end end diff --git a/features/steps/project/commits/user_lookup.rb b/features/steps/project/commits/user_lookup.rb index 63ff84c82e..40cada6da4 100644 --- a/features/steps/project/commits/user_lookup.rb +++ b/features/steps/project/commits/user_lookup.rb @@ -29,9 +29,9 @@ class Spinach::Features::ProjectCommitsUserLookup < Spinach::FeatureSteps def check_author_link(email, user) author_link = find('.commit-author-link') - author_link['href'].should == user_path(user) - author_link['data-original-title'].should == email - find('.commit-author-name').text.should == user.name + expect(author_link['href']).to eq user_path(user) + expect(author_link['data-original-title']).to eq email + expect(find('.commit-author-name').text).to eq user.name end def user_primary diff --git a/features/steps/project/create.rb b/features/steps/project/create.rb index 6b85cf74f5..0d39e1997b 100644 --- a/features/steps/project/create.rb +++ b/features/steps/project/create.rb @@ -8,20 +8,20 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps end step 'I should see project page' do - page.should have_content "Empty" - current_path.should == namespace_project_path(Project.last.namespace, Project.last) + expect(page).to have_content "Empty" + expect(current_path).to eq namespace_project_path(Project.last.namespace, Project.last) end step 'I should see empty project instuctions' do - page.should have_content "git init" - page.should have_content "git remote" - page.should have_content Project.last.url_to_repo + expect(page).to have_content "git init" + expect(page).to have_content "git remote" + expect(page).to have_content Project.last.url_to_repo end step 'I see empty project instuctions' do - page.should have_content "git init" - page.should have_content "git remote" - page.should have_content Project.last.url_to_repo + expect(page).to have_content "git init" + expect(page).to have_content "git remote" + expect(page).to have_content Project.last.url_to_repo end step 'I click on HTTP' do @@ -29,7 +29,7 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps end step 'Remote url should update to http link' do - page.should have_content "git remote add origin #{Project.last.http_url_to_repo}" + expect(page).to have_content "git remote add origin #{Project.last.http_url_to_repo}" end step 'If I click on SSH' do @@ -37,6 +37,6 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps end step 'Remote url should update to ssh link' do - page.should have_content "git remote add origin #{Project.last.url_to_repo}" + expect(page).to have_content "git remote add origin #{Project.last.url_to_repo}" end end diff --git a/features/steps/project/deploy_keys.rb b/features/steps/project/deploy_keys.rb index 81d1182cd1..a4d6c9a1b8 100644 --- a/features/steps/project/deploy_keys.rb +++ b/features/steps/project/deploy_keys.rb @@ -8,20 +8,20 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps end step 'I should see project deploy key' do - within '.enabled-keys' do - page.should have_content deploy_key.title + page.within '.enabled-keys' do + expect(page).to have_content deploy_key.title end end step 'I should see other project deploy key' do - within '.available-keys' do - page.should have_content other_deploy_key.title + page.within '.available-keys' do + expect(page).to have_content other_deploy_key.title end end step 'I should see public deploy key' do - within '.available-keys' do - page.should have_content public_deploy_key.title + page.within '.available-keys' do + expect(page).to have_content public_deploy_key.title end end @@ -36,12 +36,12 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps end step 'I should be on deploy keys page' do - current_path.should == namespace_project_deploy_keys_path(@project.namespace, @project) + expect(current_path).to eq namespace_project_deploy_keys_path(@project.namespace, @project) end step 'I should see newly created deploy key' do - within '.enabled-keys' do - page.should have_content(deploy_key.title) + page.within '.enabled-keys' do + expect(page).to have_content(deploy_key.title) end end @@ -56,8 +56,8 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps end step 'I should only see the same deploy key once' do - within '.available-keys' do - page.should have_selector('ul li', count: 1) + page.within '.available-keys' do + expect(page).to have_selector('ul li', count: 1) end end @@ -66,7 +66,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps end step 'I click attach deploy key' do - within '.available-keys' do + page.within '.available-keys' do click_link 'Enable' end end diff --git a/features/steps/project/fork.rb b/features/steps/project/fork.rb index 8e58597db2..0e433781d7 100644 --- a/features/steps/project/fork.rb +++ b/features/steps/project/fork.rb @@ -4,8 +4,8 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps include SharedProject step 'I click link "Fork"' do - page.should have_content "Shop" - page.should have_content "Fork" + expect(page).to have_content "Shop" + expect(page).to have_content "Fork" click_link "Fork" end @@ -15,7 +15,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps end step 'I should see the forked project page' do - page.should have_content "Project was successfully forked." + expect(page).to have_content "Project was successfully forked." end step 'I already have a project named "Shop" in my namespace' do @@ -23,11 +23,11 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps end step 'I should see a "Name has already been taken" warning' do - page.should have_content "Name has already been taken" + expect(page).to have_content "Name has already been taken" end step 'I fork to my namespace' do - within '.fork-namespaces' do + page.within '.fork-namespaces' do click_link current_user.name end end diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb index ebfa102cee..78812c5202 100644 --- a/features/steps/project/forked_merge_requests.rb +++ b/features/steps/project/forked_merge_requests.rb @@ -21,17 +21,17 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps end step 'I should see merge request "Merge Request On Forked Project"' do - @project.merge_requests.size.should >= 1 + expect(@project.merge_requests.size).to be >= 1 @merge_request = @project.merge_requests.last - current_path.should == namespace_project_merge_request_path(@project.namespace, @project, @merge_request) - @merge_request.title.should == "Merge Request On Forked Project" - @merge_request.source_project.should == @forked_project - @merge_request.source_branch.should == "fix" - @merge_request.target_branch.should == "master" - page.should have_content @forked_project.path_with_namespace - page.should have_content @project.path_with_namespace - page.should have_content @merge_request.source_branch - page.should have_content @merge_request.target_branch + expect(current_path).to eq namespace_project_merge_request_path(@project.namespace, @project, @merge_request) + expect(@merge_request.title).to eq "Merge Request On Forked Project" + expect(@merge_request.source_project).to eq @forked_project + expect(@merge_request.source_branch).to eq "fix" + expect(@merge_request.target_branch).to eq "master" + expect(page).to have_content @forked_project.path_with_namespace + expect(page).to have_content @project.path_with_namespace + expect(page).to have_content @merge_request.source_branch + expect(page).to have_content @merge_request.target_branch end step 'I fill out a "Merge Request On Forked Project" merge request' do @@ -56,7 +56,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps step 'I should see the commit under the forked from project' do commit = @project.repository.commit - page.should have_content(commit.message) + expect(page).to have_content(commit.message) end step 'I click "Create Merge Request on fork" link' do @@ -64,12 +64,12 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps end step 'I see prefilled new Merge Request page for the forked project' do - current_path.should == new_namespace_project_merge_request_path(@forked_project.namespace, @forked_project) - find("#merge_request_source_project_id").value.should == @forked_project.id.to_s - find("#merge_request_target_project_id").value.should == @project.id.to_s - find("#merge_request_source_branch").value.should have_content "new_design" - find("#merge_request_target_branch").value.should have_content "master" - find("#merge_request_title").value.should == "New Design" + expect(current_path).to eq new_namespace_project_merge_request_path(@forked_project.namespace, @forked_project) + expect(find("#merge_request_source_project_id").value).to eq @forked_project.id.to_s + expect(find("#merge_request_target_project_id").value).to eq @project.id.to_s + expect(find("#merge_request_source_branch").value).to have_content "new_design" + expect(find("#merge_request_target_branch").value).to have_content "master" + expect(find("#merge_request_title").value).to eq "New Design" verify_commit_link(".mr_target_commit", @project) verify_commit_link(".mr_source_commit", @forked_project) end @@ -83,22 +83,22 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps end step 'I should see the edited merge request' do - page.should have_content "An Edited Forked Merge Request" - @project.merge_requests.size.should >= 1 + expect(page).to have_content "An Edited Forked Merge Request" + expect(@project.merge_requests.size).to be >= 1 @merge_request = @project.merge_requests.last - current_path.should == namespace_project_merge_request_path(@project.namespace, @project, @merge_request) - @merge_request.source_project.should == @forked_project - @merge_request.source_branch.should == "fix" - @merge_request.target_branch.should == "master" - page.should have_content @forked_project.path_with_namespace - page.should have_content @project.path_with_namespace - page.should have_content @merge_request.source_branch - page.should have_content @merge_request.target_branch + expect(current_path).to eq namespace_project_merge_request_path(@project.namespace, @project, @merge_request) + expect(@merge_request.source_project).to eq @forked_project + expect(@merge_request.source_branch).to eq "fix" + expect(@merge_request.target_branch).to eq "master" + expect(page).to have_content @forked_project.path_with_namespace + expect(page).to have_content @project.path_with_namespace + expect(page).to have_content @merge_request.source_branch + expect(page).to have_content @merge_request.target_branch end step 'I should see last push widget' do - page.should have_content "You pushed to new_design" - page.should have_link "Create Merge Request" + expect(page).to have_content "You pushed to new_design" + expect(page).to have_link "Create Merge Request" end step 'I click link edit "Merge Request On Forked Project"' do @@ -106,26 +106,26 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps end step 'I see the edit page prefilled for "Merge Request On Forked Project"' do - current_path.should == edit_namespace_project_merge_request_path(@project.namespace, @project, @merge_request) - page.should have_content "Edit merge request ##{@merge_request.id}" - find("#merge_request_title").value.should == "Merge Request On Forked Project" + expect(current_path).to eq edit_namespace_project_merge_request_path(@project.namespace, @project, @merge_request) + expect(page).to have_content "Edit merge request ##{@merge_request.id}" + expect(find("#merge_request_title").value).to eq "Merge Request On Forked Project" end step 'I fill out an invalid "Merge Request On Forked Project" merge request' do select "Select branch", from: "merge_request_target_branch" - find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s - find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s - find(:select, "merge_request_source_branch", {}).value.should == "" - find(:select, "merge_request_target_branch", {}).value.should == "" + expect(find(:select, "merge_request_source_project_id", {}).value).to eq @forked_project.id.to_s + expect(find(:select, "merge_request_target_project_id", {}).value).to eq @project.id.to_s + expect(find(:select, "merge_request_source_branch", {}).value).to eq "" + expect(find(:select, "merge_request_target_branch", {}).value).to eq "" click_button "Compare branches" end step 'I should see validation errors' do - page.should have_content "You must select source and target branch" + expect(page).to have_content "You must select source and target branch" end step 'the target repository should be the original repository' do - page.should have_select("merge_request_target_project_id", selected: @project.path_with_namespace) + expect(page).to have_select("merge_request_target_project_id", selected: @project.path_with_namespace) end step 'I click "Assign to" dropdown"' do @@ -139,13 +139,13 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps step 'I should see the users from the target project ID' do expect(page).to have_selector('.user-result', visible: true, count: 2) users = page.all('.user-name') - users[0].text.should == 'Unassigned' - users[1].text.should == @project.users.first.name + expect(users[0].text).to eq 'Unassigned' + expect(users[1].text).to eq @project.users.first.name end # Verify a link is generated against the correct project def verify_commit_link(container_div, container_project) # This should force a wait for the javascript to execute - find(:div,container_div).find(".commit_short_id")['href'].should have_content "#{container_project.path_with_namespace}/commit" + expect(find(:div,container_div).find(".commit_short_id")['href']).to have_content "#{container_project.path_with_namespace}/commit" end end diff --git a/features/steps/project/graph.rb b/features/steps/project/graph.rb index a2807c340f..5e7e573a6a 100644 --- a/features/steps/project/graph.rb +++ b/features/steps/project/graph.rb @@ -3,7 +3,7 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps include SharedProject step 'page should have graphs' do - page.should have_selector ".stat-graph" + expect(page).to have_selector ".stat-graph" end When 'I visit project "Shop" graph page' do @@ -17,7 +17,7 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps end step 'page should have commits graphs' do - page.should have_content "Commit statistics for master" - page.should have_content "Commits per day of month" + expect(page).to have_content "Commit statistics for master" + expect(page).to have_content "Commits per day of month" end end diff --git a/features/steps/project/hooks.rb b/features/steps/project/hooks.rb index d06905285f..04e3bf78ed 100644 --- a/features/steps/project/hooks.rb +++ b/features/steps/project/hooks.rb @@ -19,7 +19,7 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps end step 'I should see project hook' do - page.should have_content @hook.url + expect(page).to have_content @hook.url end step 'I submit new hook' do @@ -29,8 +29,8 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps end step 'I should see newly created hook' do - current_path.should == namespace_project_hooks_path(current_project.namespace, current_project) - page.should have_content(@url) + expect(current_path).to eq namespace_project_hooks_path(current_project.namespace, current_project) + expect(page).to have_content(@url) end step 'I click test hook button' do @@ -44,19 +44,19 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps end step 'hook should be triggered' do - current_path.should == namespace_project_hooks_path(current_project.namespace, current_project) - page.should have_selector '.flash-notice', + expect(current_path).to eq namespace_project_hooks_path(current_project.namespace, current_project) + expect(page).to have_selector '.flash-notice', text: 'Hook successfully executed.' end step 'I should see hook error message' do - page.should have_selector '.flash-alert', + expect(page).to have_selector '.flash-alert', text: 'Hook execution failed. '\ 'Ensure the project has commits.' end step 'I should see hook service down error message' do - page.should have_selector '.flash-alert', + expect(page).to have_selector '.flash-alert', text: 'Hook execution failed. '\ 'Ensure hook URL is correct and '\ 'service is up.' diff --git a/features/steps/project/issues/filter_labels.rb b/features/steps/project/issues/filter_labels.rb index 5740bd1283..50bb32429b 100644 --- a/features/steps/project/issues/filter_labels.rb +++ b/features/steps/project/issues/filter_labels.rb @@ -5,26 +5,26 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps include Select2Helper step 'I should see "Bugfix1" in issues list' do - within ".issues-list" do - page.should have_content "Bugfix1" + page.within ".issues-list" do + expect(page).to have_content "Bugfix1" end end step 'I should see "Bugfix2" in issues list' do - within ".issues-list" do - page.should have_content "Bugfix2" + page.within ".issues-list" do + expect(page).to have_content "Bugfix2" end end step 'I should not see "Bugfix2" in issues list' do - within ".issues-list" do - page.should_not have_content "Bugfix2" + page.within ".issues-list" do + expect(page).not_to have_content "Bugfix2" end end step 'I should not see "Feature1" in issues list' do - within ".issues-list" do - page.should_not have_content "Feature1" + page.within ".issues-list" do + expect(page).not_to have_content "Feature1" end end @@ -33,7 +33,7 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps end step 'I click link "feature"' do - within ".labels-filter" do + page.within ".labels-filter" do click_link "feature" end end diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index 504f0cff72..6873c043e1 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -7,24 +7,24 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps include SharedMarkdown step 'I should see "Release 0.4" in issues' do - page.should have_content "Release 0.4" + expect(page).to have_content "Release 0.4" end step 'I should not see "Release 0.3" in issues' do - page.should_not have_content "Release 0.3" + expect(page).not_to have_content "Release 0.3" end step 'I should not see "Tweet control" in issues' do - page.should_not have_content "Tweet control" + expect(page).not_to have_content "Tweet control" end step 'I should see that I am subscribed' do - find(".subscribe-button span").text.should == "Unsubscribe" + expect(find(".subscribe-button span").text).to eq "Unsubscribe" end step 'I should see that I am unsubscribed' do sleep 0.2 - find(".subscribe-button span").text.should == "Subscribe" + expect(find(".subscribe-button span").text).to eq "Subscribe" end step 'I click link "Closed"' do @@ -36,11 +36,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end step 'I should see "Release 0.3" in issues' do - page.should have_content "Release 0.3" + expect(page).to have_content "Release 0.3" end step 'I should not see "Release 0.4" in issues' do - page.should_not have_content "Release 0.4" + expect(page).not_to have_content "Release 0.4" end step 'I click link "All"' do @@ -52,7 +52,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end step 'I should see issue "Release 0.4"' do - page.should have_content "Release 0.4" + expect(page).to have_content "Release 0.4" end step 'I click link "New Issue"' do @@ -66,9 +66,9 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps step 'I see current user as the first user' do expect(page).to have_selector('.user-result', visible: true, count: 4) users = page.all('.user-name') - users[0].text.should == 'Any' - users[1].text.should == 'Unassigned' - users[2].text.should == current_user.name + expect(users[0].text).to eq 'Any' + expect(users[1].text).to eq 'Unassigned' + expect(users[2].text).to eq current_user.name end step 'I submit new issue "500 error on profile"' do @@ -87,16 +87,16 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end step 'I should see label \'bug\' with issue' do - within '.issue-show-labels' do - page.should have_content 'bug' + page.within '.issue-show-labels' do + expect(page).to have_content 'bug' end end step 'I should see issue "500 error on profile"' do issue = Issue.find_by(title: "500 error on profile") - page.should have_content issue.title - page.should have_content issue.author_name - page.should have_content issue.project.name + expect(page).to have_content issue.title + expect(page).to have_content issue.author_name + expect(page).to have_content issue.project.name end step 'I fill in issue search with "Re"' do @@ -139,7 +139,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps step 'I should see selected milestone with title "v3.0"' do issues_milestone_selector = "#issue_milestone_id_chzn > a" - find(issues_milestone_selector).should have_content("v3.0") + expect(find(issues_milestone_selector)).to have_content("v3.0") end When 'I select first assignee from "Shop" project' do @@ -152,7 +152,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps issues_assignee_selector = "#issue_assignee_id_chzn > a" assignee_name = project.users.first.name - find(issues_assignee_selector).should have_content(assignee_name) + expect(find(issues_assignee_selector)).to have_content(assignee_name) end step 'project "Shop" have "Release 0.4" open issue' do @@ -190,8 +190,8 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps step 'I see empty project details with ssh clone info' do project = Project.find_by(name: 'Empty Project') - all(:css, '.git-empty .clone').each do |element| - element.text.should include(project.url_to_repo) + page.all(:css, '.git-empty .clone').each do |element| + expect(element.text).to include(project.url_to_repo) end end @@ -201,7 +201,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end step 'I leave a comment with code block' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```" click_button "Add Comment" sleep 0.05 @@ -209,13 +209,13 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end step 'I should see an error alert section within the comment form' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do find(".error-alert") end end step 'The code block should be unchanged' do - page.should have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```") + expect(page).to have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```") end step 'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\'' do @@ -239,15 +239,15 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end step 'I should see \'Bugfix1\' in issues' do - page.should have_content 'Bugfix1' + expect(page).to have_content 'Bugfix1' end step 'I should see \'Feature1\' in issues' do - page.should have_content 'Feature1' + expect(page).to have_content 'Feature1' end step 'I should not see \'Bugfix1\' in issues' do - page.should_not have_content 'Bugfix1' + expect(page).not_to have_content 'Bugfix1' end step 'issue \'Release 0.4\' has label \'bug\'' do @@ -257,7 +257,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end step 'I click label \'bug\'' do - within ".issues-list" do + page.within ".issues-list" do click_link 'bug' end end diff --git a/features/steps/project/issues/labels.rb b/features/steps/project/issues/labels.rb index 6ce34c500c..d656acf422 100644 --- a/features/steps/project/issues/labels.rb +++ b/features/steps/project/issues/labels.rb @@ -8,14 +8,14 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps end step 'I remove label \'bug\'' do - within "#label_#{bug_label.id}" do + page.within "#label_#{bug_label.id}" do click_link 'Remove' end end step 'I delete all labels' do - within '.labels' do - all('.btn-remove').each do |remove| + page.within '.labels' do + page.all('.btn-remove').each do |remove| remove.click sleep 0.05 end @@ -23,8 +23,8 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps end step 'I should see labels help message' do - within '.labels' do - page.should have_content 'Create first label or generate default set of '\ + page.within '.labels' do + expect(page).to have_content 'Create first label or generate default set of '\ 'labels' end end @@ -48,38 +48,38 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps end step 'I should see label label exist error message' do - within '.label-form' do - page.should have_content 'Title has already been taken' + page.within '.label-form' do + expect(page).to have_content 'Title has already been taken' end end step 'I should see label color error message' do - within '.label-form' do - page.should have_content 'Color is invalid' + page.within '.label-form' do + expect(page).to have_content 'Color is invalid' end end step 'I should see label \'feature\'' do - within '.manage-labels-list' do - page.should have_content 'feature' + page.within '.manage-labels-list' do + expect(page).to have_content 'feature' end end step 'I should see label \'bug\'' do - within '.manage-labels-list' do - page.should have_content 'bug' + page.within '.manage-labels-list' do + expect(page).to have_content 'bug' end end step 'I should not see label \'bug\'' do - within '.manage-labels-list' do - page.should_not have_content 'bug' + page.within '.manage-labels-list' do + expect(page).not_to have_content 'bug' end end step 'I should see label \'support\'' do - within '.manage-labels-list' do - page.should have_content 'support' + page.within '.manage-labels-list' do + expect(page).to have_content 'support' end end @@ -90,8 +90,8 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps end step 'I should see label \'fix\'' do - within '.manage-labels-list' do - page.should have_content 'fix' + page.within '.manage-labels-list' do + expect(page).to have_content 'fix' end end diff --git a/features/steps/project/issues/milestones.rb b/features/steps/project/issues/milestones.rb index cce87a6d98..708c524394 100644 --- a/features/steps/project/issues/milestones.rb +++ b/features/steps/project/issues/milestones.rb @@ -6,9 +6,9 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps step 'I should see milestone "v2.2"' do milestone = @project.milestones.find_by(title: "v2.2") - page.should have_content(milestone.title[0..10]) - page.should have_content(milestone.expires_at) - page.should have_content("Issues") + expect(page).to have_content(milestone.title[0..10]) + expect(page).to have_content(milestone.expires_at) + expect(page).to have_content("Issues") end step 'I click link "v2.2"' do @@ -26,9 +26,9 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps step 'I should see milestone "v2.3"' do milestone = @project.milestones.find_by(title: "v2.3") - page.should have_content(milestone.title[0..10]) - page.should have_content(milestone.expires_at) - page.should have_content("Issues") + expect(page).to have_content(milestone.title[0..10]) + expect(page).to have_content(milestone.expires_at) + expect(page).to have_content("Issues") end step 'project "Shop" has milestone "v2.2"' do @@ -54,6 +54,6 @@ class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps end step 'I should see 3 issues' do - page.should have_selector('#tab-issues li.issue-row', count: 4) + expect(page).to have_selector('#tab-issues li.issue-row', count: 4) end end diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index 7f4c28db47..6ce8a324c9 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -24,44 +24,44 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I should see merge request "Wiki Feature"' do - within '.merge-request' do - page.should have_content "Wiki Feature" + page.within '.merge-request' do + expect(page).to have_content "Wiki Feature" end end step 'I should see closed merge request "Bug NS-04"' do merge_request = MergeRequest.find_by!(title: "Bug NS-04") - merge_request.closed?.should be_true - page.should have_content "Rejected by" + expect(merge_request.closed?).to be_true + expect(page).to have_content "Rejected by" end step 'I should see merge request "Bug NS-04"' do - page.should have_content "Bug NS-04" + expect(page).to have_content "Bug NS-04" end step 'I should see "Bug NS-04" in merge requests' do - page.should have_content "Bug NS-04" + expect(page).to have_content "Bug NS-04" end step 'I should see "Feature NS-03" in merge requests' do - page.should have_content "Feature NS-03" + expect(page).to have_content "Feature NS-03" end step 'I should not see "Feature NS-03" in merge requests' do - page.should_not have_content "Feature NS-03" + expect(page).not_to have_content "Feature NS-03" end step 'I should not see "Bug NS-04" in merge requests' do - page.should_not have_content "Bug NS-04" + expect(page).not_to have_content "Bug NS-04" end step 'I should see that I am subscribed' do - find(".subscribe-button span").text.should == "Unsubscribe" + expect(find(".subscribe-button span").text).to eq "Unsubscribe" end step 'I should see that I am unsubscribed' do - find(".subscribe-button span").should have_content("Subscribe") + expect(find(".subscribe-button span")).to have_content("Subscribe") end step 'I click button "Unsubscribe"' do @@ -113,7 +113,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I click on the Changes tab via Javascript' do - within '.merge-request-tabs' do + page.within '.merge-request-tabs' do click_link 'Changes' end @@ -121,11 +121,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I should see the proper Inline and Side-by-side links' do - buttons = all('#commit-diff-viewtype') + buttons = page.all('#commit-diff-viewtype') expect(buttons.count).to eq(2) buttons.each do |b| - expect(b['href']).should_not have_content('json') + expect(expect(b['href'])).not_to have_content('json') end end @@ -134,11 +134,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I click on the commit in the merge request' do - within '.merge-request-tabs' do + page.within '.merge-request-tabs' do click_link 'Commits' end - within '.commits' do + page.within '.commits' do click_link Commit.truncate_sha(sample_commit.id) end end @@ -164,24 +164,24 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I should see a discussion has started on diff' do - page.should have_content "#{current_user.name} started a discussion" - page.should have_content sample_commit.line_code_path - page.should have_content "Line is wrong" + expect(page).to have_content "#{current_user.name} started a discussion" + expect(page).to have_content sample_commit.line_code_path + expect(page).to have_content "Line is wrong" end step 'I should see a discussion has started on commit diff' do - page.should have_content "#{current_user.name} started a discussion on commit" - page.should have_content sample_commit.line_code_path - page.should have_content "Line is wrong" + expect(page).to have_content "#{current_user.name} started a discussion on commit" + expect(page).to have_content sample_commit.line_code_path + expect(page).to have_content "Line is wrong" end step 'I should see a discussion has started on commit' do - page.should have_content "#{current_user.name} started a discussion on commit" - page.should have_content "One comment to rule them all" + expect(page).to have_content "#{current_user.name} started a discussion on commit" + expect(page).to have_content "One comment to rule them all" end step 'merge request is mergeable' do - page.should have_button 'Accept Merge Request' + expect(page).to have_button 'Accept Merge Request' end step 'I modify merge commit message' do @@ -190,6 +190,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'merge request "Bug NS-05" is mergeable' do + merge_request.project.satellite.create merge_request.mark_as_mergeable end @@ -198,14 +199,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps merge!: true, ) - within '.can_be_merged' do + page.within '.mr-state-widget' do click_button "Accept Merge Request" end end step 'I should see merged request' do - within '.issue-box' do - page.should have_content "Accepted" + page.within '.issue-box' do + expect(page).to have_content "Accepted" end end @@ -214,72 +215,72 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I should see reopened merge request "Bug NS-04"' do - within '.issue-box' do - page.should have_content "Open" + page.within '.issue-box' do + expect(page).to have_content "Open" end end step 'I click link "Hide inline discussion" of the second file' do - within '.files [id^=diff]:nth-child(2)' do + page.within '.files [id^=diff]:nth-child(2)' do find('.js-toggle-diff-comments').click end end step 'I click link "Show inline discussion" of the second file' do - within '.files [id^=diff]:nth-child(2)' do + page.within '.files [id^=diff]:nth-child(2)' do find('.js-toggle-diff-comments').click end end step 'I should not see a comment like "Line is wrong" in the second file' do - within '.files [id^=diff]:nth-child(2)' do - page.should_not have_visible_content "Line is wrong" + page.within '.files [id^=diff]:nth-child(2)' do + expect(page).not_to have_visible_content "Line is wrong" end end step 'I should see a comment like "Line is wrong" in the second file' do - within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do - page.should have_visible_content "Line is wrong" + page.within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do + expect(page).to have_visible_content "Line is wrong" end end step 'I should not see a comment like "Line is wrong here" in the second file' do - within '.files [id^=diff]:nth-child(2)' do - page.should_not have_visible_content "Line is wrong here" + page.within '.files [id^=diff]:nth-child(2)' do + expect(page).not_to have_visible_content "Line is wrong here" end end step 'I should see a comment like "Line is wrong here" in the second file' do - within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do - page.should have_visible_content "Line is wrong here" + page.within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do + expect(page).to have_visible_content "Line is wrong here" end end step 'I leave a comment like "Line is correct" on line 12 of the first file' do init_diff_note_first_file - within(".js-discussion-note-form") do + page.within(".js-discussion-note-form") do fill_in "note_note", with: "Line is correct" click_button "Add Comment" end - within ".files [id^=diff]:nth-child(1) .note-body > .note-text" do - page.should have_content "Line is correct" + page.within ".files [id^=diff]:nth-child(1) .note-body > .note-text" do + expect(page).to have_content "Line is correct" end end step 'I leave a comment like "Line is wrong" on line 39 of the second file' do init_diff_note_second_file - within(".js-discussion-note-form") do + page.within(".js-discussion-note-form") do fill_in "note_note", with: "Line is wrong on here" click_button "Add Comment" end end step 'I should still see a comment like "Line is correct" in the first file' do - within '.files [id^=diff]:nth-child(1) .note-body > .note-text' do - page.should have_visible_content "Line is correct" + page.within '.files [id^=diff]:nth-child(1) .note-body > .note-text' do + expect(page).to have_visible_content "Line is correct" end end @@ -306,8 +307,8 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I should see comments on the side-by-side diff page' do - within '.files [id^=diff]:nth-child(1) .parallel .note-body > .note-text' do - page.should have_visible_content "Line is correct" + page.within '.files [id^=diff]:nth-child(1) .parallel .note-body > .note-text' do + expect(page).to have_visible_content "Line is correct" end end @@ -325,29 +326,32 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I should see new target branch changes' do - page.should have_content 'From fix into feature' - page.should have_content 'Target branch changed from master to feature' + expect(page).to have_content 'From fix into feature' + expect(page).to have_content 'Target branch changed from master to feature' end step 'merge request \'Bug NS-04\' must be approved' do merge_request = MergeRequest.find_by!(title: "Bug NS-04") project = merge_request.target_project project.approvals_before_merge = 1 + project.ensure_satellite_exists project.save! end step 'I click link "Approve"' do - click_button 'Approve Merge Request' + within '.mr-state-widget' do + click_button 'Approve Merge Request' + end end step 'I should not see merge button' do - within '.can_be_merged' do + within '.mr-state-widget' do page.should_not have_button("Accept Merge Request") end end step 'I should see approved merge request "Bug NS-04"' do - within '.can_be_merged' do + within '.mr-state-widget' do page.should have_button("Accept Merge Request") end end @@ -361,12 +365,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end def leave_comment(message) - within(".js-discussion-note-form") do + page.within(".js-discussion-note-form") do fill_in "note_note", with: message click_button "Add Comment" end - page.should have_content message + expect(page).to have_content message end def init_diff_note_first_file diff --git a/features/steps/project/network_graph.rb b/features/steps/project/network_graph.rb index a15688ace6..992cf2734f 100644 --- a/features/steps/project/network_graph.rb +++ b/features/steps/project/network_graph.rb @@ -4,7 +4,7 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps include SharedProject step 'page should have network graph' do - page.should have_selector ".network-graph" + expect(page).to have_selector ".network-graph" end When 'I visit project "Shop" network page' do @@ -16,16 +16,16 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps end step 'page should select "master" in select box' do - page.should have_selector '.select2-chosen', text: "master" + expect(page).to have_selector '.select2-chosen', text: "master" end step 'page should select "v1.0.0" in select box' do - page.should have_selector '.select2-chosen', text: "v1.0.0" + expect(page).to have_selector '.select2-chosen', text: "v1.0.0" end step 'page should have "master" on graph' do - within '.network-graph' do - page.should have_content 'master' + page.within '.network-graph' do + expect(page).to have_content 'master' end end @@ -45,33 +45,33 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps end step 'page should have content not containing "v1.0.0"' do - within '.network-graph' do - page.should have_content 'Change some files' + page.within '.network-graph' do + expect(page).to have_content 'Change some files' end end step 'page should not have content not containing "v1.0.0"' do - within '.network-graph' do - page.should_not have_content 'Change some files' + page.within '.network-graph' do + expect(page).not_to have_content 'Change some files' end end step 'page should select "feature" in select box' do - page.should have_selector '.select2-chosen', text: "feature" + expect(page).to have_selector '.select2-chosen', text: "feature" end step 'page should select "v1.0.0" in select box' do - page.should have_selector '.select2-chosen', text: "v1.0.0" + expect(page).to have_selector '.select2-chosen', text: "v1.0.0" end step 'page should have "feature" on graph' do - within '.network-graph' do - page.should have_content 'feature' + page.within '.network-graph' do + expect(page).to have_content 'feature' end end When 'I looking for a commit by SHA of "v1.0.0"' do - within ".network-form" do + page.within ".network-form" do fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' find('button').click end @@ -79,13 +79,13 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps end step 'page should have "v1.0.0" on graph' do - within '.network-graph' do - page.should have_content 'v1.0.0' + page.within '.network-graph' do + expect(page).to have_content 'v1.0.0' end end When 'I look for a commit by ";"' do - within ".network-form" do + page.within ".network-form" do fill_in 'extended_sha1', with: ';' find('button').click end diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index 6bb5edf147..fbc3e3757e 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -14,9 +14,9 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should see project with new settings' do - find_field('project_name').value.should == 'NewName' - find('#project_issues_enabled').should_not be_checked - find('#project_merge_requests_enabled').should be_checked + expect(find_field('project_name').value).to eq 'NewName' + expect(find('#project_issues_enabled')).to_not be_checked + expect(find('#project_merge_requests_enabled')).to be_checked end step 'change project path settings' do @@ -25,7 +25,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should see project with new path settings' do - project.path.should == 'new-path' + expect(project.path).to eq 'new-path' end step 'I change the project avatar' do @@ -38,13 +38,13 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should see new project avatar' do - @project.avatar.should be_instance_of AvatarUploader + expect(@project.avatar).to be_instance_of AvatarUploader url = @project.avatar.url - url.should == "/uploads/project/avatar/#{ @project.id }/gitlab_logo.png" + expect(url).to eq "/uploads/project/avatar/#{ @project.id }/gitlab_logo.png" end step 'I should see the "Remove avatar" button' do - page.should have_link('Remove avatar') + expect(page).to have_link('Remove avatar') end step 'I have an project avatar' do @@ -62,11 +62,11 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should see the default project avatar' do - @project.avatar?.should be_false + expect(@project.avatar?).to be_false end step 'I should not see the "Remove avatar" button' do - page.should_not have_link('Remove avatar') + expect(page).not_to have_link('Remove avatar') end step 'I fill in merge request template' do @@ -84,8 +84,8 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should see project "Shop" version' do - within '.project-side' do - page.should have_content '6.7.0.pre' + page.within '.project-side' do + expect(page).to have_content '6.7.0.pre' end end @@ -95,7 +95,7 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should see project default branch changed' do - find(:css, 'select#project_default_branch').value.should == 'fix' + expect(find(:css, 'select#project_default_branch').value).to eq 'fix' end step 'I select project "Forum" README tab' do @@ -103,13 +103,13 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should see project "Forum" README' do - page.should have_link 'README.md' - page.should have_content 'Sample repo for testing gitlab features' + expect(page).to have_link 'README.md' + expect(page).to have_content 'Sample repo for testing gitlab features' end step 'I should see project "Shop" README' do - page.should have_link 'README.md' - page.should have_content 'testme' + expect(page).to have_link 'README.md' + expect(page).to have_content 'testme' end step 'gitlab user "Pete"' do @@ -164,14 +164,14 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should not see "New Issue" button' do - page.should_not have_link 'New Issue' + expect(page).not_to have_link 'New Issue' end step 'I should not see "New Merge Request" button' do - page.should_not have_link 'New Merge Request' + expect(page).not_to have_link 'New Merge Request' end step 'I should not see "Snippets" button' do - page.should_not have_link 'Snippets' + expect(page).not_to have_link 'Snippets' end end diff --git a/features/steps/project/redirects.rb b/features/steps/project/redirects.rb index 57c6e39c80..0e724138a8 100644 --- a/features/steps/project/redirects.rb +++ b/features/steps/project/redirects.rb @@ -18,8 +18,8 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps step 'I should see project "Community" home page' do Gitlab.config.gitlab.should_receive(:host).and_return("www.example.com") - within '.navbar-gitlab .title' do - page.should have_content 'Community' + page.within '.navbar-gitlab .title' do + expect(page).to have_content 'Community' end end @@ -48,8 +48,8 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps step 'I should be redirected to "Community" page' do project = Project.find_by(name: 'Community') - current_path.should == "/#{project.path_with_namespace}" - status_code.should == 200 + expect(current_path).to eq "/#{project.path_with_namespace}" + expect(status_code).to eq 200 end step 'I get redirected to signin page where I sign in' do @@ -63,7 +63,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps step 'I should be redirected to "Enterprise" page' do project = Project.find_by(name: 'Enterprise') - current_path.should == "/#{project.path_with_namespace}" - status_code.should == 200 + expect(current_path).to eq "/#{project.path_with_namespace}" + expect(status_code).to eq 200 end end diff --git a/features/steps/project/services.rb b/features/steps/project/services.rb index 10499ba3cd..06742a2c78 100644 --- a/features/steps/project/services.rb +++ b/features/steps/project/services.rb @@ -8,16 +8,16 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see list of available services' do - page.should have_content 'Project services' - page.should have_content 'Campfire' - page.should have_content 'HipChat' - page.should have_content 'GitLab CI' - page.should have_content 'Assembla' - page.should have_content 'Pushover' - page.should have_content 'Atlassian Bamboo' - page.should have_content 'JetBrains TeamCity' - page.should have_content 'Asana' - page.should have_content 'Irker (IRC gateway)' + expect(page).to have_content 'Project services' + expect(page).to have_content 'Campfire' + expect(page).to have_content 'HipChat' + expect(page).to have_content 'GitLab CI' + expect(page).to have_content 'Assembla' + expect(page).to have_content 'Pushover' + expect(page).to have_content 'Atlassian Bamboo' + expect(page).to have_content 'JetBrains TeamCity' + expect(page).to have_content 'Asana' + expect(page).to have_content 'Irker (IRC gateway)' end step 'I click gitlab-ci service link' do @@ -32,7 +32,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see service settings saved' do - find_field('Project url').value.should == 'http://ci.gitlab.org/projects/3' + expect(find_field('Project url').value).to eq 'http://ci.gitlab.org/projects/3' end step 'I click hipchat service link' do @@ -47,7 +47,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see hipchat service settings saved' do - find_field('Room').value.should == 'gitlab' + expect(find_field('Room').value).to eq 'gitlab' end step 'I fill hipchat settings with custom server' do @@ -59,7 +59,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see hipchat service settings with custom server saved' do - find_field('Server').value.should == 'https://chat.example.com' + expect(find_field('Server').value).to eq 'https://chat.example.com' end step 'I click pivotaltracker service link' do @@ -73,7 +73,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see pivotaltracker service settings saved' do - find_field('Token').value.should == 'verySecret' + expect(find_field('Token').value).to eq 'verySecret' end step 'I click Flowdock service link' do @@ -87,7 +87,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see Flowdock service settings saved' do - find_field('Token').value.should == 'verySecret' + expect(find_field('Token').value).to eq 'verySecret' end step 'I click Assembla service link' do @@ -101,7 +101,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see Assembla service settings saved' do - find_field('Token').value.should == 'verySecret' + expect(find_field('Token').value).to eq 'verySecret' end step 'I click Asana service link' do @@ -116,8 +116,8 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see Asana service settings saved' do - find_field('Api key').value.should == 'verySecret' - find_field('Restrict to branch').value.should == 'master' + expect(find_field('Api key').value).to eq 'verySecret' + expect(find_field('Restrict to branch').value).to eq 'master' end step 'I click email on push service link' do @@ -130,7 +130,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see email on push service settings saved' do - find_field('Recipients').value.should == 'qa@company.name' + expect(find_field('Recipients').value).to eq 'qa@company.name' end step 'I click Irker service link' do @@ -145,8 +145,8 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see Irker service settings saved' do - find_field('Recipients').value.should == 'irc://chat.freenode.net/#commits' - find_field('Colorize messages').value.should == '1' + expect(find_field('Recipients').value).to eq 'irc://chat.freenode.net/#commits' + expect(find_field('Colorize messages').value).to eq '1' end step 'I click Slack service link' do @@ -160,7 +160,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see Slack service settings saved' do - find_field('Webhook').value.should == 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685' + expect(find_field('Webhook').value).to eq 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685' end step 'I click Pushover service link' do @@ -178,11 +178,11 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see Pushover service settings saved' do - find_field('Api key').value.should == 'verySecret' - find_field('User key').value.should == 'verySecret' - find_field('Device').value.should == 'myDevice' - find_field('Priority').find('option[selected]').value.should == '1' - find_field('Sound').find('option[selected]').value.should == 'bike' + expect(find_field('Api key').value).to eq 'verySecret' + expect(find_field('User key').value).to eq 'verySecret' + expect(find_field('Device').value).to eq 'myDevice' + expect(find_field('Priority').find('option[selected]').value).to eq '1' + expect(find_field('Sound').find('option[selected]').value).to eq 'bike' end step 'I click jira service link' do @@ -218,9 +218,9 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see Atlassian Bamboo CI service settings saved' do - find_field('Bamboo url').value.should == 'http://bamboo.example.com' - find_field('Build key').value.should == 'KEY' - find_field('Username').value.should == 'user' + expect(find_field('Bamboo url').value).to eq 'http://bamboo.example.com' + expect(find_field('Build key').value).to eq 'KEY' + expect(find_field('Username').value).to eq 'user' end step 'I click JetBrains TeamCity CI service link' do @@ -237,8 +237,8 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps end step 'I should see JetBrains TeamCity CI service settings saved' do - find_field('Teamcity url').value.should == 'http://teamcity.example.com' - find_field('Build type').value.should == 'GitlabTest_Build' - find_field('Username').value.should == 'user' + expect(find_field('Teamcity url').value).to eq 'http://teamcity.example.com' + expect(find_field('Build type').value).to eq 'GitlabTest_Build' + expect(find_field('Username').value).to eq 'user' end end diff --git a/features/steps/project/snippets.rb b/features/steps/project/snippets.rb index 343aeb53b1..eedb4e1b74 100644 --- a/features/steps/project/snippets.rb +++ b/features/steps/project/snippets.rb @@ -30,19 +30,19 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps end step 'I should see "Snippet one" in snippets' do - page.should have_content "Snippet one" + expect(page).to have_content "Snippet one" end step 'I should not see "Snippet two" in snippets' do - page.should_not have_content "Snippet two" + expect(page).not_to have_content "Snippet two" end step 'I should not see "Snippet one" in snippets' do - page.should_not have_content "Snippet one" + expect(page).not_to have_content "Snippet one" end step 'I click link "Edit"' do - within ".file-title" do + page.within ".file-title" do click_link "Edit" end end @@ -54,15 +54,15 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps step 'I submit new snippet "Snippet three"' do fill_in "project_snippet_title", :with => "Snippet three" fill_in "project_snippet_file_name", :with => "my_snippet.rb" - within('.file-editor') do + page.within('.file-editor') do find(:xpath, "//input[@id='project_snippet_content']").set 'Content of snippet three' end click_button "Create snippet" end step 'I should see snippet "Snippet three"' do - page.should have_content "Snippet three" - page.should have_content "Content of snippet three" + expect(page).to have_content "Snippet three" + expect(page).to have_content "Content of snippet three" end step 'I submit new title "Snippet new title"' do @@ -71,18 +71,18 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps end step 'I should see "Snippet new title"' do - page.should have_content "Snippet new title" + expect(page).to have_content "Snippet new title" end step 'I leave a comment like "Good snippet!"' do - within('.js-main-target-form') do + page.within('.js-main-target-form') do fill_in "note_note", with: "Good snippet!" click_button "Add Comment" end end step 'I should see comment "Good snippet!"' do - page.should have_content "Good snippet!" + expect(page).to have_content "Good snippet!" end step 'I visit snippet page "Snippet one"' do diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index caf6c73ee0..398c9bf575 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -5,23 +5,23 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps include RepoHelpers step 'I should see files from repository' do - page.should have_content "VERSION" - page.should have_content ".gitignore" - page.should have_content "LICENSE" + expect(page).to have_content "VERSION" + expect(page).to have_content ".gitignore" + expect(page).to have_content "LICENSE" end step 'I should see files from repository for "6d39438"' do - current_path.should == namespace_project_tree_path(@project.namespace, @project, "6d39438") - page.should have_content ".gitignore" - page.should have_content "LICENSE" + expect(current_path).to eq namespace_project_tree_path(@project.namespace, @project, "6d39438") + expect(page).to have_content ".gitignore" + expect(page).to have_content "LICENSE" end step 'I see the ".gitignore"' do - page.should have_content '.gitignore' + expect(page).to have_content '.gitignore' end step 'I don\'t see the ".gitignore"' do - page.should_not have_content '.gitignore' + expect(page).not_to have_content '.gitignore' end step 'I click on ".gitignore" file in repo' do @@ -29,11 +29,11 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I should see its content' do - page.should have_content old_gitignore_content + expect(page).to have_content old_gitignore_content end step 'I should see its new content' do - page.should have_content new_gitignore_content + expect(page).to have_content new_gitignore_content end step 'I click link "Raw"' do @@ -41,7 +41,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I should see raw file content' do - source.should == sample_blob.data + expect(source).to eq sample_blob.data end step 'I click button "Edit"' do @@ -49,16 +49,16 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I cannot see the edit button' do - page.should_not have_link 'edit' + expect(page).not_to have_link 'edit' end step 'The edit button is disabled' do - page.should have_css '.disabled', text: 'Edit' + expect(page).to have_css '.disabled', text: 'Edit' end step 'I can edit code' do set_new_content - evaluate_script('blob.editor.getValue()').should == new_gitignore_content + expect(evaluate_script('blob.editor.getValue()')).to eq new_gitignore_content end step 'I edit code' do @@ -98,7 +98,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I see diff' do - page.should have_css '.line_holder.new' + expect(page).to have_css '.line_holder.new' end step 'I click on "new file" link in repo' do @@ -106,8 +106,8 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I can see new file page' do - page.should have_content "New file" - page.should have_content "Commit message" + expect(page).to have_content "New file" + expect(page).to have_content "Commit message" end step 'I click on files directory' do @@ -119,25 +119,25 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I see Browse dir link' do - page.should have_link 'Browse Dir »' - page.should_not have_link 'Browse Code »' + expect(page).to have_link 'Browse Dir »' + expect(page).not_to have_link 'Browse Code »' end step 'I click on readme file' do - within '.tree-table' do + page.within '.tree-table' do click_link 'README.md' end end step 'I see Browse file link' do - page.should have_link 'Browse File »' - page.should_not have_link 'Browse Code »' + expect(page).to have_link 'Browse File »' + expect(page).not_to have_link 'Browse Code »' end step 'I see Browse code link' do - page.should have_link 'Browse Code »' - page.should_not have_link 'Browse File »' - page.should_not have_link 'Browse Dir »' + expect(page).to have_link 'Browse Code »' + expect(page).not_to have_link 'Browse File »' + expect(page).not_to have_link 'Browse Dir »' end step 'I click on Permalink' do @@ -145,7 +145,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I am redirected to the files URL' do - current_path.should == namespace_project_tree_path(@project.namespace, @project, 'master') + expect(current_path).to eq namespace_project_tree_path(@project.namespace, @project, 'master') end step 'I am redirected to the ".gitignore"' do diff --git a/features/steps/project/source/git_blame.rb b/features/steps/project/source/git_blame.rb index e29a816c51..d0a27f47e2 100644 --- a/features/steps/project/source/git_blame.rb +++ b/features/steps/project/source/git_blame.rb @@ -12,8 +12,8 @@ class Spinach::Features::ProjectSourceGitBlame < Spinach::FeatureSteps end step 'I should see git file blame' do - page.should have_content "*.rb" - page.should have_content "Dmitriy Zaporozhets" - page.should have_content "Initial commit" + expect(page).to have_content "*.rb" + expect(page).to have_content "Dmitriy Zaporozhets" + expect(page).to have_content "Initial commit" end end diff --git a/features/steps/project/source/markdown_render.rb b/features/steps/project/source/markdown_render.rb index 7961fdedad..c78e86fa1a 100644 --- a/features/steps/project/source/markdown_render.rb +++ b/features/steps/project/source/markdown_render.rb @@ -13,19 +13,19 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I should see files from repository in markdown' do - current_path.should == namespace_project_tree_path(@project.namespace, @project, "markdown") - page.should have_content "README.md" - page.should have_content "CHANGELOG" + expect(current_path).to eq namespace_project_tree_path(@project.namespace, @project, "markdown") + expect(page).to have_content "README.md" + expect(page).to have_content "CHANGELOG" end step 'I should see rendered README which contains correct links' do - page.should have_content "Welcome to GitLab GitLab is a free project and repository management application" - page.should have_link "GitLab API doc" - page.should have_link "GitLab API website" - page.should have_link "Rake tasks" - page.should have_link "backup and restore procedure" - page.should have_link "GitLab API doc directory" - page.should have_link "Maintenance" + expect(page).to have_content "Welcome to GitLab GitLab is a free project and repository management application" + expect(page).to have_link "GitLab API doc" + expect(page).to have_link "GitLab API website" + expect(page).to have_link "Rake tasks" + expect(page).to have_link "backup and restore procedure" + expect(page).to have_link "GitLab API doc directory" + expect(page).to have_link "Maintenance" end step 'I click on Gitlab API in README' do @@ -33,8 +33,8 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I should see correct document rendered' do - current_path.should == namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") - page.should have_content "All API requests require authentication" + expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") + expect(page).to have_content "All API requests require authentication" end step 'I click on Rake tasks in README' do @@ -42,9 +42,9 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I should see correct directory rendered' do - current_path.should == namespace_project_tree_path(@project.namespace, @project, "markdown/doc/raketasks") - page.should have_content "backup_restore.md" - page.should have_content "maintenance.md" + expect(current_path).to eq namespace_project_tree_path(@project.namespace, @project, "markdown/doc/raketasks") + expect(page).to have_content "backup_restore.md" + expect(page).to have_content "maintenance.md" end step 'I click on GitLab API doc directory in README' do @@ -52,9 +52,9 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I should see correct doc/api directory rendered' do - current_path.should == namespace_project_tree_path(@project.namespace, @project, "markdown/doc/api") - page.should have_content "README.md" - page.should have_content "users.md" + expect(current_path).to eq namespace_project_tree_path(@project.namespace, @project, "markdown/doc/api") + expect(page).to have_content "README.md" + expect(page).to have_content "users.md" end step 'I click on Maintenance in README' do @@ -62,41 +62,41 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I should see correct maintenance file rendered' do - current_path.should == namespace_project_blob_path(@project.namespace, @project, "markdown/doc/raketasks/maintenance.md") - page.should have_content "bundle exec rake gitlab:env:info RAILS_ENV=production" + expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/raketasks/maintenance.md") + expect(page).to have_content "bundle exec rake gitlab:env:info RAILS_ENV=production" end step 'I click on link "empty" in the README' do - within('.readme-holder') do + page.within('.readme-holder') do click_link "empty" end end step 'I click on link "id" in the README' do - within('.readme-holder') do + page.within('.readme-holder') do click_link "#id" end end step 'I navigate to the doc/api/README' do - within '.tree-table' do + page.within '.tree-table' do click_link "doc" end - within '.tree-table' do + page.within '.tree-table' do click_link "api" end - within '.tree-table' do + page.within '.tree-table' do click_link "README.md" end end step 'I see correct file rendered' do - current_path.should == namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") - page.should have_content "Contents" - page.should have_link "Users" - page.should have_link "Rake tasks" + expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") + expect(page).to have_content "Contents" + expect(page).to have_link "Users" + expect(page).to have_link "Rake tasks" end step 'I click on users in doc/api/README' do @@ -104,8 +104,8 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I should see the correct document file' do - current_path.should == namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/users.md") - page.should have_content "Get a list of users." + expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/users.md") + expect(page).to have_content "Get a list of users." end step 'I click on raketasks in doc/api/README' do @@ -131,32 +131,32 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I should see files from repository in markdown branch' do - current_path.should == namespace_project_tree_path(@project.namespace, @project, "markdown") - page.should have_content "README.md" - page.should have_content "CHANGELOG" + expect(current_path).to eq namespace_project_tree_path(@project.namespace, @project, "markdown") + expect(page).to have_content "README.md" + expect(page).to have_content "CHANGELOG" end step 'I see correct file rendered in markdown branch' do - current_path.should == namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") - page.should have_content "Contents" - page.should have_link "Users" - page.should have_link "Rake tasks" + expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") + expect(page).to have_content "Contents" + expect(page).to have_link "Users" + expect(page).to have_link "Rake tasks" end step 'I should see correct document rendered for markdown branch' do - current_path.should == namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") - page.should have_content "All API requests require authentication" + expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") + expect(page).to have_content "All API requests require authentication" end step 'I should see correct directory rendered for markdown branch' do - current_path.should == namespace_project_tree_path(@project.namespace, @project, "markdown/doc/raketasks") - page.should have_content "backup_restore.md" - page.should have_content "maintenance.md" + expect(current_path).to eq namespace_project_tree_path(@project.namespace, @project, "markdown/doc/raketasks") + expect(page).to have_content "backup_restore.md" + expect(page).to have_content "maintenance.md" end step 'I should see the users document file in markdown branch' do - current_path.should == namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/users.md") - page.should have_content "Get a list of users." + expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/users.md") + expect(page).to have_content "Get a list of users." end # Expected link contents @@ -208,7 +208,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps step 'I go to wiki page' do click_link "Wiki" - current_path.should == namespace_project_wiki_path(@project.namespace, @project, "home") + expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "home") end step 'I add various links to the wiki page' do @@ -218,8 +218,8 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'Wiki page should have added links' do - current_path.should == namespace_project_wiki_path(@project.namespace, @project, "home") - page.should have_content "test GitLab API doc Rake tasks" + expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "home") + expect(page).to have_content "test GitLab API doc Rake tasks" end step 'I add a header to the wiki page' do @@ -237,13 +237,13 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I see new wiki page named test' do - current_path.should == namespace_project_wiki_path(@project.namespace, @project, "test") - page.should have_content "Editing" + expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "test") + expect(page).to have_content "Editing" end When 'I go back to wiki page home' do visit namespace_project_wiki_path(@project.namespace, @project, "home") - current_path.should == namespace_project_wiki_path(@project.namespace, @project, "home") + expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "home") end step 'I click on GitLab API doc link' do @@ -251,8 +251,8 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I see Gitlab API document' do - current_path.should == namespace_project_wiki_path(@project.namespace, @project, "api") - page.should have_content "Editing" + expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "api") + expect(page).to have_content "Editing" end step 'I click on Rake tasks link' do @@ -260,13 +260,13 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I see Rake tasks directory' do - current_path.should == namespace_project_wiki_path(@project.namespace, @project, "raketasks") - page.should have_content "Editing" + expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "raketasks") + expect(page).to have_content "Editing" end step 'I go directory which contains README file' do visit namespace_project_tree_path(@project.namespace, @project, "markdown/doc/api") - current_path.should == namespace_project_tree_path(@project.namespace, @project, "markdown/doc/api") + expect(current_path).to eq namespace_project_tree_path(@project.namespace, @project, "markdown/doc/api") end step 'I click on a relative link in README' do @@ -274,8 +274,8 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end step 'I should see the correct markdown' do - current_path.should == namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/users.md") - page.should have_content "List users" + expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/users.md") + expect(page).to have_content "List users" end step 'Header "Application details" should have correct id and link' do diff --git a/features/steps/project/source/multiselect_blob.rb b/features/steps/project/source/multiselect_blob.rb index b749ba4937..8e14623b89 100644 --- a/features/steps/project/source/multiselect_blob.rb +++ b/features/steps/project/source/multiselect_blob.rb @@ -23,19 +23,19 @@ class Spinach::Features::ProjectSourceMultiselectBlob < Spinach::FeatureSteps pluralization = range.kind_of?(Array) ? "s" : "" step "I should see \"#{fragment}\" as URI fragment" do - URI.parse(current_url).fragment.should == fragment + expect(URI.parse(current_url).fragment).to eq fragment end step "I should see line#{pluralization} #{fragment[1..-1]} highlighted" do ids = Array(range).map { |n| "LC#{n}" } extra = false - highlighted = all("#tree-content-holder .highlight .line.hll") + highlighted = page.all("#tree-content-holder .highlight .line.hll") highlighted.each do |element| extra ||= ids.delete(element[:id]).nil? end - extra.should be_false and ids.should be_empty + expect(extra).to be_false and ids.should be_empty end end end diff --git a/features/steps/project/source/search_code.rb b/features/steps/project/source/search_code.rb index b66c5a4123..feee756d7e 100644 --- a/features/steps/project/source/search_code.rb +++ b/features/steps/project/source/search_code.rb @@ -9,11 +9,11 @@ class Spinach::Features::ProjectSourceSearchCode < Spinach::FeatureSteps end step 'I should see files from repository containing "coffee"' do - page.should have_content 'coffee' - page.should have_content 'CONTRIBUTING.md' + expect(page).to have_content 'coffee' + expect(page).to have_content 'CONTRIBUTING.md' end step 'I should see empty result' do - page.should have_content "We couldn't find any" + expect(page).to have_content "We couldn't find any" end end diff --git a/features/steps/project/star.rb b/features/steps/project/star.rb index 50cdfd73c3..8b50bfcef0 100644 --- a/features/steps/project/star.rb +++ b/features/steps/project/star.rb @@ -5,7 +5,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps include SharedUser step "The project has no stars" do - page.should_not have_content '.star-buttons' + expect(page).not_to have_content '.star-buttons' end step "The project has 0 stars" do @@ -26,7 +26,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps end step 'I redirected to sign in page' do - current_path.should == new_user_session_path + expect(current_path).to eq new_user_session_path end protected diff --git a/features/steps/project/team_management.rb b/features/steps/project/team_management.rb index e01f712c18..2298c4a53f 100644 --- a/features/steps/project/team_management.rb +++ b/features/steps/project/team_management.rb @@ -5,14 +5,14 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps include Select2Helper step 'I should be able to see myself in team' do - page.should have_content(@user.name) - page.should have_content(@user.username) + expect(page).to have_content(@user.name) + expect(page).to have_content(@user.username) end step 'I should see "Dmitriy" in team list' do user = User.find_by(name: "Dmitriy") - page.should have_content(user.name) - page.should have_content(user.username) + expect(page).to have_content(user.name) + expect(page).to have_content(user.username) end step 'I click link "Add members"' do @@ -22,7 +22,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps step 'I select "Mike" as "Reporter"' do user = User.find_by(name: "Mike") - within ".users-project-form" do + page.within ".users-project-form" do select2(user.id, from: "#user_ids", multiple: true) select "Reporter", from: "access_level" end @@ -30,13 +30,13 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps end step 'I should see "Mike" in team list as "Reporter"' do - within ".access-reporter" do - page.should have_content('Mike') + page.within ".access-reporter" do + expect(page).to have_content('Mike') end end step 'I select "sjobs@apple.com" as "Reporter"' do - within ".users-project-form" do + page.within ".users-project-form" do select2("sjobs@apple.com", from: "#user_ids", multiple: true) select "Reporter", from: "access_level" end @@ -44,16 +44,16 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps end step 'I should see "sjobs@apple.com" in team list as invited "Reporter"' do - within ".access-reporter" do - page.should have_content('sjobs@apple.com') - page.should have_content('invited') - page.should have_content('Reporter') + page.within ".access-reporter" do + expect(page).to have_content('sjobs@apple.com') + expect(page).to have_content('invited') + expect(page).to have_content('Reporter') end end step 'I should see "Dmitriy" in team list as "Developer"' do - within ".access-developer" do - page.should have_content('Dmitriy') + page.within ".access-developer" do + expect(page).to have_content('Dmitriy') end end @@ -61,7 +61,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps project = Project.find_by(name: "Shop") user = User.find_by(name: 'Dmitriy') project_member = project.project_members.find_by(user_id: user.id) - within "#project_member_#{project_member.id}" do + page.within "#project_member_#{project_member.id}" do click_button "Edit access level" select "Reporter", from: "project_member_access_level" click_button "Save" @@ -69,8 +69,8 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps end step 'I should see "Dmitriy" in team list as "Reporter"' do - within ".access-reporter" do - page.should have_content('Dmitriy') + page.within ".access-reporter" do + expect(page).to have_content('Dmitriy') end end @@ -80,8 +80,8 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps step 'I should not see "Dmitriy" in team list' do user = User.find_by(name: "Dmitriy") - page.should_not have_content(user.name) - page.should_not have_content(user.username) + expect(page).not_to have_content(user.name) + expect(page).not_to have_content(user.username) end step 'gitlab user "Mike"' do @@ -123,7 +123,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps project = Project.find_by(name: "Shop") user = User.find_by(name: 'Dmitriy') project_member = project.project_members.find_by(user_id: user.id) - within "#project_member_#{project_member.id}" do + page.within "#project_member_#{project_member.id}" do click_link('Remove user from team') end end diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb index 58cb0ceb3f..eebfaee1ed 100644 --- a/features/steps/project/wiki.rb +++ b/features/steps/project/wiki.rb @@ -6,13 +6,13 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps include WikiHelper step 'I click on the Cancel button' do - within(:css, ".form-actions") do + page.within(:css, ".form-actions") do click_on "Cancel" end end step 'I should be redirected back to the Edit Home Wiki page' do - current_path.should == namespace_project_wiki_path(project.namespace, project, :home) + expect(current_path).to eq namespace_project_wiki_path(project.namespace, project, :home) end step 'I create the Wiki Home page' do @@ -21,11 +21,11 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I should see the newly created wiki page' do - page.should have_content "Home" - page.should have_content "link test" + expect(page).to have_content "Home" + expect(page).to have_content "link test" click_link "link test" - page.should have_content "Editing" + expect(page).to have_content "Editing" end step 'I have an existing Wiki page' do @@ -47,11 +47,11 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I should see the updated content' do - page.should have_content "Updated Wiki Content" + expect(page).to have_content "Updated Wiki Content" end step 'I should be redirected back to that Wiki page' do - current_path.should == namespace_project_wiki_path(project.namespace, project, @page) + expect(current_path).to eq namespace_project_wiki_path(project.namespace, project, @page) end step 'That page has two revisions' do @@ -63,9 +63,9 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I should see both revisions' do - page.should have_content current_user.name - page.should have_content "first commit" - page.should have_content "second commit" + expect(page).to have_content current_user.name + expect(page).to have_content "first commit" + expect(page).to have_content "second commit" end step 'I click on the "Delete this page" button' do @@ -73,7 +73,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'The page should be deleted' do - page.should have_content "Page was successfully deleted" + expect(page).to have_content "Page was successfully deleted" end step 'I click on the "Pages" button' do @@ -81,8 +81,8 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I should see the existing page in the pages list' do - page.should have_content current_user.name - page.should have_content @page.title + expect(page).to have_content current_user.name + expect(page).to have_content @page.title end step 'I have an existing Wiki page with images linked on page' do @@ -98,30 +98,30 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps file = Gollum::File.new(wiki.wiki) Gollum::Wiki.any_instance.stub(:file).with("image.jpg", "master", true).and_return(file) Gollum::File.any_instance.stub(:mime_type).and_return("image/jpeg") - page.should have_link('image', href: "image.jpg") + expect(page).to have_link('image', href: "image.jpg") click_on "image" end step 'I should see the image from wiki repo' do - current_path.should match('wikis/image.jpg') - page.should_not have_xpath('/html') # Page should render the image which means there is no html involved + expect(current_path).to match('wikis/image.jpg') + expect(page).not_to have_xpath('/html') # Page should render the image which means there is no html involved Gollum::Wiki.any_instance.unstub(:file) Gollum::File.any_instance.unstub(:mime_type) end step 'Image should be shown on the page' do - page.should have_xpath("//img[@src=\"image.jpg\"]") + expect(page).to have_xpath("//img[@src=\"image.jpg\"]") end step 'I click on image link' do - page.should have_link('image', href: "image.jpg") + expect(page).to have_link('image', href: "image.jpg") click_on "image" end step 'I should see the new wiki page form' do - current_path.should match('wikis/image.jpg') - page.should have_content('New Wiki Page') - page.should have_content('Editing - image.jpg') + expect(current_path).to match('wikis/image.jpg') + expect(page).to have_content('New Wiki Page') + expect(page).to have_content('Editing - image.jpg') end step 'I create a New page with paths' do @@ -130,7 +130,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps click_on 'Build' fill_in "wiki_content", with: 'wiki content' click_on "Create page" - current_path.should include 'one/two/three' + expect(current_path).to include 'one/two/three' end step 'I create a New page with an invalid name' do @@ -144,7 +144,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I should see non-escaped link in the pages list' do - page.should have_xpath("//a[@href='/#{project.path_with_namespace}/wikis/one/two/three']") + expect(page).to have_xpath("//a[@href='/#{project.path_with_namespace}/wikis/one/two/three']") end step 'I edit the Wiki page with a path' do @@ -153,11 +153,11 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I should see a non-escaped path' do - current_path.should include 'one/two/three' + expect(current_path).to include 'one/two/three' end step 'I should see the Editing page' do - page.should have_content('Editing') + expect(page).to have_content('Editing') end step 'I view the page history of a Wiki page that has a path' do @@ -166,7 +166,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I should see the page history' do - page.should have_content('History for') + expect(page).to have_content('History for') end step 'I search for Wiki content' do diff --git a/features/steps/search.rb b/features/steps/search.rb index 8197cd410a..fec5d9f0e4 100644 --- a/features/steps/search.rb +++ b/features/steps/search.rb @@ -24,35 +24,35 @@ class Spinach::Features::Search < Spinach::FeatureSteps end step 'I click "Issues" link' do - within '.search-filter' do + page.within '.search-filter' do click_link 'Issues' end end step 'I click project "Shop" link' do - within '.project-filter' do + page.within '.project-filter' do click_link project.name_with_namespace end end step 'I click "Merge requests" link' do - within '.search-filter' do + page.within '.search-filter' do click_link 'Merge requests' end end step 'I click "Wiki" link' do - within '.search-filter' do + page.within '.search-filter' do click_link 'Wiki' end end step 'I should see "Shop" project link' do - page.should have_link "Shop" + expect(page).to have_link "Shop" end step 'I should see code results for project "Shop"' do - page.should have_content 'Update capybara, rspec-rails, poltergeist to recent versions' + expect(page).to have_content 'Update capybara, rspec-rails, poltergeist to recent versions' end step 'I search for "Contibuting"' do @@ -71,15 +71,15 @@ class Spinach::Features::Search < Spinach::FeatureSteps end step 'I should see "Foo" link in the search results' do - find(:css, '.search-results').should have_link 'Foo' + expect(find(:css, '.search-results')).to have_link 'Foo' end step 'I should not see "Bar" link in the search results' do - find(:css, '.search-results').should_not have_link 'Bar' + expect(find(:css, '.search-results')).not_to have_link 'Bar' end step 'I should see "test_wiki" link in the search results' do - find(:css, '.search-results').should have_link 'test_wiki.md' + expect(find(:css, '.search-results')).to have_link 'test_wiki.md' end step 'project has Wiki content' do diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb index 9beb688bd1..72d873caa5 100644 --- a/features/steps/shared/active_tab.rb +++ b/features/steps/shared/active_tab.rb @@ -2,27 +2,27 @@ module SharedActiveTab include Spinach::DSL def ensure_active_main_tab(content) - find('.nav-sidebar > li.active').should have_content(content) + expect(find('.nav-sidebar > li.active')).to have_content(content) end def ensure_active_sub_tab(content) - find('div.content ul.nav-tabs li.active').should have_content(content) + expect(find('div.content ul.nav-tabs li.active')).to have_content(content) end def ensure_active_sub_nav(content) - find('.sidebar-subnav > li.active').should have_content(content) + expect(find('.sidebar-subnav > li.active')).to have_content(content) end step 'no other main tabs should be active' do - page.should have_selector('.nav-sidebar > li.active', count: 1) + expect(page).to have_selector('.nav-sidebar > li.active', count: 1) end step 'no other sub tabs should be active' do - page.should have_selector('div.content ul.nav-tabs li.active', count: 1) + expect(page).to have_selector('div.content ul.nav-tabs li.active', count: 1) end step 'no other sub navs should be active' do - page.should have_selector('.sidebar-subnav > li.active', count: 1) + expect(page).to have_selector('.sidebar-subnav > li.active', count: 1) end step 'the active main tab should be Home' do diff --git a/features/steps/shared/authentication.rb b/features/steps/shared/authentication.rb index 22d44add04..3ad4de63ea 100644 --- a/features/steps/shared/authentication.rb +++ b/features/steps/shared/authentication.rb @@ -25,7 +25,7 @@ module SharedAuthentication end step 'I should be redirected to sign in page' do - current_path.should == new_user_session_path + expect(current_path).to eq new_user_session_path end step "I logout" do diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index 510e0f0f93..a716ca5837 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -3,7 +3,7 @@ module SharedDiffNote include RepoHelpers step 'I cancel the diff comment' do - within(diff_file_selector) do + page.within(diff_file_selector) do find(".js-close-discussion-note-form").click end end @@ -14,14 +14,14 @@ module SharedDiffNote end step 'I haven\'t written any diff comment text' do - within(diff_file_selector) do + page.within(diff_file_selector) do fill_in "note[note]", with: "" end end step 'I leave a diff comment like "Typo, please fix"' do click_diff_line(sample_commit.line_code) - within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do + page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do fill_in "note[note]", with: "Typo, please fix" find(".js-comment-button").trigger("click") sleep 0.05 @@ -30,7 +30,7 @@ module SharedDiffNote step 'I preview a diff comment text like "Should fix it :smile:"' do click_diff_line(sample_commit.line_code) - within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do + page.within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do fill_in "note[note]", with: "Should fix it :smile:" find('.js-md-preview-button').click end @@ -39,7 +39,7 @@ module SharedDiffNote step 'I preview another diff comment text like "DRY this up"' do click_diff_line(sample_commit.del_line_code) - within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do + page.within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do fill_in "note[note]", with: "DRY this up" find('.js-md-preview-button').click end @@ -54,103 +54,103 @@ module SharedDiffNote end step 'I write a diff comment like ":-1: I don\'t like this"' do - within(diff_file_selector) do + page.within(diff_file_selector) do fill_in "note[note]", with: ":-1: I don\'t like this" end end step 'I submit the diff comment' do - within(diff_file_selector) do + page.within(diff_file_selector) do click_button("Add Comment") end end step 'I should not see the diff comment form' do - within(diff_file_selector) do - page.should_not have_css("form.new_note") + page.within(diff_file_selector) do + expect(page).not_to have_css("form.new_note") end end step 'The diff comment preview tab should say there is nothing to do' do - within(diff_file_selector) do + page.within(diff_file_selector) do find('.js-md-preview-button').click expect(find('.js-md-preview')).to have_content('Nothing to preview.') end end step 'I should not see the diff comment text field' do - within(diff_file_selector) do + page.within(diff_file_selector) do expect(find('.js-note-text')).not_to be_visible end end step 'I should only see one diff form' do - within(diff_file_selector) do - page.should have_css("form.new_note", count: 1) + page.within(diff_file_selector) do + expect(page).to have_css("form.new_note", count: 1) end end step 'I should see a diff comment form with ":-1: I don\'t like this"' do - within(diff_file_selector) do - page.should have_field("note[note]", with: ":-1: I don\'t like this") + page.within(diff_file_selector) do + expect(page).to have_field("note[note]", with: ":-1: I don\'t like this") end end step 'I should see a diff comment saying "Typo, please fix"' do - within("#{diff_file_selector} .note") do - page.should have_content("Typo, please fix") + page.within("#{diff_file_selector} .note") do + expect(page).to have_content("Typo, please fix") end end step 'I should see a discussion reply button' do - within(diff_file_selector) do - page.should have_button('Reply') + page.within(diff_file_selector) do + expect(page).to have_button('Reply') end end step 'I should see a temporary diff comment form' do - within(diff_file_selector) do - page.should have_css(".js-temp-notes-holder form.new_note") + page.within(diff_file_selector) do + expect(page).to have_css(".js-temp-notes-holder form.new_note") end end step 'I should see add a diff comment button' do - page.should have_css('.js-add-diff-note-button', visible: true) + expect(page).to have_css('.js-add-diff-note-button', visible: true) end step 'I should see an empty diff comment form' do - within(diff_file_selector) do - page.should have_field("note[note]", with: "") + page.within(diff_file_selector) do + expect(page).to have_field("note[note]", with: "") end end step 'I should see the cancel comment button' do - within("#{diff_file_selector} form") do - page.should have_css(".js-close-discussion-note-form", text: "Cancel") + page.within("#{diff_file_selector} form") do + expect(page).to have_css(".js-close-discussion-note-form", text: "Cancel") end end step 'I should see the diff comment preview' do - within("#{diff_file_selector} form") do + page.within("#{diff_file_selector} form") do expect(page).to have_css('.js-md-preview', visible: true) end end step 'I should see the diff comment write tab' do - within(diff_file_selector) do + page.within(diff_file_selector) do expect(page).to have_css('.js-md-write-button', visible: true) end end step 'The diff comment preview tab should display rendered Markdown' do - within(diff_file_selector) do + page.within(diff_file_selector) do find('.js-md-preview-button').click expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) end end step 'I should see two separate previews' do - within(diff_file_selector) do + page.within(diff_file_selector) do expect(page).to have_css('.js-md-preview', visible: true, count: 2) expect(page).to have_content('Should fix it') expect(page).to have_content('DRY this up') diff --git a/features/steps/shared/group.rb b/features/steps/shared/group.rb index 4f9a77283b..aa05548f9b 100644 --- a/features/steps/shared/group.rb +++ b/features/steps/shared/group.rb @@ -26,11 +26,11 @@ module SharedGroup end step 'I should see group "TestGroup"' do - page.should have_content "TestGroup" + expect(page).to have_content "TestGroup" end step 'I should not see group "TestGroup"' do - page.should_not have_content "TestGroup" + expect(page).not_to have_content "TestGroup" end protected diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index 943640007a..56b36f7c46 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -3,11 +3,11 @@ module SharedMarkdown def header_should_have_correct_id_and_link(level, text, id, parent = ".wiki") node = find("#{parent} h#{level} a##{id}") - node[:href].should == "##{id}" + expect(node[:href]).to eq "##{id}" # Work around a weird Capybara behavior where calling `parent` on a node # returns the whole document, not the node's actual parent element - find(:xpath, "#{node.path}/..").text.should == text + expect(find(:xpath, "#{node.path}/..").text).to eq text end step 'Header "Description header" should have correct id and link' do @@ -19,7 +19,7 @@ module SharedMarkdown end step 'The Markdown preview tab should say there is nothing to do' do - within('.gfm-form') do + page.within('.gfm-form') do find('.js-md-preview-button').click expect(find('.js-md-preview')).to have_content('Nothing to preview.') end @@ -38,7 +38,7 @@ module SharedMarkdown end step 'The Markdown preview tab should display rendered Markdown' do - within('.gfm-form') do + page.within('.gfm-form') do find('.js-md-preview-button').click expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) end @@ -49,7 +49,7 @@ module SharedMarkdown end step 'I preview a description text like "Bug fixed :smile:"' do - within('.gfm-form') do + page.within('.gfm-form') do fill_in 'Description', with: 'Bug fixed :smile:' find('.js-md-preview-button').click end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index 2f66e61b21..b2675546a1 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -7,13 +7,13 @@ module SharedNote end step 'I haven\'t written any comment text' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do fill_in "note[note]", with: "" end end step 'I leave a comment like "XML attached"' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do fill_in "note[note]", with: "XML attached" click_button "Add Comment" sleep 0.05 @@ -21,94 +21,94 @@ module SharedNote end step 'I preview a comment text like "Bug fixed :smile:"' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do fill_in "note[note]", with: "Bug fixed :smile:" find('.js-md-preview-button').click end end step 'I submit the comment' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do click_button "Add Comment" end end step 'I write a comment like ":+1: Nice"' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do fill_in 'note[note]', with: ':+1: Nice' end end step 'I should not see a comment saying "XML attached"' do - page.should_not have_css(".note") + expect(page).not_to have_css(".note") end step 'I should not see the cancel comment button' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do should_not have_link("Cancel") end end step 'I should not see the comment preview' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do expect(find('.js-md-preview')).not_to be_visible end end step 'The comment preview tab should say there is nothing to do' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do find('.js-md-preview-button').click expect(find('.js-md-preview')).to have_content('Nothing to preview.') end end step 'I should not see the comment text field' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do expect(find('.js-note-text')).not_to be_visible end end step 'I should see a comment saying "XML attached"' do - within(".note") do - page.should have_content("XML attached") + page.within(".note") do + expect(page).to have_content("XML attached") end end step 'I should see an empty comment text field' do - within(".js-main-target-form") do - page.should have_field("note[note]", with: "") + page.within(".js-main-target-form") do + expect(page).to have_field("note[note]", with: "") end end step 'I should see the comment write tab' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do expect(page).to have_css('.js-md-write-button', visible: true) end end step 'The comment preview tab should be display rendered Markdown' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do find('.js-md-preview-button').click expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) end end step 'I should see the comment preview' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do expect(page).to have_css('.js-md-preview', visible: true) end end step 'I should see comment "XML attached"' do - within(".note") do - page.should have_content("XML attached") + page.within(".note") do + expect(page).to have_content("XML attached") end end # Markdown step 'I leave a comment with a header containing "Comment with a header"' do - within(".js-main-target-form") do + page.within(".js-main-target-form") do fill_in "note[note]", with: "# Comment with a header" click_button "Add Comment" sleep 0.05 @@ -116,9 +116,9 @@ module SharedNote end step 'The comment with the header should not have an ID' do - within(".note-body > .note-text") do - page.should have_content("Comment with a header") - page.should_not have_css("#comment-with-a-header") + page.within(".note-body > .note-text") do + expect(page).to have_content("Comment with a header") + expect(page).not_to have_css("#comment-with-a-header") end end @@ -126,7 +126,7 @@ module SharedNote find(".note").hover find('.js-note-edit').click - within(".current-note-edit-form") do + page.within(".current-note-edit-form") do fill_in 'note[note]', with: '+1 Awesome!' click_button 'Save Comment' sleep 0.05 @@ -134,8 +134,8 @@ module SharedNote end step 'I should see +1 in the description' do - within(".note") do - page.should have_content("+1 Awesome!") + page.within(".note") do + expect(page).to have_content("+1 Awesome!") end end end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index b4b95fe766..67b9ee0246 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -104,7 +104,7 @@ module SharedPaths end step 'I should be redirected to the dashboard groups page' do - current_path.should == dashboard_groups_path + expect(current_path).to eq dashboard_groups_path end step 'I visit dashboard starred projects page' do @@ -255,6 +255,10 @@ module SharedPaths visit namespace_project_merge_requests_path(@project.namespace, @project) end + step "I visit my project's members page" do + visit namespace_project_project_members_path(@project.namespace, @project) + end + step "I visit my project's wiki page" do visit namespace_project_wiki_path(@project.namespace, @project, :home) end @@ -324,11 +328,11 @@ module SharedPaths end step 'I am on the new file page' do - current_path.should eq(namespace_project_create_blob_path(@project.namespace, @project, root_ref)) + expect(current_path).to eq(namespace_project_create_blob_path(@project.namespace, @project, root_ref)) end step 'I am on the ".gitignore" edit file page' do - current_path.should eq(namespace_project_edit_blob_path( + expect(current_path).to eq(namespace_project_edit_blob_path( @project.namespace, @project, File.join(root_ref, '.gitignore'))) end @@ -491,6 +495,6 @@ module SharedPaths # ---------------------------------------- step 'page status code should be 404' do - status_code.should == 404 + expect(status_code).to eq 404 end end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index abb8934119..7803570b81 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -79,13 +79,13 @@ module SharedProject step 'I should see project "Shop" activity feed' do project = Project.find_by(name: "Shop") - page.should have_content "#{@user.name} pushed new branch fix at #{project.name_with_namespace}" + expect(page).to have_content "#{@user.name} pushed new branch fix at #{project.name_with_namespace}" end step 'I should see project settings' do - current_path.should == edit_namespace_project_path(@project.namespace, @project) - page.should have_content("Project name") - page.should have_content("Features:") + expect(current_path).to eq edit_namespace_project_path(@project.namespace, @project) + expect(page).to have_content("Project name") + expect(page).to have_content("Features:") end def current_project @@ -101,11 +101,11 @@ module SharedProject end step 'I should see project "Enterprise"' do - page.should have_content "Enterprise" + expect(page).to have_content "Enterprise" end step 'I should not see project "Enterprise"' do - page.should_not have_content "Enterprise" + expect(page).not_to have_content "Enterprise" end step 'internal project "Internal"' do @@ -113,11 +113,11 @@ module SharedProject end step 'I should see project "Internal"' do - page.should have_content "Internal" + expect(page).to have_content "Internal" end step 'I should not see project "Internal"' do - page.should_not have_content "Internal" + expect(page).not_to have_content "Internal" end step 'public project "Community"' do @@ -125,11 +125,11 @@ module SharedProject end step 'I should see project "Community"' do - page.should have_content "Community" + expect(page).to have_content "Community" end step 'I should not see project "Community"' do - page.should_not have_content "Community" + expect(page).not_to have_content "Community" end step '"John Doe" owns private project "Enterprise"' do diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb index c5aed19331..3b94b7d862 100644 --- a/features/steps/shared/project_tab.rb +++ b/features/steps/shared/project_tab.rb @@ -28,6 +28,10 @@ module SharedProjectTab ensure_active_main_tab('Issues') end + step 'the active main tab should be Members' do + ensure_active_main_tab('Members') + end + step 'the active main tab should be Merge Requests' do ensure_active_main_tab('Merge Requests') end @@ -41,8 +45,8 @@ module SharedProjectTab end step 'the active main tab should be Settings' do - within '.nav-sidebar' do - page.should have_content('Back to project') + page.within '.nav-sidebar' do + expect(page).to have_content('Back to project') end end end diff --git a/features/steps/snippet_search.rb b/features/steps/snippet_search.rb index 669c7186c1..cf99987957 100644 --- a/features/steps/snippet_search.rb +++ b/features/steps/snippet_search.rb @@ -18,39 +18,39 @@ class Spinach::Features::SnippetSearch < Spinach::FeatureSteps end step 'I should see "line seven" in results' do - page.should have_content 'line seven' + expect(page).to have_content 'line seven' end step 'I should see "line four" in results' do - page.should have_content 'line four' + expect(page).to have_content 'line four' end step 'I should see "line ten" in results' do - page.should have_content 'line ten' + expect(page).to have_content 'line ten' end step 'I should not see "line eleven" in results' do - page.should_not have_content 'line eleven' + expect(page).not_to have_content 'line eleven' end step 'I should not see "line three" in results' do - page.should_not have_content 'line three' + expect(page).not_to have_content 'line three' end step 'I should see "Personal snippet one" in results' do - page.should have_content 'Personal snippet one' + expect(page).to have_content 'Personal snippet one' end step 'I should see "Personal snippet private" in results' do - page.should have_content 'Personal snippet private' + expect(page).to have_content 'Personal snippet private' end step 'I should not see "Personal snippet one" in results' do - page.should_not have_content 'Personal snippet one' + expect(page).not_to have_content 'Personal snippet one' end step 'I should not see "Personal snippet private" in results' do - page.should_not have_content 'Personal snippet private' + expect(page).not_to have_content 'Personal snippet private' end end diff --git a/features/steps/snippets/discover.rb b/features/steps/snippets/discover.rb index 2667c1e3d4..76379d09d0 100644 --- a/features/steps/snippets/discover.rb +++ b/features/steps/snippets/discover.rb @@ -4,15 +4,15 @@ class Spinach::Features::SnippetsDiscover < Spinach::FeatureSteps include SharedSnippet step 'I should see "Personal snippet one" in snippets' do - page.should have_content "Personal snippet one" + expect(page).to have_content "Personal snippet one" end step 'I should see "Personal snippet internal" in snippets' do - page.should have_content "Personal snippet internal" + expect(page).to have_content "Personal snippet internal" end step 'I should not see "Personal snippet private" in snippets' do - page.should_not have_content "Personal snippet private" + expect(page).not_to have_content "Personal snippet private" end def snippet diff --git a/features/steps/snippets/public_snippets.rb b/features/steps/snippets/public_snippets.rb index 67669dc0a6..2ebdca5ed3 100644 --- a/features/steps/snippets/public_snippets.rb +++ b/features/steps/snippets/public_snippets.rb @@ -4,11 +4,11 @@ class Spinach::Features::PublicSnippets < Spinach::FeatureSteps include SharedSnippet step 'I should see snippet "Personal snippet one"' do - page.should have_no_xpath("//i[@class='public-snippet']") + expect(page).to have_no_xpath("//i[@class='public-snippet']") end step 'I should see raw snippet "Personal snippet one"' do - page.should have_text(snippet.content) + expect(page).to have_text(snippet.content) end step 'I visit snippet page "Personal snippet one"' do diff --git a/features/steps/snippets/snippets.rb b/features/steps/snippets/snippets.rb index de936db85e..09fdd1b5a1 100644 --- a/features/steps/snippets/snippets.rb +++ b/features/steps/snippets/snippets.rb @@ -9,11 +9,11 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps end step 'I should not see "Personal snippet one" in snippets' do - page.should_not have_content "Personal snippet one" + expect(page).not_to have_content "Personal snippet one" end step 'I click link "Edit"' do - within ".file-title" do + page.within ".file-title" do click_link "Edit" end end @@ -25,15 +25,15 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps step 'I submit new snippet "Personal snippet three"' do fill_in "personal_snippet_title", :with => "Personal snippet three" fill_in "personal_snippet_file_name", :with => "my_snippet.rb" - within('.file-editor') do + page.within('.file-editor') do find(:xpath, "//input[@id='personal_snippet_content']").set 'Content of snippet three' end click_button "Create snippet" end step 'I should see snippet "Personal snippet three"' do - page.should have_content "Personal snippet three" - page.should have_content "Content of snippet three" + expect(page).to have_content "Personal snippet three" + expect(page).to have_content "Content of snippet three" end step 'I submit new title "Personal snippet new title"' do @@ -42,7 +42,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps end step 'I should see "Personal snippet new title"' do - page.should have_content "Personal snippet new title" + expect(page).to have_content "Personal snippet new title" end step 'I uncheck "Private" checkbox' do @@ -51,7 +51,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps end step 'I should see "Personal snippet one" public' do - page.should have_no_xpath("//i[@class='public-snippet']") + expect(page).to have_no_xpath("//i[@class='public-snippet']") end step 'I visit snippet page "Personal snippet one"' do diff --git a/features/steps/snippets/user.rb b/features/steps/snippets/user.rb index 146cc535d8..007fcb2893 100644 --- a/features/steps/snippets/user.rb +++ b/features/steps/snippets/user.rb @@ -8,43 +8,43 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps end step 'I should see "Personal snippet one" in snippets' do - page.should have_content "Personal snippet one" + expect(page).to have_content "Personal snippet one" end step 'I should see "Personal snippet private" in snippets' do - page.should have_content "Personal snippet private" + expect(page).to have_content "Personal snippet private" end step 'I should see "Personal snippet internal" in snippets' do - page.should have_content "Personal snippet internal" + expect(page).to have_content "Personal snippet internal" end step 'I should not see "Personal snippet one" in snippets' do - page.should_not have_content "Personal snippet one" + expect(page).not_to have_content "Personal snippet one" end step 'I should not see "Personal snippet private" in snippets' do - page.should_not have_content "Personal snippet private" + expect(page).not_to have_content "Personal snippet private" end step 'I should not see "Personal snippet internal" in snippets' do - page.should_not have_content "Personal snippet internal" + expect(page).not_to have_content "Personal snippet internal" end step 'I click "Internal" filter' do - within('.nav-tabs') do + page.within('.nav-tabs') do click_link "Internal" end end step 'I click "Private" filter' do - within('.nav-tabs') do + page.within('.nav-tabs') do click_link "Private" end end step 'I click "Public" filter' do - within('.nav-tabs') do + page.within('.nav-tabs') do click_link "Public" end end diff --git a/features/steps/user.rb b/features/steps/user.rb index 8ddce96686..c70875e589 100644 --- a/features/steps/user.rb +++ b/features/steps/user.rb @@ -45,13 +45,13 @@ class Spinach::Features::User < Spinach::FeatureSteps end step 'I should see contributed projects' do - within '.contributed-projects' do - page.should have_content(@contributed_project.name) + page.within '.contributed-projects' do + expect(page).to have_content(@contributed_project.name) end end step 'I should see contributions calendar' do - page.should have_css('.cal-heatmap-container') + expect(page).to have_css('.cal-heatmap-container') end def contributed_project diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index b69aebf9fe..6fa2079d1a 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -46,7 +46,8 @@ module Backup connection = ::Fog::Storage.new(connection_settings) directory = connection.directories.get(remote_directory) - if directory.files.create(key: tar_file, body: File.open(tar_file), public: false) + if directory.files.create(key: tar_file, body: File.open(tar_file), public: false, + multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size) $progress.puts "done".green else puts "uploading backup to #{remote_directory} failed".red diff --git a/lib/gitlab/gitorious_import.rb b/lib/gitlab/gitorious_import.rb new file mode 100644 index 0000000000..8d0132a744 --- /dev/null +++ b/lib/gitlab/gitorious_import.rb @@ -0,0 +1,5 @@ +module Gitlab + module GitoriousImport + GITORIOUS_HOST = "https://gitorious.org" + end +end diff --git a/lib/gitlab/gitorious_import/client.rb b/lib/gitlab/gitorious_import/client.rb index 1fa89dba44..99fe5bdebf 100644 --- a/lib/gitlab/gitorious_import/client.rb +++ b/lib/gitlab/gitorious_import/client.rb @@ -1,7 +1,5 @@ module Gitlab module GitoriousImport - GITORIOUS_HOST = "https://gitorious.org" - class Client attr_reader :repo_list diff --git a/lib/gitlab/gitorious_import/repository.rb b/lib/gitlab/gitorious_import/repository.rb index f702797dc6..c88f1ae358 100644 --- a/lib/gitlab/gitorious_import/repository.rb +++ b/lib/gitlab/gitorious_import/repository.rb @@ -1,7 +1,5 @@ module Gitlab module GitoriousImport - GITORIOUS_HOST = "https://gitorious.org" - Repository = Struct.new(:full_name) do def id Digest::SHA1.hexdigest(full_name) diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb index 581a8c20bd..0dab7bcfa4 100644 --- a/lib/gitlab/project_search_results.rb +++ b/lib/gitlab/project_search_results.rb @@ -4,7 +4,11 @@ module Gitlab def initialize(project_id, query, repository_ref = nil) @project = Project.find(project_id) - @repository_ref = repository_ref + @repository_ref = if repository_ref.present? + repository_ref + else + nil + end @query = Shellwords.shellescape(query) if query.present? end diff --git a/lib/support/nginx/gitlab b/lib/support/nginx/gitlab index 62a4276536..4688a527eb 100644 --- a/lib/support/nginx/gitlab +++ b/lib/support/nginx/gitlab @@ -1,10 +1,16 @@ ## GitLab -## Contributors: randx, yin8086, sashkab, orkoden, axilleas, bbodenmiller, DouweM ## ## Lines starting with two hashes (##) are comments with information. ## Lines starting with one hash (#) are configuration parameters that can be uncommented. ## ################################## +## CONTRIBUTING ## +################################## +## +## If you change this file in a Merge Request, please also create +## a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests +## +################################## ## CHUNKED TRANSFER ## ################################## ## diff --git a/lib/support/nginx/gitlab-ssl b/lib/support/nginx/gitlab-ssl index 2aefc94469..187a27e93b 100644 --- a/lib/support/nginx/gitlab-ssl +++ b/lib/support/nginx/gitlab-ssl @@ -1,5 +1,4 @@ ## GitLab -## Contributors: randx, yin8086, sashkab, orkoden, axilleas, bbodenmiller, DouweM ## ## Modified from nginx http version ## Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/ @@ -9,6 +8,13 @@ ## Lines starting with one hash (#) are configuration parameters that can be uncommented. ## ################################## +## CONTRIBUTING ## +################################## +## +## If you change this file in a Merge Request, please also create +## a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests +## +################################## ## CHUNKED TRANSFER ## ################################## ## diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake index 3c9802a0be..d49cb6778f 100644 --- a/lib/tasks/gitlab/cleanup.rake +++ b/lib/tasks/gitlab/cleanup.rake @@ -51,7 +51,7 @@ namespace :gitlab do git_base_path = Gitlab.config.gitlab_shell.repos_path all_dirs = Dir.glob(git_base_path + '/*') - global_projects = Project.where(namespace_id: nil).pluck(:path) + global_projects = Project.in_namespace(nil).pluck(:path) puts git_base_path.yellow puts "Looking for global repos to remove... " diff --git a/lib/tasks/gitlab/web_hook.rake b/lib/tasks/gitlab/web_hook.rake index f9f586db93..412bcad122 100644 --- a/lib/tasks/gitlab/web_hook.rake +++ b/lib/tasks/gitlab/web_hook.rake @@ -51,11 +51,11 @@ namespace :gitlab do if namespace_path.blank? Project elsif namespace_path == '/' - Project.where(namespace_id: nil) + Project.in_namespace(nil) else namespace = Namespace.where(path: namespace_path).first if namespace - Project.where(namespace_id: namespace.id) + Project.in_namespace(namespace.id) else puts "Namespace not found: #{namespace_path}".red exit 2 diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb index 557c71b4d2..86c395a8e8 100644 --- a/spec/models/concerns/issuable_spec.rb +++ b/spec/models/concerns/issuable_spec.rb @@ -16,7 +16,7 @@ describe Issue, "Issuable" do it { is_expected.to validate_presence_of(:iid) } it { is_expected.to validate_presence_of(:author) } it { is_expected.to validate_presence_of(:title) } - it { is_expected.to ensure_length_of(:title).is_at_least(0).is_at_most(255) } + it { is_expected.to validate_length_of(:title).is_at_least(0).is_at_most(255) } end describe "Scope" do diff --git a/spec/models/deploy_keys_project_spec.rb b/spec/models/deploy_keys_project_spec.rb index 7032b77714..705ef257d8 100644 --- a/spec/models/deploy_keys_project_spec.rb +++ b/spec/models/deploy_keys_project_spec.rb @@ -36,9 +36,7 @@ describe DeployKeysProject do it "doesn't destroy the deploy key" do subject.destroy - expect { - deploy_key.reload - }.not_to raise_error(ActiveRecord::RecordNotFound) + expect { deploy_key.reload }.not_to raise_error end end @@ -63,9 +61,7 @@ describe DeployKeysProject do it "doesn't destroy the deploy key" do subject.destroy - expect { - deploy_key.reload - }.not_to raise_error(ActiveRecord::RecordNotFound) + expect { deploy_key.reload }.not_to raise_error end end end diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index 6eb1208a7f..fbb9e16295 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -26,8 +26,8 @@ describe Key do describe "Validation" do it { is_expected.to validate_presence_of(:title) } it { is_expected.to validate_presence_of(:key) } - it { is_expected.to ensure_length_of(:title).is_within(0..255) } - it { is_expected.to ensure_length_of(:key).is_within(0..5000) } + it { is_expected.to validate_length_of(:title).is_within(0..255) } + it { is_expected.to validate_length_of(:key).is_within(0..5000) } end describe "Methods" do diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 48568e2a3f..87c67fa32c 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -69,14 +69,14 @@ describe Project do it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_uniqueness_of(:name).scoped_to(:namespace_id) } - it { is_expected.to ensure_length_of(:name).is_within(0..255) } + it { is_expected.to validate_length_of(:name).is_within(0..255) } it { is_expected.to validate_presence_of(:path) } it { is_expected.to validate_uniqueness_of(:path).scoped_to(:namespace_id) } - it { is_expected.to ensure_length_of(:path).is_within(0..255) } - it { is_expected.to ensure_length_of(:description).is_within(0..2000) } + it { is_expected.to validate_length_of(:path).is_within(0..255) } + it { is_expected.to validate_length_of(:description).is_within(0..2000) } it { is_expected.to validate_presence_of(:creator) } - it { is_expected.to ensure_length_of(:issues_tracker_id).is_within(0..255) } + it { is_expected.to validate_length_of(:issues_tracker_id).is_within(0..255) } it { is_expected.to validate_presence_of(:namespace) } it 'should not allow new projects beyond user limits' do diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index c81dd36ef4..c786d0bf10 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -38,10 +38,10 @@ describe Snippet do it { is_expected.to validate_presence_of(:author) } it { is_expected.to validate_presence_of(:title) } - it { is_expected.to ensure_length_of(:title).is_within(0..255) } + it { is_expected.to validate_length_of(:title).is_within(0..255) } it { is_expected.to validate_presence_of(:file_name) } - it { is_expected.to ensure_length_of(:file_name).is_within(0..255) } + it { is_expected.to validate_length_of(:file_name).is_within(0..255) } it { is_expected.to validate_presence_of(:content) } diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 8001b33c0e..5c42898d66 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -96,7 +96,7 @@ describe User do it { is_expected.to allow_value(0).for(:projects_limit) } it { is_expected.not_to allow_value(-1).for(:projects_limit) } - it { is_expected.to ensure_length_of(:bio).is_within(0..255) } + it { is_expected.to validate_length_of(:bio).is_within(0..255) } describe 'email' do it 'accepts info@example.com' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2030513bb5..fc5d8673e4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +1,7 @@ -if ENV['SIMPLECOV'] - require 'simplecov' -end - -if ENV['COVERALLS'] - require 'coveralls' - Coveralls.wear_merged! -end - ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' -require 'webmock/rspec' +require 'shoulda/matchers' require 'email_spec' require 'sidekiq/testing/inline' @@ -18,8 +9,6 @@ require 'sidekiq/testing/inline' # in spec/support/ and its subdirectories. Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } -WebMock.disable_net_connect!(allow_localhost: true) - RSpec.configure do |config| config.use_transactional_fixtures = false config.use_instantiated_fixtures = false diff --git a/spec/support/api_helpers.rb b/spec/support/api_helpers.rb index ec9a326a1e..f63322776d 100644 --- a/spec/support/api_helpers.rb +++ b/spec/support/api_helpers.rb @@ -29,6 +29,6 @@ module ApiHelpers end def json_response - JSON.parse(response.body) + @_json_response ||= JSON.parse(response.body) end end diff --git a/spec/support/coverage.rb b/spec/support/coverage.rb new file mode 100644 index 0000000000..a54bf03380 --- /dev/null +++ b/spec/support/coverage.rb @@ -0,0 +1,8 @@ +if ENV['SIMPLECOV'] + require 'simplecov' +end + +if ENV['COVERALLS'] + require 'coveralls' + Coveralls.wear_merged! +end diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 52b11bd632..f8cce2ea5a 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -70,7 +70,7 @@ end # Extend shoulda-matchers module Shoulda::Matchers::ActiveModel - class EnsureLengthOfMatcher + class ValidateLengthOfMatcher # Shortcut for is_at_least and is_at_most def is_within(range) is_at_least(range.min) && is_at_most(range.max) diff --git a/spec/support/webmock.rb b/spec/support/webmock.rb new file mode 100644 index 0000000000..af2906b756 --- /dev/null +++ b/spec/support/webmock.rb @@ -0,0 +1,4 @@ +require 'webmock' +require 'webmock/rspec' + +WebMock.disable_net_connect!(allow_localhost: true)