Merge pull request #3451 from Azure7111/feature/restructure_my_account
Restructure my accountpull/3612/head
commit
c80904ec5f
@ -0,0 +1,176 @@ |
||||
<%#-- copyright |
||||
OpenProject is a project management system. |
||||
Copyright (C) 2012-2015 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. |
||||
|
||||
++#%> |
||||
|
||||
<% html_title(l(:label_my_account), I18n.t('my_account.access_tokens.access_token')) -%> |
||||
|
||||
<% breadcrumb_paths(l(:label_my_account), I18n.t('my_account.access_tokens.access_token')) %> |
||||
<%= toolbar title: I18n.t('my_account.access_tokens.access_token') %> |
||||
|
||||
<p><%= l(:text_access_token_hint) %></p> |
||||
|
||||
<% if has_tokens? %> |
||||
<div class="generic-table--container"> |
||||
<div class="generic-table--results-container" style="max-height: 340px;"> |
||||
<table id="access-token-table" role="grid" class="generic-table" interactive-table> |
||||
<colgroup> |
||||
<col highlight-col> |
||||
<col highlight-col> |
||||
<col highlight-col> |
||||
<col highlight-col> |
||||
</colgroup> |
||||
<thead> |
||||
<tr> |
||||
<th> |
||||
<div class="generic-table--sort-header-outer"> |
||||
<div class="generic-table--sort-header"> |
||||
<%= l('attributes.name') %> |
||||
</div> |
||||
</div> |
||||
</th> |
||||
<th> |
||||
<div class="generic-table--sort-header-outer"> |
||||
<div class="generic-table--sort-header"> |
||||
<%= User.human_attribute_name(:created_on) %> |
||||
</div> |
||||
</div> |
||||
</th> |
||||
<th> |
||||
<div class="generic-table--sort-header-outer"> |
||||
<div class="generic-table--sort-header"> |
||||
<%= I18n.t('my_account.access_tokens.headers.expiration') %> |
||||
</div> |
||||
</div> |
||||
</th> |
||||
<th> |
||||
<div class="generic-table--sort-header-outer"> |
||||
<div class="generic-table--sort-header"> |
||||
<%= I18n.t('my_account.access_tokens.headers.action') %> |
||||
</div> |
||||
</div> |
||||
</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<% if Setting.feeds_enabled? %> |
||||
<% if @user.rss_token %> |
||||
<tr> |
||||
<td><%= l(:label_feeds_access_key_type) %></td> |
||||
<td> |
||||
<span title="<%= format_time(@user.rss_token.created_on) %>"> |
||||
<%= format_time(@user.rss_token.created_on.to_s) %> |
||||
</span> |
||||
</td> |
||||
<td><%= I18n.t('my_account.access_tokens.indefinite_expiration') %></td> |
||||
<td> |
||||
<%= link_to l(:button_reset), |
||||
{ action: 'reset_rss_key' }, |
||||
method: :post, |
||||
class: 'icon icon-delete' %> |
||||
<a href="" |
||||
click-notification="<%= l(:present_access_key_value, |
||||
key_name: l(:label_feeds_access_key), |
||||
value: @user.rss_token) %>" |
||||
click-notification-type="notice" |
||||
class="icon icon-key-1"> |
||||
<%= l(:button_show) %> |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
<% else %> |
||||
<tr> |
||||
<td><%= l(:label_feeds_access_key_type) %></td> |
||||
<td><%= l(:label_missing_feeds_access_key) %></td> |
||||
<td></td> |
||||
<td> |
||||
<%= link_to l(:button_generate), |
||||
{ action: 'generate_rss_key' }, |
||||
method: :post, |
||||
class: 'icon icon-key-1' %> |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
<% end %> |
||||
<% end %> |
||||
<% if Setting.rest_api_enabled? %> |
||||
<% if @user.api_token %> |
||||
<tr> |
||||
<td><%= l(:label_api_access_key_type) %></td> |
||||
<td> |
||||
<span title="<%= format_time(@user.api_token.created_on) %>"> |
||||
<%= format_time(@user.api_token.created_on.to_s) %> |
||||
</span> |
||||
</td> |
||||
<td><%= I18n.t('my_account.access_tokens.indefinite_expiration') %></td> |
||||
<td> |
||||
<%= link_to l(:button_reset), |
||||
{ action: 'reset_api_key' }, |
||||
method: :post, |
||||
class: 'icon icon-delete' %> |
||||
<a href="" |
||||
click-notification="<%= l(:present_access_key_value, |
||||
key_name: l(:label_api_access_key), |
||||
value: @user.api_token) %>" |
||||
click-notification-type="notice" |
||||
class="icon icon-key-1"> |
||||
<%= l(:button_show) %> |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
<% else %> |
||||
<tr> |
||||
<td><%= l(:label_api_access_key_type) %></td> |
||||
<td><%= l(:label_missing_api_access_key) %></td> |
||||
<td></td> |
||||
<td> |
||||
<%= link_to l(:button_generate), |
||||
{ action: 'generate_api_key' }, |
||||
method: :post, |
||||
class: 'icon icon-key-1' %> |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
<% end %> |
||||
<% end %> |
||||
<%= call_hook(:view_access_tokens_table, user: @user) %> |
||||
</tbody> |
||||
</table> |
||||
<div class="generic-table--header-background"></div> |
||||
</div> |
||||
</div> |
||||
<% else %> |
||||
<div class="generic-table--no-results-container" ng-if="!rows.length"> |
||||
<h2 class="generic-table--no-results-title"> |
||||
<i class="icon-info"></i> |
||||
<%= I18n.t('my_account.access_tokens.no_results.title') %> |
||||
</h2> |
||||
<div class="generic-table--no-results-description"> |
||||
<%= I18n.t('my_account.access_tokens.no_results.description') %> |
||||
</div> |
||||
</div> |
||||
<% end %> |
@ -0,0 +1,44 @@ |
||||
<%#-- copyright |
||||
OpenProject is a project management system. |
||||
Copyright (C) 2012-2015 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. |
||||
|
||||
++#%> |
||||
|
||||
<% html_title(l(:label_my_account), I18n.t('activerecord.attributes.user.mail_notification')) -%> |
||||
|
||||
<% breadcrumb_paths(l(:label_my_account), I18n.t('activerecord.attributes.user.mail_notification')) %> |
||||
<%= toolbar title: I18n.t('activerecord.attributes.user.mail_notification') %> |
||||
|
||||
<%= labelled_tabular_form_for @user, |
||||
as: :user, |
||||
url: { action: 'mail_notifications' }, |
||||
lang: current_language, |
||||
html: { id: 'my_account_form', class: 'form -wide-labels' } do %> |
||||
<section class="form--section"> |
||||
<%= render partial: 'users/mail_notifications', locals: { input_size: :middle } %> |
||||
</section> |
||||
<%= styled_button_tag l(:button_save), class: '-highlight -with-icon icon-yes' %> |
||||
<% end %> |
@ -0,0 +1,48 @@ |
||||
<%#-- copyright |
||||
OpenProject is a project management system. |
||||
Copyright (C) 2012-2015 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. |
||||
|
||||
++#%> |
||||
|
||||
<% html_title(l(:label_my_account), l(:label_settings)) %> |
||||
|
||||
<% breadcrumb_paths(l(:label_my_account), l(:label_settings)) %> |
||||
<%= toolbar title: l(:label_settings) %> |
||||
|
||||
<%= error_messages_for 'user' %> |
||||
<%= labelled_tabular_form_for @user, as: :user, url: { action: 'settings' }, |
||||
lang: current_language, |
||||
html: { id: 'my_account_form', class: 'form -wide-labels' } do |f| %> |
||||
<section class="form--section"> |
||||
<section class="form--section"> |
||||
<div class="form--field"><%= f.select :language, lang_options_for_select, container_class: '-middle' %></div> |
||||
<%= render partial: 'users/preferences', locals: { input_size: :middle } %> |
||||
</section> |
||||
|
||||
<%= call_hook(:view_my_settings, user: @user, form: f) %> |
||||
</section> |
||||
<%= styled_button_tag l(:button_save), class: '-highlight -with-icon icon-yes' %> |
||||
<% end %> |
@ -1,82 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2015 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. |
||||
#++ |
||||
|
||||
Feature: User deletion |
||||
|
||||
@javascript |
||||
Scenario: A user can delete himself if the setting permits it |
||||
Given the "users_deletable_by_self" setting is set to true |
||||
And there is 1 user with the following: |
||||
| login | bob | |
||||
And I am already logged in as "bob" |
||||
And I go to the my account page |
||||
And I follow "Delete account" |
||||
And I press "Delete" |
||||
And I accept the alert dialog |
||||
Then I should see "Account successfully deleted" |
||||
And I should be on the login page |
||||
|
||||
Scenario: A user can not delete himself if the setting forbids it |
||||
Given the "users_deletable_by_self" setting is set to false |
||||
And there is 1 user with the following: |
||||
| login | bob | |
||||
And I am already logged in as "bob" |
||||
And I go to the my account page |
||||
Then I should not see "Delete account" within "#main-menu" |
||||
|
||||
@javascript |
||||
Scenario: An admin can delete other users if the setting permitts it |
||||
Given the "users_deletable_by_admins" setting is set to true |
||||
And there is 1 user with the following: |
||||
| login | bob | |
||||
And I am already admin |
||||
When I go to the edit page of the user "bob" |
||||
And I click "Delete" |
||||
And I press "Delete" |
||||
And I accept the alert dialog |
||||
Then I should see "Account successfully deleted" |
||||
And I should be on the index page of users |
||||
|
||||
Scenario: An admin can not delete other users if the setting forbidds it |
||||
Given the "users_deletable_by_admins" setting is set to false |
||||
And there is 1 user with the following: |
||||
| login | bob | |
||||
And I am already admin |
||||
And I go to the edit page of the user "bob" |
||||
Then I should not see "Delete" within ".toolbar" |
||||
|
||||
Scenario: Deletablilty settings can be set in the users tab of the settings |
||||
Given I am already admin |
||||
And the "users_deletable_by_admins" setting is set to false |
||||
And the "users_deletable_by_self" setting is set to false |
||||
And I go to the users tab of the settings page |
||||
And I check "settings_users_deletable_by_admins" |
||||
And I check "settings_users_deletable_by_self" |
||||
And I press "Save" within "#tab-content-users" |
||||
Then the "users_deletable_by_admins" setting should be true |
||||
Then the "users_deletable_by_self" setting should be true |
@ -1,56 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2015 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. |
||||
#++ |
||||
|
||||
Feature: Update User Information |
||||
|
||||
Background: |
||||
Given I am admin |
||||
And I go to the my account page |
||||
|
||||
@javascript |
||||
Scenario: A user is able to change his mail address if the settings permit it |
||||
Given I fill in "user_mail" with "john@doe.com" |
||||
And I submit the form by the "Save" button |
||||
Then I should see "Account was successfully updated." |
||||
|
||||
@javascript |
||||
Scenario: A user is able to change his name if the settings permit it |
||||
Given I fill in "user_firstname" with "Jon" |
||||
And I fill in "user_lastname" with "Doe" |
||||
And I submit the form by the "Save" button |
||||
Then I should see "Account was successfully updated." |
||||
|
||||
@javascript |
||||
Scenario: A user is able to reset their API access key |
||||
Given I click the API access key reset link |
||||
Then I should see "Your API access key was reset." |
||||
|
||||
@javascript |
||||
Scenario: A user is able to reset their RSS access key |
||||
Given I click the RSS access key reset link |
||||
Then I should see "Your RSS access key was reset." |
@ -0,0 +1,62 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2015 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.
|
||||
//++
|
||||
|
||||
module.exports = function($timeout, NotificationsService) { |
||||
return { |
||||
restrict: 'A', |
||||
link: function(scope, element, attributes) { |
||||
var pushNotification = function() { |
||||
switch(attributes.clickNotificationType) { |
||||
case 'notice': |
||||
NotificationsService.addNotice(attributes.clickNotification); |
||||
break; |
||||
case 'success': |
||||
NotificationsService.addSuccess(attributes.clickNotification); |
||||
break; |
||||
case 'warning': |
||||
NotificationsService.addWarning(attributes.clickNotification); |
||||
break; |
||||
case 'error': |
||||
NotificationsService.addError(attributes.clickNotification); |
||||
break; |
||||
default: |
||||
NotificationsService.addNotice(attributes.clickNotification); |
||||
} |
||||
}; |
||||
|
||||
var addNotification = function() { |
||||
// use timeout to trigger the digest cycle
|
||||
$timeout(function(){ |
||||
pushNotification(), |
||||
0 |
||||
}); |
||||
}; |
||||
element.bind('click', addNotification); |
||||
} |
||||
}; |
||||
}; |
@ -0,0 +1,107 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2015 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 'user deletion: ', type: :feature, js: true do |
||||
before do |
||||
page.set_rack_session(user_id: current_user.id) |
||||
end |
||||
|
||||
context 'regular user' do |
||||
let(:current_user) { FactoryGirl.create :user } |
||||
|
||||
it 'can delete their own account' do |
||||
Setting.users_deletable_by_self = 1 |
||||
visit delete_my_account_info_path |
||||
|
||||
fill_in 'login_verification', with: current_user.login |
||||
click_on 'Delete' |
||||
|
||||
page.driver.browser.switch_to.alert.accept |
||||
|
||||
expect(page).to have_content 'Account successfully deleted' |
||||
expect(current_path).to eq '/login' |
||||
end |
||||
|
||||
it 'cannot delete their own account if the settings forbid it' do |
||||
Setting.users_deletable_by_self = 0 |
||||
visit my_account_path |
||||
|
||||
within '#main-menu' do |
||||
expect(page).to_not have_content 'Delete account' |
||||
end |
||||
end |
||||
end |
||||
|
||||
context 'admin user' do |
||||
let!(:user) { FactoryGirl.create :user } |
||||
let(:current_user) { FactoryGirl.create :admin } |
||||
|
||||
it 'can delete other users if the setting permitts it' do |
||||
Setting.users_deletable_by_admins = 1 |
||||
visit edit_user_path(user) |
||||
|
||||
expect(page).to have_content "#{user.firstname} #{user.lastname}" |
||||
|
||||
click_on 'Delete' |
||||
fill_in 'login_verification', with: user.login |
||||
click_on 'Delete' |
||||
|
||||
page.driver.browser.switch_to.alert.accept |
||||
|
||||
expect(page).to have_content 'Account successfully deleted' |
||||
expect(current_path).to eq '/users' |
||||
end |
||||
|
||||
it 'cannot delete other users if the settings forbid it' do |
||||
Setting.users_deletable_by_admins = 0 |
||||
visit edit_user_path(user) |
||||
|
||||
expect(page).to_not have_content 'Delete account' |
||||
end |
||||
|
||||
it 'can change the deletablilty settings' do |
||||
Setting.users_deletable_by_admins = 0 |
||||
Setting.users_deletable_by_self = 0 |
||||
|
||||
visit settings_path(tab: 'users') |
||||
|
||||
find(:css, "#settings_users_deletable_by_admins").set(true) |
||||
find(:css, "#settings_users_deletable_by_self").set(true) |
||||
|
||||
within '#tab-content-users' do |
||||
click_on 'Save' |
||||
end |
||||
|
||||
expect(Setting.users_deletable_by_admins?).to eq true |
||||
expect(Setting.users_deletable_by_self?).to eq true |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,73 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2015 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 'my', type: :feature, js: true do |
||||
let(:current_user) { FactoryGirl.create :admin } |
||||
|
||||
before do |
||||
allow(User).to receive(:current).and_return current_user |
||||
end |
||||
|
||||
context 'user' do |
||||
it 'in settings they can edit their account details' do |
||||
visit my_account_path |
||||
|
||||
fill_in 'user[mail]', with: 'foo@mail.com' |
||||
fill_in 'user[firstname]', with: 'Foo' |
||||
fill_in 'user[lastname]', with: 'Bar' |
||||
click_on 'Save' |
||||
|
||||
expect(page).to have_content 'Account was successfully updated.' |
||||
expect(current_path).to eq my_account_path |
||||
|
||||
u = User.find(current_user.id) |
||||
expect(u.mail).to eq 'foo@mail.com' |
||||
expect(u.firstname).to eq 'Foo' |
||||
expect(u.lastname).to eq 'Bar' |
||||
end |
||||
|
||||
it 'in Access Tokens they can generate their API key' do |
||||
visit my_access_token_path |
||||
expect(page).to have_content 'Missing API access key' |
||||
find(:xpath, "//tr[contains(.,'API')]/td/a", text: 'Generate').click |
||||
|
||||
expect(page).to have_content 'Your API access key was generated.' |
||||
end |
||||
|
||||
it 'in Access Tokens they can generate their RSS key' do |
||||
visit my_access_token_path |
||||
expect(page).to have_content 'Missing RSS access key' |
||||
find(:xpath, "//tr[contains(.,'RSS')]/td/a", text: 'Generate').click |
||||
|
||||
expect(page).to have_content 'Your RSS access key was generated.' |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue