Merge pull request #6456 from opf/fix/28091/project-responsible

[28091] Fix project responsible and add spec

[ci skip]
pull/6460/head
Oliver Günther 6 years ago committed by GitHub
commit 2252dbded1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/assets/stylesheets/vendor/_select2.scss
  2. 2
      app/models/user.rb
  3. 62
      spec/features/projects/project_responsible_spec.rb

@ -132,10 +132,6 @@ $se2-width: 100%;
height: $se2-element-height; height: $se2-element-height;
line-height: $se2-line-height; line-height: $se2-line-height;
.select2-chosen {
line-height: $se2-line-height;
}
.select2-arrow { .select2-arrow {
@include varprop(background, se2-theme-selectable-color); @include varprop(background, se2-theme-selectable-color);
border-radius: 0; border-radius: 0;

@ -189,7 +189,7 @@ class User < Principal
end end
def self.search_in_project(query, options) def self.search_in_project(query, options)
Project.find(options.fetch(:project)).users.like(query) options.fetch(:project).users.like(query)
end end
# Returns the user that matches provided login and password, or nil # Returns the user that matches provided login and password, or nil

@ -0,0 +1,62 @@
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See docs/COPYRIGHT.rdoc for more details.
#++
require 'spec_helper'
require 'features/projects/project_settings_page'
describe 'Projects responsible setting',
type: :feature,
with_settings: { user_format: :firstname_lastname },
js: true do
include Capybara::Select2
let!(:admin) { FactoryBot.create :admin }
let!(:user) { FactoryBot.create(:user, firstname: 'Foo', lastname: 'Bar', member_in_project: project) }
let!(:project) do
FactoryBot.create(:project,
name: 'Plain project',
identifier: 'plain-project')
end
let(:settings_page) { ProjectSettingsPage.new(project) }
before do
login_as admin
end
it 'can set the responsible (Regression test #28091)' do
settings_page.visit_settings
expect(page).to have_selector('.form--label', text: 'Responsible')
select2('Foo Bar', css: '#s2id_project_responsible_id')
click_on 'Save'
expect(page).to have_selector('.select2-chosen', text: 'Foo Bar')
project.reload
expect(project.responsible).to eq(user)
end
end
Loading…
Cancel
Save