Skip to content

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

Adapt tests to new forum redirects && remove doubled possibility to add a new forum

Henriette Dinger97a2f8477b1b
diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb
index 345370933b9..3f0e996f51d 100644
--- a/app/views/forums/index.html.erb
+++ b/app/views/forums/index.html.erb
@@ -42,9 +42,7 @@ See docs/COPYRIGHT.rdoc for more details.
<% end %>
<% if @forums.empty? %>
- <%= no_results_box(action_url: new_project_forum_path(@project),
- display_action: true,
- custom_action_text: t('forums.no_results_content_text')) %>
+ <%= no_results_box(action_url: new_project_forum_path(@project)) %>
<% else %>
<div class="generic-table--container">
<div class="generic-table--results-container">
diff --git a/config/locales/en.yml b/config/locales/en.yml
index ed1efbaece8..615901b2b1b 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -125,7 +125,6 @@ en:
For more information, visit <a href="%{link}">the Net::LDAP documentation</a>.
forums:
- no_results_content_text: Create a new forum
show:
no_results_title_text: There are currently no posts for the forum.
diff --git a/spec/controllers/forums_controller_spec.rb b/spec/controllers/forums_controller_spec.rb
index cee691b69de..1ab9853930f 100644
--- a/spec/controllers/forums_controller_spec.rb
+++ b/spec/controllers/forums_controller_spec.rb
@@ -49,7 +49,7 @@ describe ForumsController, type: :controller do
end
expect(response).to be_successful
- expect(response).to render_template 'forums/show'
+ expect(response).to render_template 'forums/index'
expect(assigns(:forums)).to be_present
expect(assigns(:project)).to be_present
end
@@ -113,12 +113,11 @@ describe ForumsController, type: :controller do
end
end
- it 'should redirect to the settings page if successful' do
+ it 'should redirect to the index page if successful' do
expect(response)
- .to redirect_to controller: '/project_settings',
- action: 'show',
- id: project,
- tab: 'forums'
+ .to redirect_to controller: '/forums',
+ action: 'index',
+ project_id: project.id
end
it 'have a successful creation flash' do
@@ -178,7 +177,6 @@ describe ForumsController, type: :controller do
describe '#higher' do
let(:move_to) { 'higher' }
- let(:redirect_url) { "http://test.host/projects/#{project.id}/settings/forums" }
before do
post 'move', params: { id: forum_2.id,
@@ -190,7 +188,12 @@ describe ForumsController, type: :controller do
it do expect(response).to be_redirect end
- it do expect(response).to redirect_to(redirect_url) end
+ it do
+ expect(response)
+ .to redirect_to controller: '/forums',
+ action: 'index',
+ project_id: project.id
+ end
end
end
@@ -213,11 +216,10 @@ describe ForumsController, type: :controller do
end
end
- it 'should redirect to the settings page if successful' do
- expect(response).to redirect_to controller: '/project_settings',
- action: 'show',
- id: forum.project,
- tab: 'forums'
+ it 'should redirect to the index page if successful' do
+ expect(response).to redirect_to controller: '/forums',
+ action: 'index',
+ project_id: forum.project_id
end
it 'have a successful update flash' do
diff --git a/spec/features/forums/attachment_upload_spec.rb b/spec/features/forums/attachment_upload_spec.rb
index 5e9142201d0..8b8a6a06b0d 100644
--- a/spec/features/forums/attachment_upload_spec.rb
+++ b/spec/features/forums/attachment_upload_spec.rb
@@ -52,6 +52,7 @@ describe 'Upload attachment to forum message', js: true do
it 'can upload an image to new and existing messages via drag & drop' do
index_page.visit!
+ click_link forum.name
create_page = index_page.click_create_message
create_page.set_subject 'A new message'
diff --git a/spec/features/forums/message_spec.rb b/spec/features/forums/message_spec.rb
index ea3fc122134..b5eed426665 100644
--- a/spec/features/forums/message_spec.rb
+++ b/spec/features/forums/message_spec.rb
@@ -51,6 +51,7 @@ describe 'messages', type: :feature, js: true do
scenario 'adding, checking replies, replying' do
index_page.visit!
+ click_link forum.name
create_page = index_page.click_create_message
@@ -68,6 +69,7 @@ describe 'messages', type: :feature, js: true do
show_page.expect_content('There is no message here')
index_page.visit!
+ click_link forum.name
index_page.expect_listed(subject: 'The message is',
replies: 0)
@@ -86,6 +88,7 @@ describe 'messages', type: :feature, js: true do
content: 'But, but there should be one')
index_page.visit!
+ click_link forum.name
index_page.expect_listed(subject: 'The message is',
replies: 1,
@@ -109,6 +112,7 @@ describe 'messages', type: :feature, js: true do
expect(page).to have_selector('blockquote', text: 'But, but there should be one')
index_page.visit!
+ click_link forum.name
index_page.expect_listed(subject: 'The message is',
replies: 2,
last_message: 'And now to something completely different')
diff --git a/spec/features/forums/sticky_spec.rb b/spec/features/forums/sticky_spec.rb
index 2a2537fb3ed..f0017a7b8f4 100644
--- a/spec/features/forums/sticky_spec.rb
+++ b/spec/features/forums/sticky_spec.rb
@@ -56,7 +56,7 @@ describe 'sticky messages', type: :feature do
before do
login_as user
- visit project_forums_path(forum.project)
+ visit project_forum_path(forum.project, forum)
end
def expect_order_of_messages(*order)
@@ -75,7 +75,7 @@ describe 'sticky messages', type: :feature do
check('message[sticky]')
click_button('Save')
- visit project_forums_path(forum.project)
+ visit project_forum_path(forum.project, forum)
expect_order_of_messages(message2, message1, message3)
end