OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
replace meeting delete cuke by spec
ulfertsd4f1cf3a1758
diff --git a/app/helpers/no_results_helper.rb b/app/helpers/no_results_helper.rbindex cbaeb3f4cdd..546754638f5 100644--- a/app/helpers/no_results_helper.rb+++ b/app/helpers/no_results_helper.rb@@ -28,7 +28,6 @@#++module NoResultsHelper-# Helper to render the /common/no_results partial custamizable content.# Example usage:# no_results_box action_url: new_project_version_path(@project),diff --git a/modules/meeting/app/views/meetings/index.html.erb b/modules/meeting/app/views/meetings/index.html.erbindex ea4fe2f2208..f06c43faaa8 100644--- a/modules/meeting/app/views/meetings/index.html.erb+++ b/modules/meeting/app/views/meetings/index.html.erb@@ -67,7 +67,7 @@ See doc/COPYRIGHT.md for more details.<% end -%><p class="pagination">- <%= link_to_content_update(l(:label_today), page: @page_of_today, anchor: Date.today.strftime("%m-%d-%Y")) %>+ <%= link_to_content_update(t(:label_today), page: @page_of_today, anchor: Date.today.strftime("%m-%d-%Y")) %><%= pagination_links_full @meetings, :container => false %></p>diff --git a/modules/meeting/app/views/meetings/show.html.erb b/modules/meeting/app/views/meetings/show.html.erbindex 291489c096f..5e6a5462f1b 100644--- a/modules/meeting/app/views/meetings/show.html.erb+++ b/modules/meeting/app/views/meetings/show.html.erb@@ -19,8 +19,8 @@ See doc/COPYRIGHT.md for more details.++#%>-<% html_title "#{l(:label_meeting)}: #{@meeting.title}" %>-<%= toolbar title: l(:label_meeting),+<% html_title "#{t(:label_meeting)}: #{@meeting.title}" %>+<%= toolbar title: t(:label_meeting),link_to: link_to(@meeting),html: { class: 'meeting--main-toolbar' } do %><% unless User.current.anonymous? %>@@ -33,14 +33,14 @@ See doc/COPYRIGHT.md for more details.<% if authorize_for(:meetings, :edit) %><li class="toolbar-item"><%= link_to({:controller => '/meetings', :action => 'edit', :id => @meeting}, class: 'button',:accesskey => accesskey(:edit)) do%>- <%= op_icon('button--icon icon-edit') %> <%= l(:button_edit) %>+ <%= op_icon('button--icon icon-edit') %> <%= t(:button_edit) %><% end %></li><% end %><% if authorize_for(:meetings, :copy) %><li class="toolbar-item"><%= link_to({:controller => '/meetings', :action => 'copy', :id => @meeting}, class: 'button') do %>- <%= op_icon('button--icon icon-copy') %> <%= l(:button_copy) %>+ <%= op_icon('button--icon icon-copy') %> <%= t(:button_copy) %><% end %></li><% end %>@@ -49,8 +49,8 @@ See doc/COPYRIGHT.md for more details.<%= link_to({controller: '/meetings', action: 'destroy', id: @meeting},class: 'button',method: :delete,- confirm: l(:text_are_you_sure)) do %>- <%= op_icon('button--icon icon-delete') %> <%= l(:button_delete) %>+ data: { confirm: t(:text_are_you_sure) }) do %>+ <%= op_icon('button--icon icon-delete') %> <%= t(:button_delete) %><% end %></li><% end %>diff --git a/modules/meeting/features/meetings_delete.feature b/modules/meeting/features/meetings_delete.featuredeleted file mode 100644index f62d2704644..00000000000--- a/modules/meeting/features/meetings_delete.feature+++ /dev/null@@ -1,84 +0,0 @@-#-- copyright-# OpenProject Meeting Plugin-#-# Copyright (C) 2011-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.-#-# 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.md for more details.-#++--Feature: Delete meetings-- Background:- Given there is 1 project with the following:- | identifier | dingens |- | name | dingens |- And the project "dingens" uses the following modules:- | meetings |- And there is 1 user with:- | login | alice |- | language | en |- And there is 1 user with:- | login | bob |- And there is a role "user"- And the user "alice" is a "user" in the project "dingens"- And there is 1 meeting in project "dingens" created by "alice" with:- | title | Alices Meeting |- | location | Room 1 |- | duration | 1:30 |- | start_time | 2011-02-11 12:30:00 |- And there is 1 meeting in project "dingens" created by "bob" with:- | title | Bobs Meeting |- | location | Room 2 |- | duration | 2:30 |- | start_time | 2011-02-10 11:00:00 |-- Scenario: Navigate to an other-created meeting with no permission to delete meetings- Given the role "user" may have the following rights:- | view_meetings |- When I am already logged in as "alice"- And I go to the Meetings page for the project called "dingens"- And I click on "Bobs Meeting"- Then I should not see "Delete"-- Scenario: Navigate to a self-created meeting with permission to delete meetings- Given the role "user" may have the following rights:- | view_meetings |- | delete_meetings |- When I am already logged in as "alice"- And I go to the Meetings page for the project called "dingens"- And I click on "Alices Meeting"- Then I should see "Delete"-- Scenario: Navigate to an other-created meeting with permission to delete meetings- Given the role "user" may have the following rights:- | view_meetings |- | delete_meetings |- When I am already logged in as "alice"- And I go to the Meetings page for the project called "dingens"- And I click on "Bobs Meeting"- Then I should see "Delete"-- @javascript- Scenario: Delete a meeting with permission to delete meetings- Given the role "user" may have the following rights:- | view_meetings |- | delete_meetings |- When I am already logged in as "alice"- And I go to the Meetings page for the project called "dingens"- And I click on "Bobs Meeting"- And I click on "Delete"- And I confirm the JS confirm dialog- Then I should see "Meetings"- But I should not see "Bobs Meeting"diff --git a/modules/meeting/spec/features/meetings_delete_spec.rb b/modules/meeting/spec/features/meetings_delete_spec.rbnew file mode 100644index 00000000000..ddf58cc5c65--- /dev/null+++ b/modules/meeting/spec/features/meetings_delete_spec.rb@@ -0,0 +1,95 @@+#-- 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'++describe 'Meetings deletion', type: :feature do+ let(:project) { FactoryBot.create :project, enabled_module_names: %w[meetings] }+ let(:user) do+ FactoryBot.create(:user,+ member_in_project: project,+ member_with_permissions: permissions)+ end+ let(:other_user) do+ FactoryBot.create(:user,+ member_in_project: project,+ member_with_permissions: permissions)+ end++ let!(:meeting) { FactoryBot.create :meeting, project: project, title: 'Own awesome meeting!', author: user }+ let!(:other_meeting) { FactoryBot.create :meeting, project: project, title: 'Other awesome meeting!', author: other_user }++ before do+ login_as(user)+ end++ context 'with permission to delete meetings', js: true do+ let(:permissions) { %i[view_meetings delete_meetings] }++ it 'can delete own and other`s meetings' do+ visit meetings_path(project)++ click_link meeting.title+ click_link "Delete"++ page.accept_confirm++ expect(current_path)+ .to eql meetings_path(project)++ click_link other_meeting.title+ click_link "Delete"++ page.accept_confirm++ expect(current_path)+ .to eql meetings_path(project)++ expect(page)+ .to have_content(I18n.t('.no_results_title_text', cascade: true))+ end+ end++ context 'without permission to delete meetings' do+ let(:permissions) { %i[view_meetings] }++ it 'cannot delete own and other`s meetings' do+ visit meetings_path(project)++ click_link meeting.title+ expect(page)+ .to have_no_link 'Delete'++ visit meetings_path(project)++ click_link other_meeting.title+ expect(page)+ .to have_no_link 'Delete'+ end+ end+end