commit
f5be86dafd
@ -0,0 +1,37 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2014 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-2013 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 doc/COPYRIGHT.rdoc for more details.
|
||||
//++
|
||||
|
||||
// TODO move to UI components
|
||||
angular.module('openproject.workPackages.tabs') |
||||
|
||||
.directive('addWorkPackageRelation', [function() { |
||||
return { |
||||
restrict: 'E', |
||||
templateUrl: '/templates/work_packages/tabs/_add_work_package_relation.html', |
||||
}; |
||||
}]); |
@ -1,84 +0,0 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2014 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-2013 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 doc/COPYRIGHT.rdoc for more details.
|
||||
//++
|
||||
|
||||
// TODO move to UI components
|
||||
angular.module('openproject.workPackages.tabs') |
||||
|
||||
.directive('workPackageChildren', [ |
||||
'I18n', |
||||
'PathHelper', |
||||
'WorkPackageService', |
||||
'WorkPackagesHelper', |
||||
'$timeout', |
||||
function(I18n, PathHelper, WorkPackageService, WorkPackagesHelper, $timeout) { |
||||
return { |
||||
restrict: 'E', |
||||
replace: true, |
||||
scope: { |
||||
title: '@', |
||||
workPackage: '=', |
||||
children: '=', |
||||
btnTitle: '@buttonTitle', |
||||
btnIcon: '@buttonIcon' |
||||
}, |
||||
templateUrl: '/templates/work_packages/tabs/_work_package_children.html', |
||||
link: function(scope, element, attrs) { |
||||
scope.I18n = I18n; |
||||
scope.userPath = PathHelper.staticUserPath; |
||||
scope.workPackagePath = PathHelper.staticWorkPackagePath; |
||||
scope.getState = WorkPackagesHelper.getState; |
||||
scope.getFullIdentifier = WorkPackagesHelper.getFullIdentifier; |
||||
|
||||
var setExpandState = function() { |
||||
scope.expand = scope.children && scope.children.length > 0; |
||||
}; |
||||
|
||||
scope.$watch('children', function() { |
||||
setExpandState(); |
||||
scope.childrenCount = scope.children.length || 0; |
||||
}); |
||||
|
||||
scope.$watch('expand', function(newVal, oldVal) { |
||||
scope.stateClass = WorkPackagesHelper.collapseStateIcon(!newVal); |
||||
}); |
||||
|
||||
scope.toggleExpand = function() { |
||||
scope.expand = !scope.expand; |
||||
}; |
||||
|
||||
scope.addChild = function() { |
||||
// Temporarily go to old create view with parent_id set to currently viewed work package
|
||||
window.location = PathHelper.staticWorkPackageNewWithParentPath(scope.workPackage.props.projectId, scope.workPackage.props.id); |
||||
} |
||||
|
||||
scope.deleteChild = function() { |
||||
//TODO: Requires API endpoint for update work package
|
||||
} |
||||
} |
||||
}; |
||||
}]); |
@ -0,0 +1,144 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2014 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-2013 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 doc/COPYRIGHT.rdoc for more details.
|
||||
//++
|
||||
|
||||
angular.module('openproject.viewModels') |
||||
|
||||
.factory('CommonRelationsHandler', [ |
||||
'$timeout', |
||||
'WorkPackageService', |
||||
'ApiHelper', |
||||
function($timeout, WorkPackageService, ApiHelper) { |
||||
function CommonRelationsHandler(workPackage, |
||||
relations, |
||||
relationsId) { |
||||
this.workPackage = workPackage; |
||||
this.relations = relations; |
||||
this.relationsId = relationsId; |
||||
|
||||
this.type = "relation"; |
||||
this.isSingletonRelation = false; |
||||
} |
||||
|
||||
CommonRelationsHandler.prototype = { |
||||
isEmpty: function() { |
||||
return !this.relations || this.relations.length === 0; |
||||
}, |
||||
|
||||
getCount: function() { |
||||
return (this.relations) ? this.relations.length : 0; |
||||
}, |
||||
|
||||
canAddRelation: function() { |
||||
return !!this.workPackage.links.addRelation; |
||||
}, |
||||
|
||||
addRelation: function(scope) { |
||||
var inputElement = angular.element('#relation_to_id-' + this.relationsId); |
||||
var toId = inputElement.val(); |
||||
WorkPackageService.addWorkPackageRelation(this.workPackage, toId, this.relationsId).then(function(relation) { |
||||
inputElement.val(''); |
||||
scope.$emit('workPackageRefreshRequired', ''); |
||||
}, function(error) { |
||||
ApiHelper.handleError(scope, error); |
||||
}); |
||||
}, |
||||
|
||||
applyCustomExtensions: function() { |
||||
// Massive hack alert - Using old prototype autocomplete ///////////
|
||||
if(this.canAddRelation) { |
||||
var workPackage = this.workPackage; |
||||
var relationsId = this.relationsId; |
||||
|
||||
$timeout(function() { |
||||
var url = PathHelper.workPackageAutoCompletePath(workPackage.props.projectId, workPackage.props.id); |
||||
new Ajax.Autocompleter('relation_to_id-' + relationsId, |
||||
'related_issue_candidates-' + relationsId, |
||||
url, |
||||
{ minChars: 1, |
||||
frequency: 0.5, |
||||
paramName: 'q', |
||||
updateElement: function(value) { |
||||
document.getElementById('relation_to_id-' + relationsId).value = value.id; |
||||
}, |
||||
parameters: 'scope=all' |
||||
}); |
||||
}); |
||||
} |
||||
////////////////////////////////////////////////////////////////////
|
||||
}, |
||||
|
||||
getRelatedWorkPackage: function(workPackage, relation) { |
||||
var self = workPackage.links.self.href; |
||||
|
||||
if (relation.links.relatedTo.href == self) { |
||||
return relation.links.relatedFrom.fetch(); |
||||
} else { |
||||
return relation.links.relatedTo.fetch(); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
return CommonRelationsHandler; |
||||
}]) |
||||
|
||||
.factory('ChildrenRelationsHandler', ['PathHelper', |
||||
'CommonRelationsHandler', |
||||
function(PathHelper, |
||||
CommonRelationsHandler) { |
||||
function ChildrenRelationsHandler(workPackage, children) { |
||||
var handler = new CommonRelationsHandler(workPackage, children, undefined); |
||||
|
||||
handler.type = "child"; |
||||
handler.canAddRelation = function() { return true }; |
||||
handler.addRelation = function() { |
||||
window.location = PathHelper.staticWorkPackageNewWithParentPath(this.workPackage.props.projectId, this.workPackage.props.id); |
||||
}; |
||||
handler.applyCustomExtensions = undefined; |
||||
handler.getRelatedWorkPackage = function(workPackage, relation) { return relation.fetch() }; |
||||
|
||||
return handler; |
||||
} |
||||
|
||||
return ChildrenRelationsHandler; |
||||
}]) |
||||
|
||||
.factory('ParentRelationsHandler', ['ChildrenRelationsHandler', |
||||
function(ChildrenRelationsHandler) { |
||||
function ParentRelationsHandler(workPackage, parents) { |
||||
var handler = new ChildrenRelationsHandler(workPackage, parents, undefined); |
||||
|
||||
handler.type = "parent"; |
||||
handler.canAddRelation = function() { return false }; |
||||
handler.addRelation = undefined; |
||||
handler.isSingletonRelation = true; |
||||
|
||||
return handler; |
||||
} |
||||
|
||||
return ParentRelationsHandler; |
||||
}]); |
@ -0,0 +1,49 @@ |
||||
<%#-- copyright |
||||
OpenProject is a project management system. |
||||
Copyright (C) 2012-2014 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-2013 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 doc/COPYRIGHT.rdoc for more details. |
||||
|
||||
++#%> |
||||
|
||||
<% # LOCALS |
||||
fail ArgumentError, 'missing instructions' unless defined? instructions |
||||
%> |
||||
|
||||
<% disable_accessibility_css! %> |
||||
|
||||
<% breadcrumb_paths(l(:label_login)) %> |
||||
<%= call_hook :view_account_login_top %> |
||||
|
||||
<% |
||||
signin_link = link_to I18n.t('label_here'), signin_path |
||||
instruction_text = I18n.t "instructions_#{instructions}", signin: signin_link |
||||
%> |
||||
|
||||
<div id="login-form" class="form"> |
||||
<h1><%= I18n.t(:label_login) %></h1> |
||||
<hr class="form_separator"> |
||||
<p><%= instruction_text.html_safe %></p> |
||||
</div> |
||||
<%= call_hook :view_account_login_bottom %> |
@ -0,0 +1,5 @@ |
||||
<button class="button" |
||||
title="{{ btnTitle }}" |
||||
ng-bind-html="btnIcon + ' ' + btnTitle" |
||||
ng-click="handler.addRelation()"> |
||||
</button> |
@ -0,0 +1,12 @@ |
||||
<button class="button" |
||||
title="{{ btnTitle }}" |
||||
ng-bind-html="btnIcon + ' ' + btnTitle" |
||||
ng-click="handler.addRelation(this)"> |
||||
</button> |
||||
<input id="relation_to_id-{{ handler.relationsId }}" |
||||
name="relation[to_id][{{ handler.relationsId }}]" |
||||
size="10" |
||||
type="text" |
||||
autocomplete="off"> |
||||
<div id="related_issue_candidates-{{ handler.relationsId }}" |
||||
class="autocomplete related-issue-candidates"></div> |
@ -1,48 +0,0 @@ |
||||
<div class="relation"> |
||||
<h3> |
||||
<accessible-by-keyboard execute="toggleExpand()"> |
||||
<i class="icon-pull-content" ng-class="stateClass"></i> {{ title }} |
||||
<span ng-if="!isSingletonRelation">({{ childrenCount }})</span> |
||||
</accessible-by-keyboard> |
||||
</h3> |
||||
<div class="content" ng-show="expand"> |
||||
<div class="workpackages"> |
||||
<div ng-if="children"> |
||||
<table> |
||||
<thead> |
||||
<tr> |
||||
<td>{{ I18n.t('js.work_packages.properties.subject') }}</td> |
||||
<td>{{ I18n.t('js.work_packages.properties.status') }}</td> |
||||
<td>{{ I18n.t('js.work_packages.properties.assignee') }}</td> |
||||
<td></td> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr ng-repeat="workPackage in children"> |
||||
<td> |
||||
<a class="work_package" ng-class="getState(workPackage)" href="{{ workPackagePath(workPackage.props.id) }}"> |
||||
{{ getFullIdentifier(workPackage) }} |
||||
</a> |
||||
</td> |
||||
<td>{{ workPackage.props.status }}</td> |
||||
<td> |
||||
<a href="{{ userPath(workPackage.embedded.assignee.props.id) }}"> |
||||
{{ workPackage.embedded.assignee.props.name }} |
||||
</a> |
||||
</td> |
||||
<td><!--i title="delete relation" class="delete-item icon-delete" ng-click="removeChild()"></i--></td> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
<div ng-if="!children || children.length === 0"> |
||||
No child work packages |
||||
</div> |
||||
</div> |
||||
<button class="button" |
||||
title="{{ btnTitle }}" |
||||
ng-bind-html="btnIcon + ' ' + btnTitle" |
||||
ng-click="addChild()"> |
||||
</button> |
||||
</div> |
||||
</div> |
@ -1,42 +0,0 @@ |
||||
<div class="relation"> |
||||
<h3 ng-click="expand=!expand"> |
||||
<accessible-by-keyboard execute="toggleExpand()"> |
||||
<i class="icon-pull-content" ng-class="stateClass"></i> {{ title }} |
||||
</accessible-by-keyboard> |
||||
</h3> |
||||
<div class="content" ng-show="expand"> |
||||
<div class="workpackages"> |
||||
<div ng-if="parent"> |
||||
<table> |
||||
<thead> |
||||
<tr> |
||||
<td>{{ I18n.t('js.work_packages.properties.subject') }}</td> |
||||
<td>{{ I18n.t('js.work_packages.properties.status') }}</td> |
||||
<td>{{ I18n.t('js.work_packages.properties.assignee') }}</td> |
||||
<td></td> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr> |
||||
<td> |
||||
<a class="work_package" ng-class="getState(parent)" href="{{ workPackagePath(parent.props.id) }}"> |
||||
{{ getFullIdentifier(parent) }} |
||||
</a> |
||||
</td> |
||||
<td>{{ parent.props.status }}</td> |
||||
<td> |
||||
<a href="{{ userPath(parent.embedded.assignee.props.id) }}"> |
||||
{{ parent.embedded.assignee.props.name }} |
||||
</a> |
||||
</td> |
||||
<td><!--i title="delete relation" class="delete-item icon-delete" ng-click="removeChild()"></i--></td> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
<div ng-if="!parent"> |
||||
No parent work packages |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -0,0 +1,86 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2014 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-2013 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 doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'spec_helper' |
||||
require 'features/projects/projects_page' |
||||
|
||||
describe 'edit users', js: true do |
||||
let(:current_user) { FactoryGirl.create :admin } |
||||
let(:user) { FactoryGirl.create :user } |
||||
|
||||
let!(:auth_source) { FactoryGirl.create :auth_source } |
||||
|
||||
before do |
||||
allow(User).to receive(:current).and_return current_user |
||||
end |
||||
|
||||
def auth_select |
||||
find :css, 'select#user_auth_source_id' |
||||
end |
||||
|
||||
def user_password |
||||
find :css, 'input#user_password' |
||||
end |
||||
|
||||
context 'with internal authentication' do |
||||
before do |
||||
visit edit_user_path(user) |
||||
end |
||||
|
||||
it 'shows internal authentication being selected including password settings' do |
||||
expect(auth_select.value).to eq '' # selected internal |
||||
expect(user_password).to be_visible |
||||
end |
||||
|
||||
it 'hides password settings when switching to an LDAP auth source' do |
||||
auth_select.select auth_source.name |
||||
|
||||
expect(page).not_to have_selector('input#user_password') |
||||
end |
||||
end |
||||
|
||||
context 'with external authentication' do |
||||
before do |
||||
user.auth_source = auth_source |
||||
user.save! |
||||
|
||||
visit edit_user_path(user) |
||||
end |
||||
|
||||
it 'shows external authentication being selected and no password settings' do |
||||
expect(auth_select.value).to eq auth_source.id.to_s |
||||
expect(page).not_to have_selector('input#user_password') |
||||
end |
||||
|
||||
it 'shows password settings when switching back to internal authentication' do |
||||
auth_select.select I18n.t('label_internal') |
||||
|
||||
expect(user_password).to be_visible |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,71 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2014 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-2013 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 doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'spec_helper' |
||||
|
||||
describe 'layouts/admin' do |
||||
include Redmine::MenuManager::MenuHelper |
||||
helper Redmine::MenuManager::MenuHelper |
||||
|
||||
let(:admin) { FactoryGirl.create :admin } |
||||
|
||||
before do |
||||
view.stub(:current_menu_item).and_return('overview') |
||||
view.stub(:default_breadcrumb) |
||||
controller.stub(:default_search_scope) |
||||
|
||||
User.stub(:current).and_return admin |
||||
view.stub(:current_user).and_return admin |
||||
end |
||||
|
||||
# All password-based authentication is to be hidden and disabled if |
||||
# `disable_password_login` is true. This includes LDAP. |
||||
describe 'LDAP authentication menu entry' do |
||||
context 'with password login enabled' do |
||||
before do |
||||
OpenProject::Configuration.stub(:disable_password_login?).and_return(false) |
||||
render |
||||
end |
||||
|
||||
it 'is shown' do |
||||
expect(rendered).to have_selector('a', text: I18n.t('label_ldap_authentication')) |
||||
end |
||||
end |
||||
|
||||
context 'with password login disabled' do |
||||
before do |
||||
OpenProject::Configuration.stub(:disable_password_login?).and_return(true) |
||||
render |
||||
end |
||||
|
||||
it 'is hidden' do |
||||
expect(rendered).not_to have_selector('a', text: I18n.t('label_ldap_authentication')) |
||||
end |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,61 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2014 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-2013 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 doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'spec_helper' |
||||
|
||||
describe 'settings/_authentication' do |
||||
context 'with password login enabled' do |
||||
before do |
||||
OpenProject::Configuration.stub(:disable_password_login?).and_return(false) |
||||
render |
||||
end |
||||
|
||||
it 'shows password settings' do |
||||
expect(rendered).to have_text I18n.t('label_password_lost') |
||||
end |
||||
|
||||
it 'shows automated user blocking options' do |
||||
expect(rendered).to have_text I18n.t(:brute_force_prevention, :scope => [:settings]) |
||||
end |
||||
end |
||||
|
||||
context 'with password login disabled' do |
||||
before do |
||||
OpenProject::Configuration.stub(:disable_password_login?).and_return(true) |
||||
render |
||||
end |
||||
|
||||
it 'does not show password settings' do |
||||
expect(rendered).not_to have_text I18n.t('label_password_lost') |
||||
end |
||||
|
||||
it 'does not show automated user blocking options' do |
||||
expect(rendered).not_to have_text I18n.t(:brute_force_prevention, :scope => [:settings]) |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue