" \
"\n " \
@@ -70,7 +70,7 @@
end
end
- describe 'with a user not having the :view_work_package permission' do
+ describe "with a user not having the :view_work_package permission" do
before do
RolePermission.delete_all
end
@@ -79,17 +79,17 @@
end
end
- context 'for project description' do
- let(:params) { { id: project.last_journal.id.to_s, field: :description, format: 'js' } }
+ context "for project description" do
+ let(:params) { { id: project.last_journal.id.to_s, field: :description, format: "js" } }
before do
- project.update_attribute :description, 'description'
+ project.update_attribute :description, "description"
end
- describe 'with a user being member of the project' do
+ describe "with a user being member of the project" do
it { expect(response).to have_http_status(:ok) }
- it 'presents the diff correctly' do
+ it "presents the diff correctly" do
expect(response.body.strip).to eq(
"
" \
"\n " \
@@ -101,7 +101,7 @@
end
end
- describe 'with a user not being member of the project' do
+ describe "with a user not being member of the project" do
before do
Member.delete_all
end
@@ -111,13 +111,13 @@
describe 'when "Work Package Tracking" module is disabled' do
before do
- project.enabled_module_names -= ['work_package_tracking']
+ project.enabled_module_names -= ["work_package_tracking"]
end
it { expect(response).to have_http_status(:ok) }
end
- describe 'when project is archived' do
+ describe "when project is archived" do
before do
project.update(active: false)
end
@@ -126,28 +126,28 @@
end
end
- context 'for another field than description' do
+ context "for another field than description" do
shared_let(:work_package) do
create(:work_package, type: project.types.first,
author: user,
project:)
end
- let(:params) { { id: work_package.last_journal.id.to_s, field: :another_field, format: 'js' } }
+ let(:params) { { id: work_package.last_journal.id.to_s, field: :another_field, format: "js" } }
it { expect(response).to have_http_status(:not_found) }
end
- context 'for other types, like forum message' do
+ context "for other types, like forum message" do
shared_let(:forum) { create(:forum, project:) }
- shared_let(:message) { create(:message, forum:, content: 'initial content') }
+ shared_let(:message) { create(:message, forum:, content: "initial content") }
- let(:params) { { id: message.last_journal.id.to_s, field: :description, format: 'js' } }
+ let(:params) { { id: message.last_journal.id.to_s, field: :description, format: "js" } }
before do
- message.update_attribute :content, 'initial content updated'
+ message.update_attribute :content, "initial content updated"
end
- describe 'even with a user having all permissions' do
+ describe "even with a user having all permissions" do
before do
user.update(admin: true)
end
diff --git a/spec/controllers/ldap_auth_sources_controller_spec.rb b/spec/controllers/ldap_auth_sources_controller_spec.rb
index 2bf8f9262985..51def5ec42d5 100644
--- a/spec/controllers/ldap_auth_sources_controller_spec.rb
+++ b/spec/controllers/ldap_auth_sources_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe LdapAuthSourcesController do
let(:current_user) { create(:admin) }
@@ -36,7 +36,7 @@
allow(User).to receive(:current).and_return current_user
end
- describe 'new' do
+ describe "new" do
before do
get :new
end
@@ -45,13 +45,13 @@
it { is_expected.to respond_with :success }
it { is_expected.to render_template :new }
- it 'initializes a new LdapAuthSource' do
+ it "initializes a new LdapAuthSource" do
expect(assigns(:ldap_auth_source).class).to eq LdapAuthSource
expect(assigns(:ldap_auth_source)).to be_new_record
end
end
- describe 'index' do
+ describe "index" do
before do
get :index
end
@@ -60,9 +60,9 @@
it { is_expected.to render_template :index }
end
- describe 'create' do
+ describe "create" do
before do
- post :create, params: { ldap_auth_source: { name: 'Test', host: 'example.com', attr_login: 'foo' } }
+ post :create, params: { ldap_auth_source: { name: "Test", host: "example.com", attr_login: "foo" } }
end
it { is_expected.to respond_with :redirect }
@@ -70,8 +70,8 @@
it { is_expected.to set_flash.to /success/i }
end
- describe 'edit' do
- let(:ldap) { create(:ldap_auth_source, name: 'TestEdit') }
+ describe "edit" do
+ let(:ldap) { create(:ldap_auth_source, name: "TestEdit") }
before do
get :edit, params: { id: ldap.id }
@@ -82,11 +82,11 @@
it { is_expected.to render_template :edit }
end
- describe 'update' do
- let(:ldap) { create(:ldap_auth_source, name: 'TestEdit') }
+ describe "update" do
+ let(:ldap) { create(:ldap_auth_source, name: "TestEdit") }
before do
- post :update, params: { id: ldap.id, ldap_auth_source: { name: 'TestUpdate' } }
+ post :update, params: { id: ldap.id, ldap_auth_source: { name: "TestUpdate" } }
end
it { is_expected.to respond_with :redirect }
@@ -94,10 +94,10 @@
it { is_expected.to set_flash.to /update/i }
end
- describe 'destroy' do
- let(:ldap) { create(:ldap_auth_source, name: 'TestEdit') }
+ describe "destroy" do
+ let(:ldap) { create(:ldap_auth_source, name: "TestEdit") }
- context 'without users' do
+ context "without users" do
before do
post :destroy, params: { id: ldap.id }
end
@@ -107,8 +107,8 @@
it { is_expected.to set_flash.to /deletion/i }
end
- context 'with users' do
- let!(:ldap) { create(:ldap_auth_source, name: 'TestEdit') }
+ context "with users" do
+ let!(:ldap) { create(:ldap_auth_source, name: "TestEdit") }
let!(:user) { create(:user, ldap_auth_source: ldap) }
before do
@@ -117,48 +117,48 @@
it { is_expected.to respond_with :redirect }
- it 'does not destroy the LdapAuthSource' do
+ it "does not destroy the LdapAuthSource" do
expect(LdapAuthSource.find(ldap.id)).not_to be_nil
end
end
end
- context 'with password login disabled' do
+ context "with password login disabled" do
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(true)
end
- it 'cannot find index' do
+ it "cannot find index" do
get :index
expect(response).to have_http_status :not_found
end
- it 'cannot find new' do
+ it "cannot find new" do
get :new
expect(response).to have_http_status :not_found
end
- it 'cannot find create' do
- post :create, params: { ldap_auth_source: { name: 'Test' } }
+ it "cannot find create" do
+ post :create, params: { ldap_auth_source: { name: "Test" } }
expect(response).to have_http_status :not_found
end
- it 'cannot find edit' do
+ it "cannot find edit" do
get :edit, params: { id: 42 }
expect(response).to have_http_status :not_found
end
- it 'cannot find update' do
- post :update, params: { id: 42, ldap_auth_source: { name: 'TestUpdate' } }
+ it "cannot find update" do
+ post :update, params: { id: 42, ldap_auth_source: { name: "TestUpdate" } }
expect(response).to have_http_status :not_found
end
- it 'cannot find destroy' do
+ it "cannot find destroy" do
post :destroy, params: { id: 42 }
expect(response).to have_http_status :not_found
diff --git a/spec/controllers/messages_controller_spec.rb b/spec/controllers/messages_controller_spec.rb
index ed13eef02ec3..7c86587787a6 100644
--- a/spec/controllers/messages_controller_spec.rb
+++ b/spec/controllers/messages_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe MessagesController, with_settings: { journal_aggregation_time_minutes: 0 } do
let(:user) { create(:user) }
@@ -43,30 +43,30 @@
project:)
end
- let(:filename) { 'testfile.txt' }
- let(:file) { File.open(Rails.root.join('spec/fixtures/files', filename)) }
+ let(:filename) { "testfile.txt" }
+ let(:file) { File.open(Rails.root.join("spec/fixtures/files", filename)) }
before { allow(User).to receive(:current).and_return user }
- describe '#show' do
- context 'with a public project' do
+ describe "#show" do
+ context "with a public project" do
let(:user) { User.anonymous }
let(:project) { create(:public_project) }
let!(:message) { create(:message, forum:) }
- context 'when login_required', with_settings: { login_required: true } do
- it 'redirects to login' do
+ context "when login_required", with_settings: { login_required: true } do
+ it "redirects to login" do
get :show, params: { project_id: project.id, id: message.id }
expect(response).to redirect_to signin_path(back_url: topic_url(message.id))
end
end
- context 'when not login_required', with_settings: { login_required: false } do
- it 'renders the show template' do
+ context "when not login_required", with_settings: { login_required: false } do
+ it "renders the show template" do
get :show, params: { project_id: project.id, id: message.id }
expect(response).to be_successful
- expect(response).to render_template 'messages/show'
+ expect(response).to render_template "messages/show"
expect(assigns(:topic)).to be_present
expect(assigns(:forum)).to be_present
expect(assigns(:project)).to be_present
@@ -75,7 +75,7 @@
end
end
- describe '#update' do
+ describe "#update" do
let(:message) { create(:message, forum:) }
let(:other_forum) { create(:forum, project:) }
@@ -85,39 +85,39 @@
message: { forum_id: other_forum } }
end
- it 'allows for changing the board' do
+ it "allows for changing the board" do
expect(message.reload.forum).to eq(other_forum)
end
- context 'attachment upload' do
+ context "attachment upload" do
let!(:message) { create(:message) }
let(:attachment_id) { "attachments_#{message.attachments.first.id}" }
# Attachment is already uploaded
let(:attachment) { create(:attachment, container: nil, author: user) }
let(:params) do
{ id: message.id,
- attachments: { '0' => { 'id' => attachment.id } } }
+ attachments: { "0" => { "id" => attachment.id } } }
end
- describe 'add' do
+ describe "add" do
before do
allow_any_instance_of(Message).to receive(:editable_by?).and_return(true)
end
- context 'journal' do
+ context "journal" do
before do
put(:update, params:)
message.reload
end
- describe '#key' do
+ describe "#key" do
subject { message.journals.last.details }
it { is_expected.to have_key attachment_id }
end
- describe '#value' do
+ describe "#value" do
subject { message.journals.last.details[attachment_id].last }
it { is_expected.to eq(attachment.filename) }
@@ -126,7 +126,7 @@
end
end
- describe '#remove' do
+ describe "#remove" do
let!(:attachment) do
create(:attachment,
container: message,
@@ -146,16 +146,16 @@
message.reload
end
- context 'journal' do
+ context "journal" do
let(:attachment_id) { "attachments_#{attachment.id}" }
- describe '#key' do
+ describe "#key" do
subject { message.journals.last.details }
it { is_expected.to have_key attachment_id }
end
- describe '#value' do
+ describe "#value" do
subject { message.journals.last.details[attachment_id].first }
it { is_expected.to eq(filename) }
@@ -164,26 +164,26 @@
end
end
- describe 'quote' do
- let(:message) { create(:message, content: 'foo', subject: 'subject', forum:) }
+ describe "quote" do
+ let(:message) { create(:message, content: "foo", subject: "subject", forum:) }
- context 'when allowed' do
+ context "when allowed" do
let(:user) { create(:admin) }
before do
login_as user
end
- it 'renders the content as json' do
+ it "renders the content as json" do
get :quote, params: { forum_id: forum.id, id: message.id }, format: :json
expect(response).to be_successful
expect(response.body).to eq '{"subject":"RE: subject","content":" wrote:\n\u003e foo\n\n"}'
end
- it 'escapes HTML in quoted message author' do
- user.firstname = 'Hello'
- user.lastname = '
world'
+ it "escapes HTML in quoted message author" do
+ user.firstname = "Hello"
+ user.lastname = "
world"
user.save! validate: false
message.update!(author: user)
diff --git a/spec/controllers/my_controller_spec.rb b/spec/controllers/my_controller_spec.rb
index 004a5a49a352..c5cfc3781c42 100644
--- a/spec/controllers/my_controller_spec.rb
+++ b/spec/controllers/my_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe MyController do
let(:user) { create(:user) }
@@ -35,92 +35,92 @@
login_as(user)
end
- describe 'password change' do
- describe '#password' do
+ describe "password change" do
+ describe "#password" do
before do
get :password
end
- it 'renders the password template' do
- assert_template 'password'
+ it "renders the password template" do
+ assert_template "password"
assert_response :success
end
end
- describe 'with disabled password login' do
+ describe "with disabled password login" do
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(true)
post :change_password
end
- it 'is not found' do
+ it "is not found" do
expect(response.status).to eq 404
end
end
- describe 'with wrong confirmation' do
+ describe "with wrong confirmation" do
before do
post :change_password,
params: {
- password: 'adminADMIN!',
- new_password: 'adminADMIN!New',
- new_password_confirmation: 'adminADMIN!Other'
+ password: "adminADMIN!",
+ new_password: "adminADMIN!New",
+ new_password_confirmation: "adminADMIN!Other"
}
end
- it 'shows an error message' do
+ it "shows an error message" do
assert_response :success
- assert_template 'password'
+ assert_template "password"
expect(user.errors.attribute_names).to eq([:password_confirmation])
expect(user.errors.map(&:message).flatten)
.to contain_exactly("Password confirmation does not match password.")
end
end
- describe 'with wrong password' do
+ describe "with wrong password" do
render_views
before do
@current_password = user.current_password.id
post :change_password,
params: {
- password: 'wrongpassword',
- new_password: 'adminADMIN!New',
- new_password_confirmation: 'adminADMIN!New'
+ password: "wrongpassword",
+ new_password: "adminADMIN!New",
+ new_password_confirmation: "adminADMIN!New"
}
end
- it 'shows an error message' do
+ it "shows an error message" do
assert_response :success
- assert_template 'password'
- expect(flash[:error]).to eq('Wrong password')
+ assert_template "password"
+ expect(flash[:error]).to eq("Wrong password")
end
- it 'does not change the password' do
+ it "does not change the password" do
expect(user.current_password.id).to eq(@current_password)
end
end
- describe 'with good password and good confirmation' do
+ describe "with good password and good confirmation" do
before do
post :change_password,
params: {
- password: 'adminADMIN!',
- new_password: 'adminADMIN!New',
- new_password_confirmation: 'adminADMIN!New'
+ password: "adminADMIN!",
+ new_password: "adminADMIN!New",
+ new_password_confirmation: "adminADMIN!New"
}
end
- it 'redirects to the my password page' do
- expect(response).to redirect_to('/my/password')
+ it "redirects to the my password page" do
+ expect(response).to redirect_to("/my/password")
end
- it 'allows the user to login with the new password' do
- assert User.try_to_login(user.login, 'adminADMIN!New')
+ it "allows the user to login with the new password" do
+ assert User.try_to_login(user.login, "adminADMIN!New")
end
end
end
- describe 'account' do
+ describe "account" do
let(:custom_field) { create(:user_custom_field, :text) }
before do
@@ -130,69 +130,69 @@
end
end
- it 'responds with success' do
+ it "responds with success" do
expect(response).to be_successful
end
- it 'renders the account template' do
- expect(response).to render_template 'account'
+ it "renders the account template" do
+ expect(response).to render_template "account"
end
- it 'assigns @user' do
+ it "assigns @user" do
expect(assigns(:user)).to eq(user)
end
- context 'with render_views' do
+ context "with render_views" do
render_views
- it 'renders editable custom fields' do
+ it "renders editable custom fields" do
expect(response.body).to have_content(custom_field.name)
end
it "renders the 'Change password' menu entry" do
- expect(response.body).to have_css('#menu-sidebar li a', text: 'Change password')
+ expect(response.body).to have_css("#menu-sidebar li a", text: "Change password")
end
end
end
- describe 'settings' do
- describe 'PATCH' do
- let(:language) { 'en' }
+ describe "settings" do
+ describe "PATCH" do
+ let(:language) { "en" }
before do
as_logged_in_user user do
- user.pref.comments_sorting = 'desc'
+ user.pref.comments_sorting = "desc"
user.pref.auto_hide_popups = true
patch :update_settings, params: { user: { language: }, pref: { auto_hide_popups: 0 } }
end
end
- it 'updates the settings appropriately', :aggregate_failures do
+ it "updates the settings appropriately", :aggregate_failures do
expect(assigns(:user).language).to eq language
- expect(assigns(:user).pref.comments_sorting).to eql 'desc'
+ expect(assigns(:user).pref.comments_sorting).to eql "desc"
expect(assigns(:user).pref.auto_hide_popups?).to be_falsey
expect(request.path).to eq(my_settings_path)
expect(flash[:notice]).to eql I18n.t(:notice_account_updated)
end
- context 'when user is invalid' do
+ context "when user is invalid" do
let(:user) do
create(:user).tap do |u|
- u.update_column(:mail, 'something invalid')
+ u.update_column(:mail, "something invalid")
end
end
- it 'shows a flash error' do
- expect(flash[:error]).to include 'Email is not a valid email address.'
+ it "shows a flash error" do
+ expect(flash[:error]).to include "Email is not a valid email address."
expect(request.path).to eq(my_settings_path)
end
end
- context 'when changing language' do
- let(:language) { 'de' }
+ context "when changing language" do
+ let(:language) { "de" }
- it 'shows a flash message translated in the selected language' do
+ it "shows a flash message translated in the selected language" do
expect(assigns(:user).language).to eq(language)
expect(flash[:notice]).to eq(I18n.t(:notice_account_updated, locale: language))
end
@@ -200,8 +200,8 @@
end
end
- describe 'settings:auto_hide_popups' do
- context 'with render_views' do
+ describe "settings:auto_hide_popups" do
+ context "with render_views" do
before do
as_logged_in_user user do
get :settings
@@ -209,23 +209,23 @@
end
render_views
- it 'renders auto hide popups checkbox' do
- expect(response.body).to have_css('#my_account_form #pref_auto_hide_popups')
+ it "renders auto hide popups checkbox" do
+ expect(response.body).to have_css("#my_account_form #pref_auto_hide_popups")
end
end
- context 'PATCH' do
+ context "PATCH" do
before do
as_logged_in_user user do
user.pref.auto_hide_popups = false
- patch :update_settings, params: { user: { language: 'en' } }
+ patch :update_settings, params: { user: { language: "en" } }
end
end
end
end
- describe 'account with disabled password login' do
+ describe "account with disabled password login" do
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(true)
as_logged_in_user user do
@@ -236,13 +236,13 @@
render_views
it "does not render 'Change password' menu entry" do
- expect(response.body).to have_no_css('#menu-sidebar li a', text: 'Change password')
+ expect(response.body).to have_no_css("#menu-sidebar li a", text: "Change password")
end
end
- describe 'access_tokens' do
- describe 'rss' do
- it 'creates a key' do
+ describe "access_tokens" do
+ describe "rss" do
+ it "creates a key" do
expect(user.rss_token).to be_nil
post :generate_rss_key
@@ -253,10 +253,10 @@
expect(response).to redirect_to action: :access_token
end
- context 'with existing key' do
+ context "with existing key" do
let!(:key) { Token::RSS.create user: }
- it 'replaces the key' do
+ it "replaces the key" do
expect(user.rss_token).to eq(key)
post :generate_rss_key
@@ -272,9 +272,9 @@
end
end
- describe 'api' do
- context 'with no existing key' do
- it 'creates a key' do
+ describe "api" do
+ context "with no existing key" do
+ it "creates a key" do
expect(user.api_token).to be_nil
post :generate_api_key
@@ -288,10 +288,10 @@
end
end
- context 'with existing key' do
+ context "with existing key" do
let!(:key) { Token::API.create user: }
- it 'replaces the key' do
+ it "replaces the key" do
expect(user.reload.api_token).to eq(key)
post :generate_api_key
@@ -307,14 +307,14 @@
end
end
- describe 'ical' do
+ describe "ical" do
# unlike with the other tokens, creating new ical tokens is not done in this context
# ical tokens are generated whenever the user requests a new ical url
# a user can have N ical tokens
#
# in this context a specific ical token of a user should be reverted
# this invalidates the previously generated ical url
- context 'with existing keys' do
+ context "with existing keys" do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:query) { create(:query, project:) }
@@ -323,7 +323,7 @@
let!(:another_ical_token_for_query) { create(:ical_token, user:, query:, name: "Some Other Token Name") }
let!(:ical_token_for_another_query) { create(:ical_token, user:, query: another_query, name: "Some Token Name") }
- it 'revoke specific ical tokens' do
+ it "revoke specific ical tokens" do
expect(user.ical_tokens).to contain_exactly(
ical_token_for_query, another_ical_token_for_query, ical_token_for_another_query
)
@@ -346,7 +346,7 @@
end
end
- describe 'file storage' do
+ describe "file storage" do
let(:client) { create(:oauth_client, integration: create(:nextcloud_storage)) }
let(:token) { create(:oauth_client_token, oauth_client: client, scope: nil, user:, expires_in: 3_600) }
@@ -354,12 +354,12 @@
before { token }
- it 'list the tokens' do
+ it "list the tokens" do
get :access_token
expect(response.body).to have_css("#storage-oauth-token-#{token.id}")
end
- it 'can remove the token' do
+ it "can remove the token" do
expect do
delete :delete_storage_token, params: { id: token.id }
end.to change(OAuthClientToken, :count).by(-1)
diff --git a/spec/controllers/news/comments_controller_spec.rb b/spec/controllers/news/comments_controller_spec.rb
index d3ac2672d6b2..06dcfafc53bc 100644
--- a/spec/controllers/news/comments_controller_spec.rb
+++ b/spec/controllers/news/comments_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe News::CommentsController do
render_views
@@ -38,28 +38,28 @@
allow(User).to receive(:current).and_return user
end
- describe '#create' do
- it 'assigns a comment to the news item and redirects to the news page' do
- post :create, params: { news_id: news.id, comment: { comments: 'This is a test comment' } }
+ describe "#create" do
+ it "assigns a comment to the news item and redirects to the news page" do
+ post :create, params: { news_id: news.id, comment: { comments: "This is a test comment" } }
expect(response).to redirect_to news_path(news)
latest_comment = news.comments.reorder(created_at: :desc).first
expect(latest_comment).not_to be_nil
- expect(latest_comment.comments).to eq 'This is a test comment'
+ expect(latest_comment.comments).to eq "This is a test comment"
expect(latest_comment.author).to eq user
end
it "doesn't create a comment when it is invalid" do
expect do
- post :create, params: { news_id: news.id, comment: { comments: '' } }
+ post :create, params: { news_id: news.id, comment: { comments: "" } }
expect(response).to redirect_to news_path(news)
end.not_to change { Comment.count }
end
end
- describe '#destroy' do
- it 'deletes the comment and redirects to the news page' do
+ describe "#destroy" do
+ it "deletes the comment and redirects to the news page" do
comment = create(:comment, commented: news)
expect do
diff --git a/spec/controllers/news_controller_spec.rb b/spec/controllers/news_controller_spec.rb
index f0ea7a49c2f9..daebacc36056 100644
--- a/spec/controllers/news_controller_spec.rb
+++ b/spec/controllers/news_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe NewsController do
render_views
@@ -43,80 +43,80 @@
allow(User).to receive(:current).and_return user
end
- describe '#index' do
- it 'renders index' do
+ describe "#index" do
+ it "renders index" do
get :index
expect(response).to be_successful
- expect(response).to render_template 'index'
+ expect(response).to render_template "index"
expect(assigns(:project)).to be_nil
expect(assigns(:newss)).not_to be_nil
end
- it 'renders index with project' do
+ it "renders index with project" do
get :index, params: { project_id: project.id }
expect(response).to be_successful
- expect(response).to render_template 'index'
+ expect(response).to render_template "index"
expect(assigns(:newss)).not_to be_nil
end
end
- describe '#show' do
- it 'renders show' do
+ describe "#show" do
+ it "renders show" do
get :show, params: { id: news.id }
expect(response).to be_successful
- expect(response).to render_template 'show'
+ expect(response).to render_template "show"
- expect(response.body).to have_css('h2', text: news.title)
+ expect(response.body).to have_css("h2", text: news.title)
end
- it 'renders show with slug' do
+ it "renders show with slug" do
get :show, params: { id: "#{news.id}-some-news-title" }
expect(response).to be_successful
- expect(response).to render_template 'show'
+ expect(response).to render_template "show"
- expect(response.body).to have_css('h2', text: news.title)
+ expect(response.body).to have_css("h2", text: news.title)
end
- it 'renders error if news item is not found' do
+ it "renders error if news item is not found" do
get :show, params: { id: -1 }
expect(response).to be_not_found
end
end
- describe '#new' do
- it 'renders new' do
+ describe "#new" do
+ it "renders new" do
get :new, params: { project_id: project.id }
expect(response).to be_successful
- expect(response).to render_template 'new'
+ expect(response).to render_template "new"
end
end
- describe '#create' do
- context 'with news_added notifications' do
- it 'persists a news item' do
+ describe "#create" do
+ context "with news_added notifications" do
+ it "persists a news item" do
become_member(project, user)
post :create,
params: {
project_id: project.id,
news: {
- title: 'NewsControllerTest',
- description: 'This is the description',
- summary: ''
+ title: "NewsControllerTest",
+ description: "This is the description",
+ summary: ""
}
}
expect(response).to redirect_to project_news_index_path(project)
- news = News.find_by!(title: 'NewsControllerTest')
+ news = News.find_by!(title: "NewsControllerTest")
expect(news).not_to be_nil
- expect(news.description).to eq 'This is the description'
+ expect(news.description).to eq "This is the description"
expect(news.author).to eq user
expect(news.project).to eq project
end
@@ -127,43 +127,43 @@
params: {
project_id: project.id,
news: {
- title: '',
- description: 'This is the description',
- summary: ''
+ title: "",
+ description: "This is the description",
+ summary: ""
}
}
expect(response).to be_successful
- expect(response).to render_template 'new'
+ expect(response).to render_template "new"
expect(assigns(:news)).not_to be_nil
expect(assigns(:news)).to be_new_record
- expect(response.body).to have_css('div.op-toast.-error', text: /1 error/)
+ expect(response.body).to have_css("div.op-toast.-error", text: /1 error/)
end
end
- describe '#edit' do
- it 'renders edit' do
+ describe "#edit" do
+ it "renders edit" do
get :edit, params: { id: news.id }
expect(response).to be_successful
- expect(response).to render_template 'edit'
+ expect(response).to render_template "edit"
end
end
- describe '#update' do
- it 'updates the news element' do
+ describe "#update" do
+ it "updates the news element" do
put :update,
- params: { id: news.id, news: { description: 'Description changed by test_post_edit' } }
+ params: { id: news.id, news: { description: "Description changed by test_post_edit" } }
expect(response).to redirect_to news_path(news)
news.reload
- expect(news.description).to eq 'Description changed by test_post_edit'
+ expect(news.description).to eq "Description changed by test_post_edit"
end
end
- describe '#destroy' do
- it 'deletes the news element and redirects to the news overview page' do
+ describe "#destroy" do
+ it "deletes the news element and redirects to the news overview page" do
delete :destroy, params: { id: news.id }
expect(response).to redirect_to project_news_index_path(news.project)
diff --git a/spec/controllers/oauth/applications_controller_spec.rb b/spec/controllers/oauth/applications_controller_spec.rb
index 6677683cf0c7..5ab1af33d4a8 100644
--- a/spec/controllers/oauth/applications_controller_spec.rb
+++ b/spec/controllers/oauth/applications_controller_spec.rb
@@ -26,21 +26,21 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'work_package'
+require "spec_helper"
+require "work_package"
RSpec.describe OAuth::ApplicationsController do
let(:user) { build_stubbed(:admin) }
- let(:application_stub) { build_stubbed(:oauth_application, id: 1, secret: 'foo') }
+ let(:application_stub) { build_stubbed(:oauth_application, id: 1, secret: "foo") }
before do
login_as user
end
- context 'not logged as admin' do
+ context "not logged as admin" do
let(:user) { build_stubbed(:user) }
- it 'does not grant access' do
+ it "does not grant access" do
get :index
expect(response.response_code).to eq 403
@@ -61,7 +61,7 @@
end
end
- describe '#new' do
+ describe "#new" do
it do
get :new
expect(response.status).to be 200
@@ -69,58 +69,58 @@
end
end
- describe '#edit' do
+ describe "#edit" do
before do
allow(Doorkeeper::Application)
.to receive(:find)
- .with('1')
+ .with("1")
.and_return(application_stub)
end
it do
- get :edit, params: { id: 1, application: { name: 'foo' } }
+ get :edit, params: { id: 1, application: { name: "foo" } }
expect(response.status).to be 200
expect(response).to render_template :edit
end
end
- describe '#create' do
+ describe "#create" do
before do
allow(Doorkeeper::Application)
.to receive(:new)
.and_return(application_stub)
expect(application_stub).to receive(:attributes=)
expect(application_stub).to receive(:save).and_return(true)
- expect(application_stub).to receive(:plaintext_secret).and_return('secret!')
+ expect(application_stub).to receive(:plaintext_secret).and_return("secret!")
end
it do
- post :create, params: { application: { name: 'foo' } }
+ post :create, params: { application: { name: "foo" } }
expect(response).to redirect_to action: :show, id: application_stub.id
end
end
- describe '#update' do
+ describe "#update" do
before do
allow(Doorkeeper::Application)
.to receive(:find)
- .with('1')
+ .with("1")
.and_return(application_stub)
expect(application_stub).to receive(:attributes=)
expect(application_stub).to receive(:save).and_return(true)
end
it do
- patch :update, params: { id: 1, application: { name: 'foo' } }
+ patch :update, params: { id: 1, application: { name: "foo" } }
expect(response).to redirect_to action: :index
end
end
- describe '#destroy' do
+ describe "#destroy" do
before do
allow(Doorkeeper::Application)
.to receive(:find)
- .with('1')
+ .with("1")
.and_return(application_stub)
expect(application_stub).to receive(:destroy).and_return(true)
end
diff --git a/spec/controllers/oauth/grants_controller_spec.rb b/spec/controllers/oauth/grants_controller_spec.rb
index 4a280584febd..2ad78d320223 100644
--- a/spec/controllers/oauth/grants_controller_spec.rb
+++ b/spec/controllers/oauth/grants_controller_spec.rb
@@ -26,27 +26,27 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'work_package'
+require "spec_helper"
+require "work_package"
RSpec.describe OAuth::GrantsController do
let(:user) { build_stubbed(:user) }
- let(:application_stub) { instance_double(Doorkeeper::Application, name: 'Foo', id: 1) }
+ let(:application_stub) { instance_double(Doorkeeper::Application, name: "Foo", id: 1) }
before do
login_as user
end
- describe '#revoke_application' do
- context 'when not found' do
- it 'renders 404' do
+ describe "#revoke_application" do
+ context "when not found" do
+ it "renders 404" do
post :revoke_application, params: { application_id: 1234 }
expect(flash[:notice]).to be_nil
expect(response.response_code).to eq 404
end
end
- context 'when found' do
+ context "when found" do
before do
allow(controller)
.to receive(:find_application)
@@ -55,8 +55,8 @@
it do
post :revoke_application, params: { application_id: 1 }
- expect(flash[:notice]).to include 'Foo'
- expect(response).to redirect_to controller: '/my', action: :access_token
+ expect(flash[:notice]).to include "Foo"
+ expect(response).to redirect_to controller: "/my", action: :access_token
end
end
end
diff --git a/spec/controllers/placeholder_users/memberships_controller_spec.rb b/spec/controllers/placeholder_users/memberships_controller_spec.rb
index 05dda05320f4..b4bf36edf6e6 100644
--- a/spec/controllers/placeholder_users/memberships_controller_spec.rb
+++ b/spec/controllers/placeholder_users/memberships_controller_spec.rb
@@ -26,8 +26,8 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'work_package'
+require "spec_helper"
+require "work_package"
RSpec.describe PlaceholderUsers::MembershipsController do
shared_let(:placeholder_user) { create(:placeholder_user) }
@@ -35,8 +35,8 @@
shared_let(:project) { create(:project) }
shared_let(:role) { create(:project_role) }
- shared_examples 'update memberships flow' do
- it 'works' do
+ shared_examples "update memberships flow" do
+ it "works" do
# i.e. it should successfully add a placeholder user to a project's members
post :create,
params: {
@@ -47,10 +47,10 @@
}
}
- expect(response).to redirect_to(controller: '/placeholder_users',
- action: 'edit',
+ expect(response).to redirect_to(controller: "/placeholder_users",
+ action: "edit",
id: placeholder_user.id,
- tab: 'memberships')
+ tab: "memberships")
is_member = placeholder_user.reload.memberships.any? do |m|
m.project_id == project.id && m.role_ids.include?(role.id)
@@ -59,9 +59,9 @@
end
end
- shared_examples 'update memberships forbidden flow' do
- describe 'POST create' do
- it 'returns an error' do
+ shared_examples "update memberships forbidden flow" do
+ describe "POST create" do
+ it "returns an error" do
post :create, params: {
placeholder_user_id: placeholder_user.id,
membership: {
@@ -74,8 +74,8 @@
end
end
- describe 'PUT update' do
- it 'returns an error' do
+ describe "PUT update" do
+ it "returns an error" do
put :update, params: {
placeholder_user_id: placeholder_user.id,
id: 1234
@@ -85,8 +85,8 @@
end
end
- describe 'DELETE destroy' do
- it 'returns an error' do
+ describe "DELETE destroy" do
+ it "returns an error" do
delete :destroy, params: {
placeholder_user_id: placeholder_user.id,
id: 1234
@@ -97,27 +97,27 @@
end
end
- context 'as admin' do
+ context "as admin" do
current_user { create(:admin) }
- it_behaves_like 'update memberships flow'
+ it_behaves_like "update memberships flow"
end
- context 'as user with global permission and manage_members' do
+ context "as user with global permission and manage_members" do
current_user do
create(:user,
member_with_permissions: { project => %i[manage_members] },
global_permissions: %i[manage_placeholder_user])
end
- it_behaves_like 'update memberships flow'
+ it_behaves_like "update memberships flow"
end
- context 'as user with global permission but not project permission' do
+ context "as user with global permission but not project permission" do
current_user { create(:user, global_permissions: %i[manage_placeholder_user]) }
- describe 'POST create' do
- it 'redirects but fails to create' do
+ describe "POST create" do
+ it "redirects but fails to create" do
post :create, params: {
placeholder_user_id: placeholder_user.id,
membership: {
@@ -131,12 +131,12 @@
end
end
- context 'with a membership in another project that is invisible' do
+ context "with a membership in another project that is invisible" do
shared_let(:project2) { create(:project) }
shared_let(:membership) { create(:member, principal: placeholder_user, project: project2, roles: [role]) }
- describe 'PUT update' do
- it 'returns an error' do
+ describe "PUT update" do
+ it "returns an error" do
put :update, params: {
placeholder_user_id: placeholder_user.id,
id: membership.id
@@ -146,8 +146,8 @@
end
end
- describe 'DELETE destroy' do
- it 'returns an error' do
+ describe "DELETE destroy" do
+ it "returns an error" do
delete :destroy, params: {
placeholder_user_id: placeholder_user.id,
id: membership.id
@@ -159,9 +159,9 @@
end
end
- context 'as user without global permission' do
+ context "as user without global permission" do
current_user { create(:user) }
- it_behaves_like 'update memberships forbidden flow'
+ it_behaves_like "update memberships forbidden flow"
end
end
diff --git a/spec/controllers/placeholder_users_controller_spec.rb b/spec/controllers/placeholder_users_controller_spec.rb
index 43b01dbc41d3..401464a45a11 100644
--- a/spec/controllers/placeholder_users_controller_spec.rb
+++ b/spec/controllers/placeholder_users_controller_spec.rb
@@ -26,58 +26,58 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'work_package'
+require "spec_helper"
+require "work_package"
RSpec.describe PlaceholderUsersController do
shared_let(:placeholder_user) { create(:placeholder_user) }
- shared_examples 'do not allow non-admins' do
- it 'responds with unauthorized status' do
+ shared_examples "do not allow non-admins" do
+ it "responds with unauthorized status" do
expect(response).not_to be_successful
expect(response.status).to eq 403
end
end
- shared_examples 'renders the show template' do
- it 'renders the show template' do
+ shared_examples "renders the show template" do
+ it "renders the show template" do
get :show, params: { id: placeholder_user.id }
expect(response).to be_successful
- expect(response).to render_template 'placeholder_users/show'
+ expect(response).to render_template "placeholder_users/show"
expect(assigns(:placeholder_user)).to be_present
expect(assigns(:memberships)).to be_empty
end
end
- shared_examples 'authorized flows' do
- describe 'GET new' do
- it 'renders the new template' do
+ shared_examples "authorized flows" do
+ describe "GET new" do
+ it "renders the new template" do
get :new
expect(response).to be_successful
- expect(response).to render_template 'placeholder_users/new'
+ expect(response).to render_template "placeholder_users/new"
expect(assigns(:placeholder_user)).to be_present
end
end
- describe 'GET index' do
- it 'renders the index template' do
+ describe "GET index" do
+ it "renders the index template" do
get :index
expect(response).to be_successful
- expect(response).to render_template 'placeholder_users/index'
+ expect(response).to render_template "placeholder_users/index"
expect(assigns(:placeholder_users)).to be_present
expect(assigns(:groups)).not_to be_present
end
end
- describe 'GET show' do
- it_behaves_like 'renders the show template'
+ describe "GET show" do
+ it_behaves_like "renders the show template"
end
- describe 'GET edit' do
- it 'renders the show template' do
+ describe "GET edit" do
+ it "renders the show template" do
get :edit, params: { id: placeholder_user.id }
expect(response).to be_successful
expect(response).to render_template "placeholder_users/edit"
@@ -87,11 +87,11 @@
end
end
- describe 'POST create' do
+ describe "POST create" do
let(:params) do
{
placeholder_user: {
- name: 'UX Developer'
+ name: "UX Developer"
}
}
end
@@ -100,8 +100,8 @@
post :create, params:
end
- context 'without ee' do
- it 'returns with an error' do
+ context "without ee" do
+ it "returns with an error" do
expect { post :create, params: }.not_to change { PlaceholderUser.count }
expect(response).to be_successful
@@ -110,73 +110,73 @@
end
end
- context 'with ee', with_ee: %i[placeholder_users] do
- it 'is assigned their new values' do
+ context "with ee", with_ee: %i[placeholder_users] do
+ it "is assigned their new values" do
user_from_db = PlaceholderUser.last
- expect(user_from_db.name).to eq('UX Developer')
+ expect(user_from_db.name).to eq("UX Developer")
end
- it 'shows a success notice' do
+ it "shows a success notice" do
expect(flash[:notice]).to eql(I18n.t(:notice_successful_create))
end
- it 'does not send an email' do
+ it "does not send an email" do
expect(ActionMailer::Base.deliveries.empty?).to be_truthy
end
- context 'when user chose to directly create the next placeholder user' do
+ context "when user chose to directly create the next placeholder user" do
let(:params) do
{
placeholder_user: {
- name: 'UX Developer'
+ name: "UX Developer"
},
continue: true
}
end
- it 'redirects to the new page' do
+ it "redirects to the new page" do
expect(response).to redirect_to(new_placeholder_user_url)
end
end
- context 'when user chose to NOT directly create the next placeholder user' do
+ context "when user chose to NOT directly create the next placeholder user" do
let(:params) do
{
placeholder_user: {
- name: 'UX Developer'
+ name: "UX Developer"
}
}
end
- it 'redirects to the edit page' do
+ it "redirects to the edit page" do
user_from_db = PlaceholderUser.last
expect(response).to redirect_to(edit_placeholder_user_url(user_from_db))
end
end
- context 'invalid params' do
+ context "invalid params" do
let(:params) do
{
placeholder_user: {
- name: 'x' * 300 # Name is too long
+ name: "x" * 300 # Name is too long
}
}
end
- it 'renders the edit form with a validation error message' do
- expect(assigns(:placeholder_user).errors.messages[:name].first).to include('is too long')
- expect(response).to render_template 'placeholder_users/new'
+ it "renders the edit form with a validation error message" do
+ expect(assigns(:placeholder_user).errors.messages[:name].first).to include("is too long")
+ expect(response).to render_template "placeholder_users/new"
end
end
end
end
- describe 'PUT update' do
+ describe "PUT update" do
let(:params) do
{
id: placeholder_user.id,
placeholder_user: {
- name: 'UX Guru'
+ name: "UX Guru"
}
}
end
@@ -185,53 +185,53 @@
put :update, params:
end
- it 'redirects to the edit page' do
+ it "redirects to the edit page" do
expect(response).to redirect_to(edit_placeholder_user_url(placeholder_user))
end
- it 'is assigned their new values' do
+ it "is assigned their new values" do
user_from_db = PlaceholderUser.find(placeholder_user.id)
- expect(user_from_db.name).to eq('UX Guru')
+ expect(user_from_db.name).to eq("UX Guru")
end
- it 'does not send an email' do
+ it "does not send an email" do
expect(ActionMailer::Base.deliveries.empty?).to be_truthy
end
- context 'invalid params' do
+ context "invalid params" do
let(:params) do
{
id: placeholder_user.id,
placeholder_user: {
- name: 'x' * 300 # Name is too long
+ name: "x" * 300 # Name is too long
}
}
end
- it 'renders the edit form with a validation error message' do
- expect(assigns(:placeholder_user).errors.messages[:name].first).to include('is too long')
- expect(response).to render_template 'placeholder_users/edit'
+ it "renders the edit form with a validation error message" do
+ expect(assigns(:placeholder_user).errors.messages[:name].first).to include("is too long")
+ expect(response).to render_template "placeholder_users/edit"
end
end
end
- describe 'GET deletion_info' do
+ describe "GET deletion_info" do
before do
get :deletion_info, params: { id: placeholder_user.id }
end
- it 'renders the deletion info response' do
+ it "renders the deletion info response" do
expect(response).to be_successful
- expect(response).to render_template 'placeholder_users/deletion_info'
+ expect(response).to render_template "placeholder_users/deletion_info"
end
end
- describe 'POST destroy' do
+ describe "POST destroy" do
before do
delete :destroy, params: { id: placeholder_user.id }
end
- it 'triggers the deletion' do
+ it "triggers the deletion" do
expect(response).to redirect_to action: :index
expect(flash[:info]).to include I18n.t(:notice_deletion_scheduled)
@@ -241,53 +241,53 @@
end
end
- context 'as an admin' do
+ context "as an admin" do
current_user { create(:admin) }
- it_behaves_like 'authorized flows'
+ it_behaves_like "authorized flows"
end
- context 'as a user with global permission' do
+ context "as a user with global permission" do
current_user { create(:user, global_permissions: %i[manage_placeholder_user]) }
- it_behaves_like 'authorized flows'
+ it_behaves_like "authorized flows"
end
- context 'as an unauthorized user' do
+ context "as an unauthorized user" do
current_user { create(:user) }
- describe 'GET new' do
+ describe "GET new" do
before do
get :new
end
- it_behaves_like 'do not allow non-admins'
+ it_behaves_like "do not allow non-admins"
end
- describe 'GET index' do
+ describe "GET index" do
before do
get :index
end
- it_behaves_like 'do not allow non-admins'
+ it_behaves_like "do not allow non-admins"
end
- describe 'GET show' do
- it_behaves_like 'renders the show template'
+ describe "GET show" do
+ it_behaves_like "renders the show template"
end
- describe 'GET edit' do
+ describe "GET edit" do
before do
get :edit, params: { id: placeholder_user.id }
end
- it_behaves_like 'do not allow non-admins'
+ it_behaves_like "do not allow non-admins"
end
- describe 'POST create' do
+ describe "POST create" do
let(:params) do
{
placeholder_user: {
- name: 'UX Developer'
+ name: "UX Developer"
}
}
end
@@ -296,15 +296,15 @@
post :create, params:
end
- it_behaves_like 'do not allow non-admins'
+ it_behaves_like "do not allow non-admins"
end
- describe 'PUT update' do
+ describe "PUT update" do
let(:params) do
{
id: placeholder_user.id,
placeholder_user: {
- name: 'UX Guru'
+ name: "UX Guru"
}
}
end
@@ -313,27 +313,27 @@
put :update, params:
end
- it_behaves_like 'do not allow non-admins'
+ it_behaves_like "do not allow non-admins"
end
- describe 'GET deletion_info' do
+ describe "GET deletion_info" do
before do
get :deletion_info, params: { id: placeholder_user.id }
end
- it_behaves_like 'do not allow non-admins'
+ it_behaves_like "do not allow non-admins"
end
- describe 'POST destroy' do
+ describe "POST destroy" do
before do
delete :destroy, params: { id: placeholder_user.id }
end
- it_behaves_like 'do not allow non-admins'
+ it_behaves_like "do not allow non-admins"
end
end
- context 'as a user that may not delete the placeholder' do
+ context "as a user that may not delete the placeholder" do
current_user { create(:user) }
before do
@@ -341,23 +341,23 @@
.to receive(:deletion_allowed?).and_return false
end
- describe 'GET deletion_info' do
+ describe "GET deletion_info" do
before do
get :deletion_info, params: { id: placeholder_user.id }
end
- it 'responds with unauthorized status' do
+ it "responds with unauthorized status" do
expect(response).not_to be_successful
expect(response.status).to eq 403
end
end
- describe 'POST destroy' do
+ describe "POST destroy" do
before do
delete :destroy, params: { id: placeholder_user.id }
end
- it 'responds with unauthorized status' do
+ it "responds with unauthorized status" do
expect(response).not_to be_successful
expect(response.status).to eq 403
end
diff --git a/spec/controllers/projects/identifier_controller_spec.rb b/spec/controllers/projects/identifier_controller_spec.rb
index 9737d06daa49..de3fe73828a1 100644
--- a/spec/controllers/projects/identifier_controller_spec.rb
+++ b/spec/controllers/projects/identifier_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'rails_helper'
+require "rails_helper"
RSpec.describe Projects::IdentifierController do
let(:project) { create(:project) }
@@ -34,22 +34,22 @@
current_user { create(:admin) }
render_views
- describe 'update' do
- it 'sets the project identifier to the provided value' do
- put :update, params: { project_id: project.id, project: { identifier: 'new-identifier' } }
+ describe "update" do
+ it "sets the project identifier to the provided value" do
+ put :update, params: { project_id: project.id, project: { identifier: "new-identifier" } }
# Upon success, the user is redirected to the general project settings page
expect(response).to have_http_status(:redirect)
- expect(project.reload.identifier).to eq('new-identifier')
+ expect(project.reload.identifier).to eq("new-identifier")
end
- context 'with an invalid identifier' do
- it 'does not change the project identifier and correctly renders the view' do
+ context "with an invalid identifier" do
+ it "does not change the project identifier and correctly renders the view" do
previous_identifier = project.identifier
- put :update, params: { project_id: project.id, project: { identifier: 'bad identifier' } }
+ put :update, params: { project_id: project.id, project: { identifier: "bad identifier" } }
expect(response).to have_http_status(:ok)
- expect(response.body).to include('Identifier is invalid')
+ expect(response.body).to include("Identifier is invalid")
expect(project.reload.identifier).to eq(previous_identifier)
end
end
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 7e8da4e84cd4..ec6ae981a623 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe ProjectsController do
shared_let(:admin) { create(:admin) }
@@ -38,14 +38,14 @@
login_as admin
end
- describe '#new' do
+ describe "#new" do
it "renders 'new'" do
- get 'new'
+ get "new"
expect(response).to be_successful
- expect(response).to render_template 'new'
+ expect(response).to render_template "new"
end
- context 'by non-admin user with add_project permission' do
+ context "by non-admin user with add_project permission" do
let(:non_member_user) { create(:user) }
before do
@@ -53,40 +53,40 @@
login_as non_member_user
end
- it 'accepts get' do
+ it "accepts get" do
get :new
expect(response).to be_successful
- expect(response).to render_template 'new'
+ expect(response).to render_template "new"
end
end
end
- describe 'index.html' do
- shared_let(:project_a) { create(:project, name: 'Project A', public: false, active: true) }
- shared_let(:project_b) { create(:project, name: 'Project B', public: false, active: true) }
- shared_let(:project_c) { create(:project, name: 'Project C', public: true, active: true) }
- shared_let(:project_d) { create(:project, name: 'Project D', public: true, active: false) }
+ describe "index.html" do
+ shared_let(:project_a) { create(:project, name: "Project A", public: false, active: true) }
+ shared_let(:project_b) { create(:project, name: "Project B", public: false, active: true) }
+ shared_let(:project_c) { create(:project, name: "Project C", public: true, active: true) }
+ shared_let(:project_d) { create(:project, name: "Project D", public: true, active: false) }
before do
ProjectRole.anonymous
ProjectRole.non_member
login_as(user)
- get 'index'
+ get "index"
end
- shared_examples_for 'successful index' do
- it 'is success' do
+ shared_examples_for "successful index" do
+ it "is success" do
expect(response).to be_successful
end
- it 'renders the index template' do
- expect(response).to render_template 'index'
+ it "renders the index template" do
+ expect(response).to render_template "index"
end
end
end
- describe '#destroy' do
+ describe "#destroy" do
render_views
let(:project) { build_stubbed(:project) }
@@ -105,20 +105,20 @@
.and_return(deletion_service)
end
- context 'when service call succeeds' do
+ context "when service call succeeds" do
let(:success) { true }
- it 'prints success' do
+ it "prints success" do
request
expect(response).to be_redirect
expect(flash[:notice]).to be_present
end
end
- context 'when service call fails' do
+ context "when service call fails" do
let(:success) { false }
- it 'prints fail' do
+ it "prints fail" do
request
expect(response).to be_redirect
expect(flash[:error]).to be_present
@@ -126,28 +126,28 @@
end
end
- describe 'with an existing project' do
- let(:project) { create(:project, identifier: 'blog') }
+ describe "with an existing project" do
+ let(:project) { create(:project, identifier: "blog") }
- it 'gets destroy info' do
+ it "gets destroy info" do
get :destroy_info, params: { id: project.id }
expect(response).to be_successful
- expect(response).to render_template 'destroy_info'
+ expect(response).to render_template "destroy_info"
expect { project.reload }.not_to raise_error
end
end
- describe '#copy' do
- let(:project) { create(:project, identifier: 'blog') }
+ describe "#copy" do
+ let(:project) { create(:project, identifier: "blog") }
it "renders 'copy'" do
- get 'copy', params: { id: project.id }
+ get "copy", params: { id: project.id }
expect(response).to be_successful
- expect(response).to render_template 'copy'
+ expect(response).to render_template "copy"
end
- context 'as non authorized user' do
+ context "as non authorized user" do
let(:user) { build_stubbed(:user) }
before do
@@ -155,7 +155,7 @@
end
it "shows an error" do
- get 'copy', params: { id: project.id }
+ get "copy", params: { id: project.id }
expect(response.status).to eq 403
end
end
diff --git a/spec/controllers/projects_settings_menu_controller_spec.rb b/spec/controllers/projects_settings_menu_controller_spec.rb
index 380e4acc2e5e..9dbc944a742c 100644
--- a/spec/controllers/projects_settings_menu_controller_spec.rb
+++ b/spec/controllers/projects_settings_menu_controller_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe Projects::Settings::ModulesController, 'menu' do
+RSpec.describe Projects::Settings::ModulesController, "menu" do
let(:current_user) { build_stubbed(:user) }
let(:project) do
@@ -43,84 +43,84 @@
login_as(current_user)
end
- shared_examples_for 'renders the modules show page' do
- it 'renders show' do
- get('show', params:)
+ shared_examples_for "renders the modules show page" do
+ it "renders show" do
+ get("show", params:)
expect(response).to be_successful
- expect(response).to render_template 'projects/settings/modules/show'
+ expect(response).to render_template "projects/settings/modules/show"
end
end
- shared_examples_for 'has selector' do |selector|
+ shared_examples_for "has selector" do |selector|
render_views
it do
- get('show', params:)
+ get("show", params:)
expect(response.body).to have_selector selector
end
end
- shared_examples_for 'has no selector' do |selector|
+ shared_examples_for "has no selector" do |selector|
render_views
it do
- get('show', params:)
+ get("show", params:)
expect(response.body).to have_no_selector selector
end
end
- describe 'show' do
- describe 'without wiki' do
+ describe "show" do
+ describe "without wiki" do
before do
project.wiki.destroy
project.reload
end
- it_behaves_like 'renders the modules show page'
+ it_behaves_like "renders the modules show page"
- it_behaves_like 'has no selector', '#main-menu a.wiki-wiki-menu-item'
+ it_behaves_like "has no selector", "#main-menu a.wiki-wiki-menu-item"
end
- describe 'with wiki' do
- describe 'without custom wiki menu items' do
- it_behaves_like 'has selector', '#main-menu a.wiki-wiki-menu-item'
+ describe "with wiki" do
+ describe "without custom wiki menu items" do
+ it_behaves_like "has selector", "#main-menu a.wiki-wiki-menu-item"
end
- describe 'with custom wiki menu item' do
+ describe "with custom wiki menu item" do
before do
main_item = create(:wiki_menu_item,
navigatable_id: project.wiki.id,
- name: 'example',
- title: 'Example Title')
+ name: "example",
+ title: "Example Title")
create(:wiki_menu_item,
navigatable_id: project.wiki.id,
- name: 'sub',
- title: 'Sub Title',
+ name: "sub",
+ title: "Sub Title",
parent_id: main_item.id)
end
- it_behaves_like 'renders the modules show page'
+ it_behaves_like "renders the modules show page"
- it_behaves_like 'has selector', '#main-menu a.wiki-example-menu-item'
+ it_behaves_like "has selector", "#main-menu a.wiki-example-menu-item"
- it_behaves_like 'has selector', '#main-menu a.wiki-sub-menu-item'
+ it_behaves_like "has selector", "#main-menu a.wiki-sub-menu-item"
end
end
- describe 'with activated activity module' do
+ describe "with activated activity module" do
let(:enabled_modules) { %w[activity] }
- it_behaves_like 'renders the modules show page'
+ it_behaves_like "renders the modules show page"
- it_behaves_like 'has selector', '#main-menu a.activity-menu-item'
+ it_behaves_like "has selector", "#main-menu a.activity-menu-item"
end
- describe 'without activated activity module' do
- it_behaves_like 'renders the modules show page'
+ describe "without activated activity module" do
+ it_behaves_like "renders the modules show page"
- it_behaves_like 'has no selector', '#main-menu a.activity-menu-item'
+ it_behaves_like "has no selector", "#main-menu a.activity-menu-item"
end
end
end
diff --git a/spec/controllers/queries/params_parser_spec.rb b/spec/controllers/queries/params_parser_spec.rb
index a4fcae942e0c..49fb4569d533 100644
--- a/spec/controllers/queries/params_parser_spec.rb
+++ b/spec/controllers/queries/params_parser_spec.rb
@@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe Queries::ParamsParser, type: :model do
let(:params) do
@@ -37,65 +37,65 @@
subject { described_class.parse(params.with_indifferent_access) }
- describe '.parse' do
- context 'without any params' do
- it 'returns an empty array' do
+ describe ".parse" do
+ context "without any params" do
+ it "returns an empty array" do
expect(subject)
.to be_empty
end
end
- context 'with a single filter with a single value' do
+ context "with a single filter with a single value" do
let(:params) do
{
filters: "active = t"
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '=', values: ['t'] })
+ .to contain_exactly({ attribute: "active", operator: "=", values: ["t"] })
end
end
- context 'with a single filter with multiple values having single quotes' do
+ context "with a single filter with multiple values having single quotes" do
let(:params) do
{
filters: "active = ['t', 'f']"
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '=', values: %w[t f] })
+ .to contain_exactly({ attribute: "active", operator: "=", values: %w[t f] })
end
end
- context 'with a single filter with multiple values having double quotes' do
+ context "with a single filter with multiple values having double quotes" do
let(:params) do
{
filters: "active = [\"t\", \"f\"]"
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '=', values: %w[t f] })
+ .to contain_exactly({ attribute: "active", operator: "=", values: %w[t f] })
end
end
- context 'with a single filter with a single value with , and &' do
+ context "with a single filter with a single value with , and &" do
let(:params) do
{
- filters: 'active = something, or another thing & something else'
+ filters: "active = something, or another thing & something else"
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
# This returns invalid filters but they will then be marked as invalid
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '=', values: ["something, or another thing "] },
- { attribute: 'something', operator: 'else', values: [''] })
+ .to contain_exactly({ attribute: "active", operator: "=", values: ["something, or another thing "] },
+ { attribute: "something", operator: "else", values: [""] })
end
end
@@ -106,165 +106,165 @@
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '=', values: ["something, or another thing \" something else"] })
+ .to contain_exactly({ attribute: "active", operator: "=", values: ["something, or another thing \" something else"] })
end
end
- context 'with a single filter with a single value with \' (escaped)' do
+ context "with a single filter with a single value with ' (escaped)" do
let(:params) do
{
filters: "active = 'something, or another thing \\' something else'"
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '=', values: ["something, or another thing ' something else"] })
+ .to contain_exactly({ attribute: "active", operator: "=", values: ["something, or another thing ' something else"] })
end
end
- context 'with a single filter with no value' do
+ context "with a single filter with no value" do
let(:params) do
{
- filters: 'cf_512 !* '
+ filters: "cf_512 !* "
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'cf_512', operator: '!*', values: [''] })
+ .to contain_exactly({ attribute: "cf_512", operator: "!*", values: [""] })
end
end
- context 'with multiple filters with the first having no value' do
+ context "with multiple filters with the first having no value" do
let(:params) do
{
filters: "active !* & id = \"1\""
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '!*', values: [] },
- { attribute: 'id', operator: '=', values: ["1"] })
+ .to contain_exactly({ attribute: "active", operator: "!*", values: [] },
+ { attribute: "id", operator: "=", values: ["1"] })
end
end
- context 'with multiple filters with ampersand as a filter value' do
+ context "with multiple filters with ampersand as a filter value" do
let(:params) do
{
filters: "active = \"t\" & name_and_identifier ~ \"abc & def\""
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '=', values: ["t"] },
- { attribute: 'name_and_identifier', operator: '~', values: ["abc & def"] })
+ .to contain_exactly({ attribute: "active", operator: "=", values: ["t"] },
+ { attribute: "name_and_identifier", operator: "~", values: ["abc & def"] })
end
end
- context 'with a corrupt filter only having a key' do
+ context "with a corrupt filter only having a key" do
let(:params) do
{
filters: "active"
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '', values: [""] })
+ .to contain_exactly({ attribute: "active", operator: "", values: [""] })
end
end
- context 'with a corrupt filter having opening braces but no closing ones' do
+ context "with a corrupt filter having opening braces but no closing ones" do
let(:params) do
{
filters: "active = [\"t\", \"f\""
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '=', values: %w[t f] })
+ .to contain_exactly({ attribute: "active", operator: "=", values: %w[t f] })
end
end
- context 'with a corrupt filter having opening double quotes but no closing ones' do
+ context "with a corrupt filter having opening double quotes but no closing ones" do
let(:params) do
{
filters: 'active = "t'
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '=', values: %w[t] })
+ .to contain_exactly({ attribute: "active", operator: "=", values: %w[t] })
end
end
- context 'with a corrupt filter having opening single quotes but no closing ones' do
+ context "with a corrupt filter having opening single quotes but no closing ones" do
let(:params) do
{
filters: "active = 't"
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:filters])
- .to contain_exactly({ attribute: 'active', operator: '=', values: %w[t] })
+ .to contain_exactly({ attribute: "active", operator: "=", values: %w[t] })
end
end
- context 'with sortBy with a single value' do
+ context "with sortBy with a single value" do
let(:params) do
{
sortBy: JSON.dump([%w[name asc]])
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:orders])
- .to eql [{ attribute: 'name', direction: 'asc' }]
+ .to eql [{ attribute: "name", direction: "asc" }]
end
end
- context 'with sortBy with a multiple value' do
+ context "with sortBy with a multiple value" do
let(:params) do
{
sortBy: JSON.dump([%w[name asc], %w[created_at desc]])
}
end
- it 'returns the parsed filter' do
+ it "returns the parsed filter" do
expect(subject[:orders])
- .to eql [{ attribute: 'name', direction: 'asc' }, { attribute: 'created_at', direction: 'desc' }]
+ .to eql [{ attribute: "name", direction: "asc" }, { attribute: "created_at", direction: "desc" }]
end
end
- context 'with an invalid sortBy' do
+ context "with an invalid sortBy" do
let(:params) do
{
sortBy: "[sjfkdsjfkd}"
}
end
- it 'returns an invalid sort order' do
+ it "returns an invalid sort order" do
expect(subject[:orders])
- .to eql [{ attribute: 'invalid', direction: 'asc' }]
+ .to eql [{ attribute: "invalid", direction: "asc" }]
end
end
- context 'with multiple columns' do
+ context "with multiple columns" do
let(:params) do
{
columns: "name cf_1 project_status"
}
end
- it 'returns an invalid sort order' do
+ it "returns an invalid sort order" do
expect(subject[:selects])
.to eql %w[name cf_1 project_status]
end
diff --git a/spec/controllers/repositories_controller_spec.rb b/spec/controllers/repositories_controller_spec.rb
index 2961d05f479a..5f05009126f1 100644
--- a/spec/controllers/repositories_controller_spec.rb
+++ b/spec/controllers/repositories_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe RepositoriesController do
let(:project) do
@@ -38,16 +38,16 @@
create(:user, member_with_roles: { project => role })
end
let(:role) { create(:project_role, permissions: []) }
- let (:url) { 'file:///tmp/something/does/not/exist.svn' }
+ let (:url) { "file:///tmp/something/does/not/exist.svn" }
let(:repository) do
- allow(Setting).to receive(:enabled_scm).and_return(['subversion'])
+ allow(Setting).to receive(:enabled_scm).and_return(["subversion"])
repo = build_stubbed(:repository_subversion,
- scm_type: 'local',
+ scm_type: "local",
url:,
project:)
- allow(repo).to receive(:default_branch).and_return('master')
- allow(repo).to receive(:branches).and_return(['master'])
+ allow(repo).to receive(:default_branch).and_return("master")
+ allow(repo).to receive(:branches).and_return(["master"])
allow(repo).to receive(:save).and_return(true)
repo
@@ -58,7 +58,7 @@
allow(project).to receive(:repository).and_return(repository)
end
- describe 'manages the repository' do
+ describe "manages the repository" do
let(:role) { create(:project_role, permissions: [:manage_repository]) }
before do
@@ -66,45 +66,45 @@
allow(controller).to receive(:authorize).and_return(true)
end
- context 'with #destroy' do
+ context "with #destroy" do
before do
allow(repository).to receive(:destroy).and_return(true)
delete :destroy, params: { project_id: project.id }, xhr: true
end
- it 'redirects to settings' do
+ it "redirects to settings" do
expect(response).to redirect_to project_settings_repository_path(project.identifier)
end
end
- context 'with #update' do
+ context "with #update" do
before do
put :update, params: { project_id: project.id }, xhr: true
end
- it 'redirects to settings' do
+ it "redirects to settings" do
expect(response).to redirect_to project_settings_repository_path(project.identifier)
end
end
- context 'with #create' do
+ context "with #create" do
before do
post :create,
params: {
project_id: project.id,
- scm_vendor: 'subversion',
- scm_type: 'local',
- url: 'file:///tmp/repo.svn/'
+ scm_vendor: "subversion",
+ scm_type: "local",
+ url: "file:///tmp/repo.svn/"
}
end
- it 'redirects to settings' do
+ it "redirects to settings" do
expect(response).to redirect_to project_settings_repository_path(project.identifier)
end
end
end
- describe 'with empty repository' do
+ describe "with empty repository" do
let(:role) { create(:project_role, permissions: [:browse_repository]) }
before do
@@ -113,25 +113,25 @@
.and_raise(OpenProject::SCM::Exceptions::SCMEmpty)
end
- context 'with #show' do
+ context "with #show" do
before do
get :show, params: { project_id: project.identifier }
end
- it 'renders an empty warning view' do
- expect(response).to render_template 'repositories/empty'
- expect(response.code).to eq('200')
+ it "renders an empty warning view" do
+ expect(response).to render_template "repositories/empty"
+ expect(response.code).to eq("200")
end
end
- context 'with #show and checkout' do
+ context "with #show and checkout" do
render_views
let(:checkout_hash) do
{
- 'subversion' => { 'enabled' => '1',
- 'text' => 'foo',
- 'base_url' => 'http://localhost' }
+ "subversion" => { "enabled" => "1",
+ "text" => "foo",
+ "base_url" => "http://localhost" }
}
end
@@ -140,15 +140,15 @@
get :show, params: { project_id: project.identifier }
end
- it 'renders an empty warning view' do
- expect(response).to render_template 'repositories/empty'
- expect(response).to render_template partial: 'repositories/_checkout_instructions'
- expect(response.code).to eq('200')
+ it "renders an empty warning view" do
+ expect(response).to render_template "repositories/empty"
+ expect(response).to render_template partial: "repositories/_checkout_instructions"
+ expect(response.code).to eq("200")
end
end
end
- describe 'with subversion repository' do
+ describe "with subversion repository" do
with_subversion_repository do |repo_dir|
let(:root_url) { repo_dir }
let(:url) { "file://#{root_url}" }
@@ -157,96 +157,96 @@
create(:repository_subversion, project:, url:, root_url: url)
end
- describe 'commits per author graph' do
+ describe "commits per author graph" do
before do
- get :graph, params: { project_id: project.identifier, graph: 'commits_per_author' }
+ get :graph, params: { project_id: project.identifier, graph: "commits_per_author" }
end
- context 'requested by an authorized user' do
+ context "requested by an authorized user" do
let(:role) do
create(:project_role, permissions: %i[browse_repository
view_commit_author_statistics])
end
- it 'is successful' do
+ it "is successful" do
expect(response).to be_successful
end
- it 'has the right content type' do
- expect(response.content_type).to eq('image/svg+xml')
+ it "has the right content type" do
+ expect(response.content_type).to eq("image/svg+xml")
end
end
- context 'requested by an unauthorized user' do
+ context "requested by an unauthorized user" do
let(:role) { create(:project_role, permissions: [:browse_repository]) }
- it 'returns 403' do
- expect(response.code).to eq('403')
+ it "returns 403" do
+ expect(response.code).to eq("403")
end
end
end
- describe 'committers' do
+ describe "committers" do
let(:role) { create(:project_role, permissions: [:manage_repository]) }
- describe '#get' do
+ describe "#get" do
before do
get :committers, params: { project_id: project.id }
end
- it 'is successful' do
+ it "is successful" do
expect(response).to be_successful
- expect(response).to render_template 'repositories/committers'
+ expect(response).to render_template "repositories/committers"
end
end
- describe '#post' do
+ describe "#post" do
before do
repository.fetch_changesets
- post :committers, params: { project_id: project.id, committers: { '0' => ['oliver', user.id] },
- commit: 'Update' }
+ post :committers, params: { project_id: project.id, committers: { "0" => ["oliver", user.id] },
+ commit: "Update" }
end
- it 'is successful' do
+ it "is successful" do
expect(response).to redirect_to committers_project_repository_path(project)
- expect(repository.committers).to include(['oliver', user.id])
+ expect(repository.committers).to include(["oliver", user.id])
end
end
end
- describe 'stats' do
+ describe "stats" do
before do
get :stats, params: { project_id: project.identifier }
end
- describe 'requested by a user with view_commit_author_statistics permission' do
+ describe "requested by a user with view_commit_author_statistics permission" do
let(:role) do
create(:project_role, permissions: %i[browse_repository
view_commit_author_statistics])
end
- it 'show the commits per author graph' do
+ it "show the commits per author graph" do
expect(assigns(:show_commits_per_author)).to be(true)
end
end
- describe 'requested by a user without view_commit_author_statistics permission' do
+ describe "requested by a user without view_commit_author_statistics permission" do
let(:role) { create(:project_role, permissions: [:browse_repository]) }
- it 'does not show the commits per author graph' do
+ it "does not show the commits per author graph" do
expect(assigns(:show_commits_per_author)).to be(false)
end
end
end
- shared_examples 'renders the repository title' do |active_breadcrumb|
+ shared_examples "renders the repository title" do |active_breadcrumb|
it do
expect(response).to be_successful
- expect(response.body).to have_css('.repository-breadcrumbs', text: active_breadcrumb)
+ expect(response.body).to have_css(".repository-breadcrumbs", text: active_breadcrumb)
end
end
- describe 'show' do
+ describe "show" do
render_views
let(:role) { create(:project_role, permissions: [:browse_repository]) }
@@ -254,20 +254,20 @@
get :show, params: { project_id: project.identifier, repo_path: path }
end
- context 'with brackets' do
- let(:path) { 'subversion_test/[folder_with_brackets]' }
+ context "with brackets" do
+ let(:path) { "subversion_test/[folder_with_brackets]" }
- it_behaves_like 'renders the repository title', '[folder_with_brackets]'
+ it_behaves_like "renders the repository title", "[folder_with_brackets]"
end
- context 'with unicode' do
- let(:path) { 'Föbar/äm/Sägepütz!%5D§' }
+ context "with unicode" do
+ let(:path) { "Föbar/äm/Sägepütz!%5D§" }
- it_behaves_like 'renders the repository title', 'Sägepütz!%5D§'
+ it_behaves_like "renders the repository title", "Sägepütz!%5D§"
end
end
- describe 'changes' do
+ describe "changes" do
render_views
let(:role) { create(:project_role, permissions: [:browse_repository]) }
@@ -276,57 +276,57 @@
expect(response).to be_successful
end
- context 'with brackets' do
- let(:path) { 'subversion_test/[folder_with_brackets]' }
+ context "with brackets" do
+ let(:path) { "subversion_test/[folder_with_brackets]" }
- it_behaves_like 'renders the repository title', '[folder_with_brackets]'
+ it_behaves_like "renders the repository title", "[folder_with_brackets]"
end
- context 'with unicode' do
- let(:path) { 'Föbar/äm' }
+ context "with unicode" do
+ let(:path) { "Föbar/äm" }
- it_behaves_like 'renders the repository title', 'äm'
+ it_behaves_like "renders the repository title", "äm"
end
end
- describe 'checkout path' do
+ describe "checkout path" do
render_views
let(:role) { create(:project_role, permissions: [:browse_repository]) }
let(:checkout_hash) do
{
- 'subversion' => { 'enabled' => '1',
- 'text' => 'foo',
- 'base_url' => 'http://localhost' }
+ "subversion" => { "enabled" => "1",
+ "text" => "foo",
+ "base_url" => "http://localhost" }
}
end
before do
allow(Setting).to receive(:repository_checkout_data).and_return(checkout_hash)
- get :show, params: { project_id: project.identifier, repo_path: 'subversion_test' }
+ get :show, params: { project_id: project.identifier, repo_path: "subversion_test" }
end
- it 'renders an empty warning view' do
+ it "renders an empty warning view" do
expected_path = "http://localhost/#{project.identifier}/subversion_test"
- expect(response.code).to eq('200')
- expect(response).to render_template partial: 'repositories/_checkout_instructions'
+ expect(response.code).to eq("200")
+ expect(response).to render_template partial: "repositories/_checkout_instructions"
expect(response.body).to have_css("#repository-checkout-url[value='#{expected_path}']")
end
end
end
end
- describe 'when not being logged in' do
+ describe "when not being logged in" do
let(:anonymous) { build_stubbed(:anonymous) }
before do
login_as(anonymous)
end
- describe '#show' do
- it 'redirects to login while preserving the path' do
- params = { repo_path: 'aDir/within/aDir', rev: '42', project_id: project.id }
+ describe "#show" do
+ it "redirects to login while preserving the path" do
+ params = { repo_path: "aDir/within/aDir", rev: "42", project_id: project.id }
get(:show, params:)
expect(response)
diff --git a/spec/controllers/roles_controller_spec.rb b/spec/controllers/roles_controller_spec.rb
index b0ed566a7809..ef52683f50d2 100644
--- a/spec/controllers/roles_controller_spec.rb
+++ b/spec/controllers/roles_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe RolesController do
let(:user) do
@@ -35,28 +35,28 @@
let(:params) do
{
role: {
- name: 'A role name',
- permissions: ['add_work_packages', 'edit_work_packages', 'log_own_time', ''],
- assignable: '0'
+ name: "A role name",
+ permissions: ["add_work_packages", "edit_work_packages", "log_own_time", ""],
+ assignable: "0"
},
- copy_workflow_from: '5'
+ copy_workflow_from: "5"
}
end
current_user { user }
- describe '#create' do
- let(:new_role) { double('role double') }
+ describe "#create" do
+ let(:new_role) { double("role double") }
let(:service_call) { ServiceResult.success(result: new_role) }
let(:create_params) do
cp = ActionController::Parameters.new(params[:role])
- .merge(global_role: nil, copy_workflow_from: '5')
+ .merge(global_role: nil, copy_workflow_from: "5")
cp.permit!
cp
end
let(:create_service) do
- service_double = double('create service')
+ service_double = double("create service")
expect(Roles::CreateService)
.to receive(:new)
@@ -75,89 +75,89 @@
post :create, params:
end
- context 'success' do
- context 'for a member role' do
- it 'redirects to roles#index' do
+ context "success" do
+ context "for a member role" do
+ it "redirects to roles#index" do
expect(response)
.to redirect_to(roles_path)
end
- it 'has a flash message' do
+ it "has a flash message" do
expect(flash[:notice])
.to eql I18n.t(:notice_successful_create)
end
end
- context 'for a global role' do
+ context "for a global role" do
let(:params) do
{
role: {
- name: 'A role name',
- permissions: ['add_work_packages', 'edit_work_packages', 'log_time', ''],
- assignable: '0'
+ name: "A role name",
+ permissions: ["add_work_packages", "edit_work_packages", "log_time", ""],
+ assignable: "0"
},
- global_role: '1',
- copy_workflow_from: '5'
+ global_role: "1",
+ copy_workflow_from: "5"
}
end
let(:create_params) do
cp = ActionController::Parameters.new(params[:role])
- .merge(global_role: '1', copy_workflow_from: '5')
+ .merge(global_role: "1", copy_workflow_from: "5")
cp.permit!
cp
end
- it 'redirects to roles#index' do
+ it "redirects to roles#index" do
expect(response)
.to redirect_to(roles_path)
end
- it 'has a flash message' do
+ it "has a flash message" do
expect(flash[:notice])
.to eql I18n.t(:notice_successful_create)
end
end
end
- context 'failure' do
+ context "failure" do
let(:service_call) { ServiceResult.failure(result: new_role) }
- it 'returns a 200 OK' do
+ it "returns a 200 OK" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the new template' do
+ it "renders the new template" do
expect(response)
- .to render_template('roles/new')
+ .to render_template("roles/new")
end
- it 'has the service call assigned' do
+ it "has the service call assigned" do
expect(assigns[:call])
.to eql service_call
end
- it 'has the role assigned' do
+ it "has the role assigned" do
expect(assigns[:role])
.to eql new_role
end
end
end
- describe '#update' do
+ describe "#update" do
let(:params) do
{
id: role.id,
role: {
- name: 'A role name',
- permissions: ['add_work_packages', 'edit_work_packages', 'log_time', ''],
- assignable: '0'
+ name: "A role name",
+ permissions: ["add_work_packages", "edit_work_packages", "log_time", ""],
+ assignable: "0"
}
}
end
let(:role) do
- double('role double', id: 6).tap do |d|
+ double("role double", id: 6).tap do |d|
allow(Role)
.to receive(:find)
.with(d.id.to_s)
@@ -172,7 +172,7 @@
cp
end
let(:update_service) do
- service_double = double('update service')
+ service_double = double("update service")
expect(Roles::UpdateService)
.to receive(:new)
@@ -191,60 +191,60 @@
put :update, params:
end
- context 'success' do
- it 'redirects to roles#index' do
+ context "success" do
+ it "redirects to roles#index" do
expect(response)
.to redirect_to(roles_path)
end
- it 'has a flash message' do
+ it "has a flash message" do
expect(flash[:notice])
.to eql I18n.t(:notice_successful_update)
end
end
- context 'failure' do
+ context "failure" do
let(:service_call) { ServiceResult.failure(result: role) }
- it 'returns a 200 OK' do
+ it "returns a 200 OK" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the edit template' do
+ it "renders the edit template" do
expect(response)
- .to render_template('roles/edit')
+ .to render_template("roles/edit")
end
- it 'has the service call assigned' do
+ it "has the service call assigned" do
expect(assigns[:call])
.to eql service_call
end
- it 'has the role assigned' do
+ it "has the role assigned" do
expect(assigns[:role])
.to eql role
end
end
end
- describe '#bulk_update' do
+ describe "#bulk_update" do
let(:params) do
{
- permissions: { '0' => '', '1' => ['edit_work_packages'], '3' => %w(add_work_packages delete_work_packages) }
+ permissions: { "0" => "", "1" => ["edit_work_packages"], "3" => %w(add_work_packages delete_work_packages) }
}
end
let(:role0) do
- double('role double', id: 0)
+ double("role double", id: 0)
end
let(:role1) do
- double('role double', id: 1)
+ double("role double", id: 1)
end
let(:role2) do
- double('role double', id: 2)
+ double("role double", id: 2)
end
let(:role3) do
- double('role double', id: 3)
+ double("role double", id: 3)
end
let(:roles) do
[role0, role1, role2, role3]
@@ -264,7 +264,7 @@
{ permissions: [] }
end
let(:update_service0) do
- service_double = double('update service')
+ service_double = double("update service")
expect(Roles::UpdateService)
.to receive(:new)
@@ -277,10 +277,10 @@
.and_return(service_call0)
end
let(:update_params1) do
- { permissions: params[:permissions]['1'] }
+ { permissions: params[:permissions]["1"] }
end
let(:update_service1) do
- service_double = double('update service')
+ service_double = double("update service")
expect(Roles::UpdateService)
.to receive(:new)
@@ -296,7 +296,7 @@
{ permissions: [] }
end
let(:update_service2) do
- service_double = double('update service')
+ service_double = double("update service")
expect(Roles::UpdateService)
.to receive(:new)
@@ -309,10 +309,10 @@
.and_return(service_call2)
end
let(:update_params3) do
- { permissions: params[:permissions]['3'] }
+ { permissions: params[:permissions]["3"] }
end
let(:update_service3) do
- service_double = double('update service')
+ service_double = double("update service")
expect(Roles::UpdateService)
.to receive(:new)
@@ -334,51 +334,51 @@
put :bulk_update, params:
end
- context 'success' do
- it 'redirects to roles#index' do
+ context "success" do
+ it "redirects to roles#index" do
expect(response)
.to redirect_to(roles_path)
end
- it 'has a flash message' do
+ it "has a flash message" do
expect(flash[:notice])
.to eql I18n.t(:notice_successful_update)
end
end
- context 'failure' do
+ context "failure" do
let(:service_call2) { ServiceResult.failure(result: role2) }
- it 'returns a 200 OK' do
+ it "returns a 200 OK" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the report template' do
+ it "renders the report template" do
expect(response)
- .to render_template('roles/report')
+ .to render_template("roles/report")
end
- it 'has the service call assigned' do
+ it "has the service call assigned" do
expect(assigns[:calls])
.to contain_exactly(service_call0, service_call1, service_call2, service_call3)
end
- it 'has the roles assigned' do
+ it "has the roles assigned" do
expect(assigns[:roles])
.to match_array roles
end
end
end
- describe '#destroy' do
+ describe "#destroy" do
let(:role) { create(:project_role) }
let(:params) { { id: role.id } }
subject { delete(:destroy, params:) }
- context 'with the role not in use' do
- it 'redirects and destroyes the role' do
+ context "with the role not in use" do
+ it "redirects and destroyes the role" do
allow_any_instance_of(Role).to receive(:permissions).and_return([:read_files])
role
expect(Role.count).to eq(1)
@@ -393,8 +393,8 @@
end
end
- context 'with the role in use' do
- it 'redirects with a flash error' do
+ context "with the role in use" do
+ it "redirects with a flash error" do
allow_any_instance_of(Role).to receive(:deletable?).and_return(false)
role
expect(Role.count).to eq(1)
@@ -410,7 +410,7 @@
end
end
- describe '#report' do
+ describe "#report" do
let!(:stub_roles_scope) do
allow(controller)
.to receive(:roles_scope)
@@ -424,22 +424,22 @@
delete :report
end
- it 'is successful' do
+ it "is successful" do
expect(response)
.to have_http_status :ok
end
- it 'renders the template' do
+ it "renders the template" do
expect(response)
.to render_template :report
end
- it 'assigns permissions' do
+ it "assigns permissions" do
expect(assigns(:permissions))
.to match OpenProject::AccessControl.permissions.reject(&:public?)
end
- it 'assigns roles' do
+ it "assigns roles" do
expect(assigns(:roles))
.to match roles
end
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index 84b81c44a538..a3623afb008e 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -26,22 +26,22 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe SearchController do
shared_let(:project) do
create(:project,
- name: 'eCookbook')
+ name: "eCookbook")
end
shared_let(:other_project) do
create(:project,
- name: 'Other project')
+ name: "Other project")
end
shared_let(:subproject) do
create(:project,
- name: 'Child project',
+ name: "Child project",
parent: project)
end
@@ -61,69 +61,69 @@
shared_let(:work_package_1) do
create(:work_package,
- subject: 'This is a test issue',
+ subject: "This is a test issue",
project:)
end
shared_let(:work_package_2) do
create(:work_package,
- subject: 'Issue test 2',
+ subject: "Issue test 2",
project:,
status: create(:closed_status))
end
shared_let(:work_package_3) do
create(:work_package,
- subject: 'Issue test 3',
+ subject: "Issue test 3",
project: subproject)
end
shared_let(:work_package_4) do
create(:work_package,
- subject: 'Issue test 4',
+ subject: "Issue test 4",
project: other_project)
end
- shared_examples_for 'successful search' do
+ shared_examples_for "successful search" do
it { expect(response).to be_successful }
- it { expect(response).to render_template('index') }
+ it { expect(response).to render_template("index") }
end
before { allow(User).to receive(:current).and_return user }
- describe 'project search' do
- context 'without a search parameter' do
+ describe "project search" do
+ context "without a search parameter" do
before { get :index }
- it_behaves_like 'successful search'
+ it_behaves_like "successful search"
end
- context 'search parameter' do
- context 'is a search string' do
+ context "search parameter" do
+ context "is a search string" do
before do
- get :index, params: { q: 'cook' }
+ get :index, params: { q: "cook" }
end
- it_behaves_like 'successful search'
+ it_behaves_like "successful search"
end
end
end
- describe 'scoped project search' do
+ describe "scoped project search" do
before { get :index, params: { project_id: project.id } }
- it_behaves_like 'successful search'
+ it_behaves_like "successful search"
it { expect(assigns(:project).id).to be(project.id) }
end
- describe 'searching in all modules' do
- context 'when searching in all projects' do
- before { get :index, params: { q: 'issue', scope: 'all' } }
+ describe "searching in all modules" do
+ context "when searching in all projects" do
+ before { get :index, params: { q: "issue", scope: "all" } }
- it_behaves_like 'successful search'
+ it_behaves_like "successful search"
- describe '#result' do
+ describe "#result" do
it { expect(assigns(:results).count).to be(4) }
it { expect(assigns(:results)).to include(work_package_1) }
it { expect(assigns(:results)).to include(work_package_2) }
@@ -132,34 +132,34 @@
it { expect(assigns(:results)).not_to include(work_package_4) }
end
- describe '#results_count' do
+ describe "#results_count" do
it { expect(assigns(:results_count)).to be_a(Hash) }
- it { expect(assigns(:results_count)['work_packages']).to be(3) }
+ it { expect(assigns(:results_count)["work_packages"]).to be(3) }
end
end
- context 'when searching in all projects with an untransliterable character' do
+ context "when searching in all projects with an untransliterable character" do
before do
- work_package_1.update_column(:subject, 'Something 会议 something')
- get :index, params: { q: '会议', scope: 'all' }
+ work_package_1.update_column(:subject, "Something 会议 something")
+ get :index, params: { q: "会议", scope: "all" }
end
- it_behaves_like 'successful search'
+ it_behaves_like "successful search"
- it 'returns the result', :aggregate_failures do
+ it "returns the result", :aggregate_failures do
expect(assigns(:results).count).to be(1)
expect(assigns(:results)).to include(work_package_1)
expect(assigns(:results_count)).to be_a(Hash)
- expect(assigns(:results_count)['work_packages']).to be(1)
+ expect(assigns(:results_count)["work_packages"]).to be(1)
end
end
- context 'when searching in project and its subprojects' do
- before { get :index, params: { q: 'issue', project_id: project.id, scope: 'subprojects' } }
+ context "when searching in project and its subprojects" do
+ before { get :index, params: { q: "issue", project_id: project.id, scope: "subprojects" } }
- it_behaves_like 'successful search'
+ it_behaves_like "successful search"
- describe '#result' do
+ describe "#result" do
it { expect(assigns(:results).count).to be(4) }
it { expect(assigns(:results)).to include(work_package_1) }
it { expect(assigns(:results)).to include(work_package_2) }
@@ -169,12 +169,12 @@
end
end
- context 'when searching in project without its subprojects' do
- before { get :index, params: { q: 'issue', project_id: project.id, scope: 'current_project' } }
+ context "when searching in project without its subprojects" do
+ before { get :index, params: { q: "issue", project_id: project.id, scope: "current_project" } }
- it_behaves_like 'successful search'
+ it_behaves_like "successful search"
- describe '#result' do
+ describe "#result" do
it { expect(assigns(:results).count).to be(3) }
it { expect(assigns(:results)).to include(work_package_1) }
it { expect(assigns(:results)).to include(work_package_2) }
@@ -184,25 +184,25 @@
end
end
- context 'when searching for a note' do
+ context "when searching for a note" do
let!(:note_1) do
create(:work_package_journal,
journable_id: work_package_1.id,
- notes: 'Test note 1',
+ notes: "Test note 1",
version: 2)
end
let!(:note_2) do
create(:work_package_journal,
journable_id: work_package_1.id,
- notes: 'Special note 2',
+ notes: "Special note 2",
version: 3)
end
before do
- get :index, params: { q: 'note' }
+ get :index, params: { q: "note" }
end
- describe 'second note predecessor' do
+ describe "second note predecessor" do
subject { note_2.send :predecessor }
it { is_expected.to eq note_1 }
@@ -210,43 +210,43 @@
it { expect(subject.data).not_to be_nil }
end
- it_behaves_like 'successful search'
+ it_behaves_like "successful search"
- describe '#result' do
+ describe "#result" do
it { expect(assigns(:results).count).to be 1 }
it { expect(assigns(:results)).to include work_package_1 }
- it { expect(assigns(:tokens)).to include 'note' }
+ it { expect(assigns(:tokens)).to include "note" }
end
end
end
- describe 'helper methods' do
- describe '#scan_query_tokens' do
+ describe "helper methods" do
+ describe "#scan_query_tokens" do
subject { @controller.send(:scan_query_tokens, query) }
- context 'with one token' do
- let(:query) { 'word' }
+ context "with one token" do
+ let(:query) { "word" }
it { is_expected.to eq %w(word) }
- context 'with double quotes' do
+ context "with double quotes" do
let(:query) { '"hello world"' }
- it { is_expected.to eq ['hello world'] }
+ it { is_expected.to eq ["hello world"] }
end
end
- context 'with multiple tokens' do
- let(:query) { 'hello world something-hyphenated' }
+ context "with multiple tokens" do
+ let(:query) { "hello world something-hyphenated" }
it { is_expected.to eq %w(hello world something-hyphenated) }
- context 'with double quotes' do
+ context "with double quotes" do
let(:query) { 'hello "fallen world" something-hyphenated' }
- it { is_expected.to eq ['hello', 'fallen world', 'something-hyphenated'] }
+ it { is_expected.to eq ["hello", "fallen world", "something-hyphenated"] }
end
end
end
diff --git a/spec/controllers/statuses_controller_spec.rb b/spec/controllers/statuses_controller_spec.rb
index 6b6b6667e424..ee13fa27b90e 100644
--- a/spec/controllers/statuses_controller_spec.rb
+++ b/spec/controllers/statuses_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe StatusesController do
shared_let(:user) { create(:admin) }
@@ -34,7 +34,7 @@
before { login_as(user) }
- shared_examples_for 'response' do
+ shared_examples_for "response" do
subject { response }
it { is_expected.to be_successful }
@@ -42,7 +42,7 @@
it { is_expected.to render_template(template) }
end
- shared_examples_for 'redirect' do
+ shared_examples_for "redirect" do
subject { response }
it { is_expected.to be_redirect }
@@ -50,45 +50,45 @@
it { is_expected.to redirect_to(action: :index) }
end
- shared_examples_for 'statuses' do
+ shared_examples_for "statuses" do
subject { Status.find_by(name:) }
it { is_expected.not_to be_nil }
end
- describe '#index' do
- let(:template) { 'index' }
+ describe "#index" do
+ let(:template) { "index" }
before { get :index }
- it_behaves_like 'response'
+ it_behaves_like "response"
end
- describe '#new' do
- let(:template) { 'new' }
+ describe "#new" do
+ let(:template) { "new" }
before { get :new }
- it_behaves_like 'response'
+ it_behaves_like "response"
end
- describe '#create' do
- let(:name) { 'New Status' }
+ describe "#create" do
+ let(:name) { "New Status" }
before do
post :create,
params: { status: { name: } }
end
- it_behaves_like 'statuses'
+ it_behaves_like "statuses"
- it_behaves_like 'redirect'
+ it_behaves_like "redirect"
end
- describe '#edit' do
- let(:template) { 'edit' }
+ describe "#edit" do
+ let(:template) { "edit" }
- context 'default' do
+ context "default" do
let!(:status_default) do
create(:status,
is_default: true)
@@ -99,41 +99,41 @@
params: { id: status_default.id }
end
- it_behaves_like 'response'
+ it_behaves_like "response"
- describe '#view' do
+ describe "#view" do
render_views
it do
- assert_select 'p',
+ assert_select "p",
{ content: Status.human_attribute_name(:is_default) },
false
end
end
end
- context 'no_default' do
+ context "no_default" do
before do
status
get :edit, params: { id: status.id }
end
- it_behaves_like 'response'
+ it_behaves_like "response"
- describe '#view' do
+ describe "#view" do
render_views
it do
- assert_select 'div',
+ assert_select "div",
content: Status.human_attribute_name(:is_default)
end
end
end
end
- describe '#update' do
- let(:name) { 'Renamed Status' }
+ describe "#update" do
+ let(:name) { "Renamed Status" }
before do
status
@@ -145,21 +145,21 @@
}
end
- it_behaves_like 'statuses'
+ it_behaves_like "statuses"
- it_behaves_like 'redirect'
+ it_behaves_like "redirect"
end
- describe '#destroy' do
+ describe "#destroy" do
let(:name) { status.name }
- shared_examples_for 'destroyed' do
+ shared_examples_for "destroyed" do
subject { Status.find_by(name:) }
it { is_expected.to be_nil }
end
- context 'unused' do
+ context "unused" do
before do
delete :destroy, params: { id: status.id }
end
@@ -168,12 +168,12 @@
Status.delete_all
end
- it_behaves_like 'destroyed'
+ it_behaves_like "destroyed"
- it_behaves_like 'redirect'
+ it_behaves_like "redirect"
end
- context 'used' do
+ context "used" do
let(:work_package) do
create(:work_package,
status:)
@@ -185,12 +185,12 @@
delete :destroy, params: { id: status.id }
end
- it_behaves_like 'statuses'
+ it_behaves_like "statuses"
- it_behaves_like 'redirect'
+ it_behaves_like "redirect"
end
- context 'default' do
+ context "default" do
let!(:status_default) do
create(:status,
is_default: true)
@@ -200,39 +200,39 @@
delete :destroy, params: { id: status_default.id }
end
- it_behaves_like 'statuses'
+ it_behaves_like "statuses"
- it_behaves_like 'redirect'
+ it_behaves_like "redirect"
- it 'shows the right flash message' do
- expect(flash[:error]).to eq(I18n.t('error_unable_delete_default_status'))
+ it "shows the right flash message" do
+ expect(flash[:error]).to eq(I18n.t("error_unable_delete_default_status"))
end
end
end
- describe '#update_work_package_done_ratio' do
+ describe "#update_work_package_done_ratio" do
context "with 'work_package_done_ratio' using 'field'" do
before do
- allow(Setting).to receive(:work_package_done_ratio).and_return 'field'
+ allow(Setting).to receive(:work_package_done_ratio).and_return "field"
post :update_work_package_done_ratio
end
- it { is_expected.to set_flash[:error].to(I18n.t('error_work_package_done_ratios_not_updated')) }
+ it { is_expected.to set_flash[:error].to(I18n.t("error_work_package_done_ratios_not_updated")) }
- it_behaves_like 'redirect'
+ it_behaves_like "redirect"
end
context "with 'work_package_done_ratio' using 'status'" do
before do
- allow(Setting).to receive(:work_package_done_ratio).and_return 'status'
+ allow(Setting).to receive(:work_package_done_ratio).and_return "status"
post :update_work_package_done_ratio
end
- it { is_expected.to set_flash[:notice].to(I18n.t('notice_work_package_done_ratios_updated')) }
+ it { is_expected.to set_flash[:notice].to(I18n.t("notice_work_package_done_ratios_updated")) }
- it_behaves_like 'redirect'
+ it_behaves_like "redirect"
end
end
end
diff --git a/spec/controllers/sys_controller_spec.rb b/spec/controllers/sys_controller_spec.rb
index 47bbff6619eb..a9c8aeb003b4 100644
--- a/spec/controllers/sys_controller_spec.rb
+++ b/spec/controllers/sys_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe SysController, with_settings: { sys_api_enabled: true } do
let(:commit_role) do
@@ -34,15 +34,15 @@
end
let(:browse_role) { create(:project_role, permissions: [:browse_repository]) }
let(:guest_role) { create(:project_role, permissions: []) }
- let(:valid_user_password) { 'Top Secret Password' }
+ let(:valid_user_password) { "Top Secret Password" }
let(:valid_user) do
create(:user,
- login: 'johndoe',
+ login: "johndoe",
password: valid_user_password,
password_confirmation: valid_user_password)
end
- let(:api_key) { '12345678' }
+ let(:api_key) { "12345678" }
let(:public) { false }
let(:project) { create(:project, public:) }
@@ -61,132 +61,132 @@
RequestStore.clear!
end
- describe 'svn' do
+ describe "svn" do
let!(:repository) { create(:repository_subversion, project:) }
- describe 'repo_auth' do
- context 'for valid login, but no access to repo_auth' do
+ describe "repo_auth" do
+ context "for valid login, but no access to repo_auth" do
before do
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
- post 'repo_auth', params: { key: api_key,
- repository: 'without-access',
- method: 'GET' }
+ post "repo_auth", params: { key: api_key,
+ repository: "without-access",
+ method: "GET" }
end
- it 'responds 403 not allowed' do
- expect(response.code).to eq('403')
- expect(response.body).to eq('Not allowed')
+ it "responds 403 not allowed" do
+ expect(response.code).to eq("403")
+ expect(response.body).to eq("Not allowed")
end
end
- context 'for valid login and user has read permission (role reporter) for project' do
+ context "for valid login and user has read permission (role reporter) for project" do
before do
create(:member,
user: valid_user,
roles: [browse_role],
project:)
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
end
- it 'responds 200 okay dokay for GET' do
- post 'repo_auth', params: { key: api_key,
+ it "responds 200 okay dokay for GET" do
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'GET' }
+ method: "GET" }
- expect(response.code).to eq('200')
+ expect(response.code).to eq("200")
end
- it 'responds 403 not allowed for POST' do
- post 'repo_auth', params: { key: api_key,
+ it "responds 403 not allowed for POST" do
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'POST' }
+ method: "POST" }
- expect(response.code).to eq('403')
+ expect(response.code).to eq("403")
end
end
- context 'for valid login and user has rw permission (role developer) for project' do
+ context "for valid login and user has rw permission (role developer) for project" do
before do
create(:member,
user: valid_user,
roles: [commit_role],
project:)
valid_user.save
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
end
- it 'responds 200 okay dokay for GET' do
- post 'repo_auth', params: { key: api_key,
+ it "responds 200 okay dokay for GET" do
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'GET' }
+ method: "GET" }
- expect(response.code).to eq('200')
+ expect(response.code).to eq("200")
end
- it 'responds 200 okay dokay for POST' do
- post 'repo_auth', params: { key: api_key,
+ it "responds 200 okay dokay for POST" do
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'POST' }
+ method: "POST" }
- expect(response.code).to eq('200')
+ expect(response.code).to eq("200")
end
end
- context 'for invalid login and user has role manager for project' do
+ context "for invalid login and user has role manager for project" do
before do
create(:member,
user: valid_user,
roles: [commit_role],
project:)
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
- valid_user_password + 'made invalid'
+ valid_user_password + "made invalid"
)
- post 'repo_auth', params: { key: api_key,
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'GET' }
+ method: "GET" }
end
- it 'responds 401 auth required' do
- expect(response.code).to eq('401')
+ it "responds 401 auth required" do
+ expect(response.code).to eq("401")
end
end
- context 'for valid login and user is not member for project' do
+ context "for valid login and user is not member for project" do
before do
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
- post 'repo_auth', params: { key: api_key,
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'GET' }
+ method: "GET" }
end
- it 'responds 403 not allowed' do
- expect(response.code).to eq('403')
+ it "responds 403 not allowed" do
+ expect(response.code).to eq("403")
end
end
- context 'for valid login and project is public' do
+ context "for valid login and project is public" do
let(:public) { true }
before do
@@ -196,134 +196,134 @@
roles: [browse_role],
project: random_project)
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
- post 'repo_auth', params: { key: api_key,
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'GET' }
+ method: "GET" }
end
- it 'responds 200 OK' do
- expect(response.code).to eq('200')
+ it "responds 200 OK" do
+ expect(response.code).to eq("200")
end
end
- context 'for invalid credentials' do
+ context "for invalid credentials" do
before do
- post 'repo_auth', params: { key: api_key,
- repository: 'any-repo',
- method: 'GET' }
+ post "repo_auth", params: { key: api_key,
+ repository: "any-repo",
+ method: "GET" }
end
- it 'responds 401 auth required' do
- expect(response.code).to eq('401')
- expect(response.body).to eq('Authorization required')
+ it "responds 401 auth required" do
+ expect(response.code).to eq("401")
+ expect(response.body).to eq("Authorization required")
end
end
- context 'for invalid api key' do
- it 'responds 403 for valid username/password' do
- request.env['HTTP_AUTHORIZATION'] =
+ context "for invalid api key" do
+ it "responds 403 for valid username/password" do
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
- post 'repo_auth', params: { key: 'not_the_api_key',
- repository: 'any-repo',
- method: 'GET' }
+ post "repo_auth", params: { key: "not_the_api_key",
+ repository: "any-repo",
+ method: "GET" }
- expect(response.code).to eq('403')
+ expect(response.code).to eq("403")
expect(response.body)
- .to eq('Access denied. Repository management WS is disabled or key is invalid.')
+ .to eq("Access denied. Repository management WS is disabled or key is invalid.")
end
- it 'responds 403 for invalid username/password' do
- request.env['HTTP_AUTHORIZATION'] =
+ it "responds 403 for invalid username/password" do
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
- 'invalid',
- 'invalid'
+ "invalid",
+ "invalid"
)
- post 'repo_auth', params: { key: 'not_the_api_key',
- repository: 'any-repo',
- method: 'GET' }
+ post "repo_auth", params: { key: "not_the_api_key",
+ repository: "any-repo",
+ method: "GET" }
- expect(response.code).to eq('403')
+ expect(response.code).to eq("403")
expect(response.body)
- .to eq('Access denied. Repository management WS is disabled or key is invalid.')
+ .to eq("Access denied. Repository management WS is disabled or key is invalid.")
end
end
end
end
- describe 'git' do
+ describe "git" do
let!(:repository) { create(:repository_git, project:) }
- describe 'repo_auth' do
- context 'for valid login, but no access to repo_auth' do
+ describe "repo_auth" do
+ context "for valid login, but no access to repo_auth" do
before do
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
- post 'repo_auth', params: { key: api_key,
- repository: 'without-access',
- method: 'GET',
- git_smart_http: '1',
- uri: '/git',
- location: '/git' }
+ post "repo_auth", params: { key: api_key,
+ repository: "without-access",
+ method: "GET",
+ git_smart_http: "1",
+ uri: "/git",
+ location: "/git" }
end
- it 'responds 403 not allowed' do
- expect(response.code).to eq('403')
- expect(response.body).to eq('Not allowed')
+ it "responds 403 not allowed" do
+ expect(response.code).to eq("403")
+ expect(response.body).to eq("Not allowed")
end
end
- context 'for valid login and user has read permission (role reporter) for project' do
+ context "for valid login and user has read permission (role reporter) for project" do
before do
create(:member,
user: valid_user,
roles: [browse_role],
project:)
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
end
- it 'responds 200 okay dokay for read-only access' do
- post 'repo_auth', params: { key: api_key,
+ it "responds 200 okay dokay for read-only access" do
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'GET',
- git_smart_http: '1',
- uri: '/git',
- location: '/git' }
+ method: "GET",
+ git_smart_http: "1",
+ uri: "/git",
+ location: "/git" }
- expect(response.code).to eq('200')
+ expect(response.code).to eq("200")
end
- it 'responds 403 not allowed for write (push)' do
- post 'repo_auth', params: { key: api_key,
+ it "responds 403 not allowed for write (push)" do
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'POST',
- git_smart_http: '1',
+ method: "POST",
+ git_smart_http: "1",
uri: "/git/#{project.identifier}/git-receive-pack",
- location: '/git' }
+ location: "/git" }
- expect(response.code).to eq('403')
+ expect(response.code).to eq("403")
end
end
- context 'for valid login and user has rw permission (role developer) for project' do
+ context "for valid login and user has rw permission (role developer) for project" do
before do
create(:member,
user: valid_user,
@@ -331,85 +331,85 @@
project:)
valid_user.save
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
end
- it 'responds 200 okay dokay for GET' do
- post 'repo_auth', params: { key: api_key,
+ it "responds 200 okay dokay for GET" do
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'GET',
- git_smart_http: '1',
- uri: '/git',
- location: '/git' }
+ method: "GET",
+ git_smart_http: "1",
+ uri: "/git",
+ location: "/git" }
- expect(response.code).to eq('200')
+ expect(response.code).to eq("200")
end
- it 'responds 200 okay dokay for POST' do
- post 'repo_auth', params: { key: api_key,
+ it "responds 200 okay dokay for POST" do
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'POST',
- git_smart_http: '1',
+ method: "POST",
+ git_smart_http: "1",
uri: "/git/#{project.identifier}/git-receive-pack",
- location: '/git' }
+ location: "/git" }
- expect(response.code).to eq('200')
+ expect(response.code).to eq("200")
end
end
- context 'for invalid login and user has role manager for project' do
+ context "for invalid login and user has role manager for project" do
before do
create(:member,
user: valid_user,
roles: [commit_role],
project:)
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
- valid_user_password + 'made invalid'
+ valid_user_password + "made invalid"
)
- post 'repo_auth', params: { key: api_key,
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'GET',
- git_smart_http: '1',
- uri: '/git',
- location: '/git' }
+ method: "GET",
+ git_smart_http: "1",
+ uri: "/git",
+ location: "/git" }
end
- it 'responds 401 auth required' do
- expect(response.code).to eq('401')
+ it "responds 401 auth required" do
+ expect(response.code).to eq("401")
end
end
- context 'for valid login and user is not member for project' do
+ context "for valid login and user is not member for project" do
before do
project = create(:project, public: false)
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
- post 'repo_auth', params: { key: api_key,
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'GET',
- git_smart_http: '1',
- uri: '/git',
- location: '/git' }
+ method: "GET",
+ git_smart_http: "1",
+ uri: "/git",
+ location: "/git" }
end
- it 'responds 403 not allowed' do
- expect(response.code).to eq('403')
+ it "responds 403 not allowed" do
+ expect(response.code).to eq("403")
end
end
- context 'for valid login and project is public' do
+ context "for valid login and project is public" do
let(:public) { true }
before do
@@ -419,117 +419,117 @@
roles: [browse_role],
project: random_project)
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
- post 'repo_auth', params: { key: api_key,
+ post "repo_auth", params: { key: api_key,
repository: project.identifier,
- method: 'GET',
- git_smart_http: '1',
- uri: '/git',
- location: '/git' }
+ method: "GET",
+ git_smart_http: "1",
+ uri: "/git",
+ location: "/git" }
end
- it 'responds 200 OK' do
- expect(response.code).to eq('200')
+ it "responds 200 OK" do
+ expect(response.code).to eq("200")
end
end
- context 'for invalid credentials' do
+ context "for invalid credentials" do
before do
- post 'repo_auth', params: { key: api_key,
- repository: 'any-repo',
- method: 'GET',
- git_smart_http: '1',
- uri: '/git',
- location: '/git' }
+ post "repo_auth", params: { key: api_key,
+ repository: "any-repo",
+ method: "GET",
+ git_smart_http: "1",
+ uri: "/git",
+ location: "/git" }
end
- it 'responds 401 auth required' do
- expect(response.code).to eq('401')
- expect(response.body).to eq('Authorization required')
+ it "responds 401 auth required" do
+ expect(response.code).to eq("401")
+ expect(response.body).to eq("Authorization required")
end
end
- context 'for invalid api key' do
- it 'responds 403 for valid username/password' do
- request.env['HTTP_AUTHORIZATION'] =
+ context "for invalid api key" do
+ it "responds 403 for valid username/password" do
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
- post 'repo_auth', params: { key: 'not_the_api_key',
- repository: 'any-repo',
- method: 'GET',
- git_smart_http: '1',
- uri: '/git',
- location: '/git' }
+ post "repo_auth", params: { key: "not_the_api_key",
+ repository: "any-repo",
+ method: "GET",
+ git_smart_http: "1",
+ uri: "/git",
+ location: "/git" }
- expect(response.code).to eq('403')
+ expect(response.code).to eq("403")
expect(response.body)
- .to eq('Access denied. Repository management WS is disabled or key is invalid.')
+ .to eq("Access denied. Repository management WS is disabled or key is invalid.")
end
- it 'responds 403 for invalid username/password' do
- request.env['HTTP_AUTHORIZATION'] =
+ it "responds 403 for invalid username/password" do
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
- 'invalid',
- 'invalid'
+ "invalid",
+ "invalid"
)
- post 'repo_auth', params: { key: 'not_the_api_key',
- repository: 'any-repo',
- method: 'GET',
- git_smart_http: '1',
- uri: '/git',
- location: '/git' }
+ post "repo_auth", params: { key: "not_the_api_key",
+ repository: "any-repo",
+ method: "GET",
+ git_smart_http: "1",
+ uri: "/git",
+ location: "/git" }
- expect(response.code).to eq('403')
+ expect(response.code).to eq("403")
expect(response.body)
- .to eq('Access denied. Repository management WS is disabled or key is invalid.')
+ .to eq("Access denied. Repository management WS is disabled or key is invalid.")
end
end
end
end
- describe '#cached_user_login' do
+ describe "#cached_user_login" do
let(:cache_key) do
OpenProject::RepositoryAuthentication::CACHE_PREFIX +
Digest::SHA1.hexdigest("#{valid_user.login}#{valid_user_password}")
end
let(:cache_expiry) { OpenProject::RepositoryAuthentication::CACHE_EXPIRES_AFTER }
- it 'calls user_login only once when called twice' do
+ it "calls user_login only once when called twice" do
expect(controller).to receive(:user_login).once.and_return(valid_user)
2.times { controller.send(:cached_user_login, valid_user.login, valid_user_password) }
end
- it 'returns the same as user_login for valid creds' do
+ it "returns the same as user_login for valid creds" do
expect(controller.send(:cached_user_login, valid_user.login, valid_user_password))
.to eq(controller.send(:user_login, valid_user.login, valid_user_password))
end
- it 'returns the same as user_login for invalid creds' do
- expect(controller.send(:cached_user_login, 'invalid', 'invalid'))
- .to eq(controller.send(:user_login, 'invalid', 'invalid'))
+ it "returns the same as user_login for invalid creds" do
+ expect(controller.send(:cached_user_login, "invalid", "invalid"))
+ .to eq(controller.send(:user_login, "invalid", "invalid"))
end
- it 'uses cache' do
+ it "uses cache" do
allow(Rails.cache).to receive(:fetch).and_call_original
expect(Rails.cache).to receive(:fetch).with(cache_key, expires_in: cache_expiry)
.and_return(Marshal.dump(valid_user.id.to_s))
controller.send(:cached_user_login, valid_user.login, valid_user_password)
end
- describe 'with caching disabled' do
+ describe "with caching disabled" do
before do
allow(Setting).to receive(:repository_authentication_caching_enabled?).and_return(false)
end
- it 'does not use a cache' do
+ it "does not use a cache" do
allow(Rails.cache).to receive(:fetch).and_wrap_original do |m, *args, &block|
expect(args.first).not_to eq(cache_key)
m.call(*args, &block)
@@ -539,28 +539,28 @@
end
end
- describe 'update_required_storage' do
+ describe "update_required_storage" do
let(:force) { nil }
let(:apikey) { Setting.sys_api_key }
let(:last_updated) { nil }
def request_storage
- get 'update_required_storage', params: { key: apikey,
+ get "update_required_storage", params: { key: apikey,
id:,
force: }
end
- context 'missing project' do
+ context "missing project" do
let(:id) { 1234 }
- it 'returns 404' do
+ it "returns 404" do
request_storage
- expect(response.code).to eq('404')
- expect(response.body).to include('Could not find project #1234')
+ expect(response.code).to eq("404")
+ expect(response.body).to include("Could not find project #1234")
end
end
- context 'available project, but missing repository' do
+ context "available project, but missing repository" do
let(:project) { build_stubbed(:project) }
let(:id) { project.id }
@@ -569,13 +569,13 @@ def request_storage
request_storage
end
- it 'returns 404' do
- expect(response.code).to eq('404')
+ it "returns 404" do
+ expect(response.code).to eq("404")
expect(response.body).to include("Project ##{project.id} does not have a repository.")
end
end
- context 'stubbed repository' do
+ context "stubbed repository" do
let(:project) { build_stubbed(:project) }
let(:id) { project.id }
let(:repository) do
@@ -590,29 +590,29 @@ def request_storage
request_storage
end
- context 'local non-existing repository' do
- let(:root_url) { '/tmp/does/not/exist/svn/foo.svn' }
+ context "local non-existing repository" do
+ let(:root_url) { "/tmp/does/not/exist/svn/foo.svn" }
let(:url) { "file://#{root_url}" }
- it 'does not have storage available' do
+ it "does not have storage available" do
expect(repository.scm.storage_available?).to be false
- expect(response.code).to eq('400')
+ expect(response.code).to eq("400")
end
end
- context 'remote stubbed repository' do
- let(:root_url) { '' }
- let(:url) { 'https://foo.example.org/svn/bar' }
+ context "remote stubbed repository" do
+ let(:root_url) { "" }
+ let(:url) { "https://foo.example.org/svn/bar" }
- it 'has no storage available' do
+ it "has no storage available" do
request_storage
expect(repository.scm.storage_available?).to be false
- expect(response.code).to eq('400')
+ expect(response.code).to eq("400")
end
end
end
- context 'local existing repository' do
+ context "local existing repository" do
with_subversion_repository do |repo_dir|
let(:root_url) { repo_dir }
let(:url) { "file://#{root_url}" }
@@ -629,17 +629,17 @@ def request_storage
allow(repository).to receive(:storage_updated_at).and_return(last_updated)
end
- it 'has storage available' do
+ it "has storage available" do
expect(repository.scm.storage_available?).to be true
end
- context 'storage never updated before' do
- it 'updates the storage' do
+ context "storage never updated before" do
+ it "updates the storage" do
expect(repository.required_storage_bytes).to eq 0
request_storage
- expect(response.code).to eq('200')
- expect(response.body).to include('Updated: true')
+ expect(response.code).to eq("200")
+ expect(response.body).to include("Updated: true")
perform_enqueued_jobs
@@ -648,29 +648,29 @@ def request_storage
end
end
- context 'outdated storage' do
+ context "outdated storage" do
let(:last_updated) { 2.days.ago }
- it 'updates the storage' do
+ it "updates the storage" do
expect(SCM::StorageUpdaterJob).to receive(:perform_later)
request_storage
end
end
- context 'valid storage time' do
+ context "valid storage time" do
let(:last_updated) { 10.minutes.ago }
- it 'does not update to storage' do
+ it "does not update to storage" do
expect(SCM::StorageUpdaterJob).not_to receive(:perform_later)
request_storage
end
end
- context 'valid storage time and force' do
- let(:force) { '1' }
+ context "valid storage time and force" do
+ let(:force) { "1" }
let(:last_updated) { 10.minutes.ago }
- it 'does update to storage' do
+ it "does update to storage" do
expect(SCM::StorageUpdaterJob).to receive(:perform_later)
request_storage
end
@@ -680,43 +680,43 @@ def request_storage
end
end
- describe '#projects' do
+ describe "#projects" do
before do
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
)
- get 'projects', params: { key: api_key }
+ get "projects", params: { key: api_key }
end
- it 'is successful' do
+ it "is successful" do
expect(response)
.to have_http_status(:ok)
end
- it 'returns an xml with the projects having a repository' do
+ it "returns an xml with the projects having a repository" do
expect(response.content_type)
- .to eql 'application/xml; charset=utf-8'
+ .to eql "application/xml; charset=utf-8"
- expect(Nokogiri::XML::Document.parse(response.body).xpath('//projects[1]//id').text)
+ expect(Nokogiri::XML::Document.parse(response.body).xpath("//projects[1]//id").text)
.to eql repository_project.id.to_s
end
- context 'when disabled', with_settings: { sys_api_enabled?: false } do
- it 'is 403 forbidden' do
+ context "when disabled", with_settings: { sys_api_enabled?: false } do
+ it "is 403 forbidden" do
expect(response)
.to have_http_status(:forbidden)
end
end
end
- describe '#fetch_changesets' do
+ describe "#fetch_changesets" do
let(:params) { { id: repository_project.identifier } }
before do
- request.env['HTTP_AUTHORIZATION'] =
+ request.env["HTTP_AUTHORIZATION"] =
ActionController::HttpAuthentication::Basic.encode_credentials(
valid_user.login,
valid_user_password
@@ -724,36 +724,36 @@ def request_storage
allow_any_instance_of(Repository::Subversion).to receive(:fetch_changesets).and_return(true)
- get 'fetch_changesets', params: params.merge({ key: api_key })
+ get "fetch_changesets", params: params.merge({ key: api_key })
end
- context 'with a project identifier' do
- it 'is successful' do
+ context "with a project identifier" do
+ it "is successful" do
expect(response)
.to have_http_status(:ok)
end
end
- context 'without a project identifier' do
+ context "without a project identifier" do
let(:params) { {} }
- it 'is successful' do
+ it "is successful" do
expect(response)
.to have_http_status(:ok)
end
end
- context 'for an unknown project' do
+ context "for an unknown project" do
let(:params) { { id: 0 } }
- it 'returns 404' do
+ it "returns 404" do
expect(response)
.to have_http_status(:not_found)
end
end
- context 'when disabled', with_settings: { sys_api_enabled?: false } do
- it 'is 403 forbidden' do
+ context "when disabled", with_settings: { sys_api_enabled?: false } do
+ it "is 403 forbidden" do
expect(response)
.to have_http_status(:forbidden)
end
diff --git a/spec/controllers/types_controller_spec.rb b/spec/controllers/types_controller_spec.rb
index 89121aae9f30..88e8a5f7e736 100644
--- a/spec/controllers/types_controller_spec.rb
+++ b/spec/controllers/types_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe TypesController do
let(:project) do
@@ -35,105 +35,105 @@
end
let(:custom_field_1) do
create(:work_package_custom_field,
- field_format: 'string',
+ field_format: "string",
is_for_all: true)
end
let(:custom_field_2) { create(:work_package_custom_field) }
let(:status_0) { create(:status) }
let(:status_1) { create(:status) }
- context 'with an unauthorized account' do
+ context "with an unauthorized account" do
let(:current_user) { create(:user) }
before do
allow(User).to receive(:current).and_return(current_user)
end
- describe 'GET index' do
- describe 'the access should be restricted' do
- before { get 'index' }
+ describe "GET index" do
+ describe "the access should be restricted" do
+ before { get "index" }
it { expect(response.status).to eq(403) }
end
end
- describe 'GET new' do
- describe 'the access should be restricted' do
- before { get 'new' }
+ describe "GET new" do
+ describe "the access should be restricted" do
+ before { get "new" }
it { expect(response.status).to eq(403) }
end
end
- describe 'GET edit' do
- describe 'the access should be restricted' do
- before { get 'edit', params: { id: '123' } }
+ describe "GET edit" do
+ describe "the access should be restricted" do
+ before { get "edit", params: { id: "123" } }
it { expect(response.status).to eq(403) }
end
end
- describe 'POST create' do
- describe 'the access should be restricted' do
- before { post 'create' }
+ describe "POST create" do
+ describe "the access should be restricted" do
+ before { post "create" }
it { expect(response.status).to eq(403) }
end
end
- describe 'DELETE destroy' do
- describe 'the access should be restricted' do
- before { delete 'destroy', params: { id: '123' } }
+ describe "DELETE destroy" do
+ describe "the access should be restricted" do
+ before { delete "destroy", params: { id: "123" } }
it { expect(response.status).to eq(403) }
end
end
- describe 'POST update' do
- describe 'the access should be restricted' do
- before { post 'update', params: { id: '123' } }
+ describe "POST update" do
+ describe "the access should be restricted" do
+ before { post "update", params: { id: "123" } }
it { expect(response.status).to eq(403) }
end
end
- describe 'POST move' do
- describe 'the access should be restricted' do
- before { post 'move', params: { id: '123' } }
+ describe "POST move" do
+ describe "the access should be restricted" do
+ before { post "move", params: { id: "123" } }
it { expect(response.status).to eq(403) }
end
end
end
- context 'with an authorized account' do
+ context "with an authorized account" do
let(:current_user) { create(:admin) }
before do
allow(User).to receive(:current).and_return(current_user)
end
- describe 'GET index' do
- before { get 'index' }
+ describe "GET index" do
+ before { get "index" }
it { expect(response).to be_successful }
- it { expect(response).to render_template 'index' }
+ it { expect(response).to render_template "index" }
end
- describe 'GET new' do
- before { get 'new' }
+ describe "GET new" do
+ before { get "new" }
it { expect(response).to be_successful }
- it { expect(response).to render_template 'new' }
+ it { expect(response).to render_template "new" }
end
- describe 'POST create' do
- describe 'WITH valid params' do
+ describe "POST create" do
+ describe "WITH valid params" do
let(:params) do
- { 'type' => { name: 'New type',
- project_ids: { '1' => project.id },
- custom_field_ids: { '1' => custom_field_1.id,
- '2' => custom_field_2.id } } }
+ { "type" => { name: "New type",
+ project_ids: { "1" => project.id },
+ custom_field_ids: { "1" => custom_field_1.id,
+ "2" => custom_field_2.id } } }
end
before do
@@ -143,18 +143,18 @@
it { expect(response).to be_redirect }
it do
- type = Type.find_by(name: 'New type')
- expect(response).to redirect_to(action: 'edit', tab: 'settings', id: type.id)
+ type = Type.find_by(name: "New type")
+ expect(response).to redirect_to(action: "edit", tab: "settings", id: type.id)
end
end
- describe 'WITH an empty name' do
+ describe "WITH an empty name" do
render_views
let(:params) do
- { 'type' => { name: '',
- project_ids: { '1' => project.id },
- custom_field_ids: { '1' => custom_field_1.id,
- '2' => custom_field_2.id } } }
+ { "type" => { name: "",
+ project_ids: { "1" => project.id },
+ custom_field_ids: { "1" => custom_field_1.id,
+ "2" => custom_field_2.id } } }
end
before do
@@ -163,13 +163,13 @@
it { expect(response.status).to eq(200) }
- it 'shows an error message' do
+ it "shows an error message" do
expect(response.body).to have_content("Name can't be blank")
end
end
- describe 'WITH workflow copy' do
- let!(:existing_type) { create(:type, name: 'Existing type') }
+ describe "WITH workflow copy" do
+ let!(:existing_type) { create(:type, name: "Existing type") }
let!(:workflow) do
create(:workflow,
old_status: status_0,
@@ -178,10 +178,10 @@
end
let(:params) do
- { 'type' => { name: 'New type',
- project_ids: { '1' => project.id },
- custom_field_ids: { '1' => custom_field_1.id, '2' => custom_field_2.id } },
- 'copy_workflow_from' => existing_type.id }
+ { "type" => { name: "New type",
+ project_ids: { "1" => project.id },
+ custom_field_ids: { "1" => custom_field_1.id, "2" => custom_field_2.id } },
+ "copy_workflow_from" => existing_type.id }
end
before do
@@ -191,70 +191,70 @@
it { expect(response).to be_redirect }
it do
- type = Type.find_by(name: 'New type')
- expect(response).to redirect_to(action: 'edit', tab: 'settings', id: type.id)
+ type = Type.find_by(name: "New type")
+ expect(response).to redirect_to(action: "edit", tab: "settings", id: type.id)
end
- it 'has the copied workflows' do
- expect(Type.find_by(name: 'New type')
+ it "has the copied workflows" do
+ expect(Type.find_by(name: "New type")
.workflows.count).to eq(existing_type.workflows.count)
end
end
end
- describe 'GET edit settings' do
+ describe "GET edit settings" do
render_views
let(:type) do
- create(:type, name: 'My type',
+ create(:type, name: "My type",
is_milestone: true,
projects: [project])
end
before do
- get 'edit', params: { id: type.id, tab: :settings }
+ get "edit", params: { id: type.id, tab: :settings }
end
it { expect(response).to be_successful }
- it { expect(response).to render_template 'edit' }
- it { expect(response).to render_template 'types/form/_settings' }
+ it { expect(response).to render_template "edit" }
+ it { expect(response).to render_template "types/form/_settings" }
it { expect(response.body).to have_css "input[@name='type[name]'][@value='My type']" }
it { expect(response.body).to have_css "input[@name='type[is_milestone]'][@value='1'][@checked='checked']" }
end
- describe 'GET edit projects' do
+ describe "GET edit projects" do
render_views
let(:type) do
- create(:type, name: 'My type',
+ create(:type, name: "My type",
is_milestone: true,
projects: [project])
end
before do
- get 'edit', params: { id: type.id, tab: :projects }
+ get "edit", params: { id: type.id, tab: :projects }
end
it { expect(response).to be_successful }
- it { expect(response).to render_template 'edit' }
- it { expect(response).to render_template 'types/form/_projects' }
+ it { expect(response).to render_template "edit" }
+ it { expect(response).to render_template "types/form/_projects" }
it {
expect(response.body).to have_css "input[@name='type[project_ids][]'][@value='#{project.id}'][@checked='checked']"
}
end
- describe 'POST update' do
+ describe "POST update" do
let(:project2) { create(:project) }
let(:type) do
- create(:type, name: 'My type',
+ create(:type, name: "My type",
is_milestone: true,
projects: [project, project2])
end
- describe 'WITH type rename' do
+ describe "WITH type rename" do
let(:params) do
- { 'id' => type.id,
- 'type' => { name: 'My type renamed' },
- 'tab' => "settings" }
+ { "id" => type.id,
+ "type" => { name: "My type renamed" },
+ "tab" => "settings" }
end
before do
@@ -269,16 +269,16 @@
)
end
- it 'is renamed' do
- expect(Type.find_by(name: 'My type renamed').id).to eq(type.id)
+ it "is renamed" do
+ expect(Type.find_by(name: "My type renamed").id).to eq(type.id)
end
end
- describe 'WITH projects removed' do
+ describe "WITH projects removed" do
let(:params) do
- { 'id' => type.id,
- 'type' => { project_ids: [''] },
- 'tab' => "projects" }
+ { "id" => type.id,
+ "type" => { project_ids: [""] },
+ "tab" => "projects" }
end
before do
@@ -293,17 +293,17 @@
)
end
- it 'has no projects assigned' do
- expect(Type.find_by(name: 'My type').projects.count).to eq(0)
+ it "has no projects assigned" do
+ expect(Type.find_by(name: "My type").projects.count).to eq(0)
end
end
end
- describe 'POST move' do
- context 'with a successful update' do
- let!(:type) { create(:type, name: 'My type', position: '1') }
- let!(:type2) { create(:type, name: 'My type 2', position: '2') }
- let(:params) { { 'id' => type.id, 'type' => { move_to: 'lower' } } }
+ describe "POST move" do
+ context "with a successful update" do
+ let!(:type) { create(:type, name: "My type", position: "1") }
+ let!(:type2) { create(:type, name: "My type 2", position: "2") }
+ let(:params) { { "id" => type.id, "type" => { move_to: "lower" } } }
before do
post :move, params:
@@ -312,15 +312,15 @@
it { expect(response).to be_redirect }
it { expect(response).to redirect_to(types_path) }
- it 'has the position updated' do
- expect(Type.find_by(name: 'My type').position).to eq(2)
+ it "has the position updated" do
+ expect(Type.find_by(name: "My type").position).to eq(2)
end
end
- context 'with a failed update' do
- let!(:type) { create(:type, name: 'My type', position: '1') }
- let!(:type2) { create(:type, name: 'My type 2', position: '2') }
- let(:params) { { 'id' => type.id, 'type' => { move_to: 'lower' } } }
+ context "with a failed update" do
+ let!(:type) { create(:type, name: "My type", position: "1") }
+ let!(:type2) { create(:type, name: "My type 2", position: "2") }
+ let(:params) { { "id" => type.id, "type" => { move_to: "lower" } } }
before do
allow(Type).to receive(:find).and_return(type)
@@ -330,25 +330,25 @@
end
it { expect(response).not_to be_redirect }
- it { expect(response).to render_template('edit') }
+ it { expect(response).to render_template("edit") }
- it 'has an unsuccessful move flash' do
+ it "has an unsuccessful move flash" do
expect(flash[:error]).to eq(I18n.t(:error_type_could_not_be_saved))
end
it "doesn't update the position" do
- expect(Type.find_by(name: 'My type').position).to eq(1)
+ expect(Type.find_by(name: "My type").position).to eq(1)
end
end
end
- describe 'DELETE destroy' do
- let(:type) { create(:type, name: 'My type') }
- let(:type2) { create(:type, name: 'My type 2', projects: [project]) }
- let(:type3) { create(:type, name: 'My type 3', is_standard: true) }
+ describe "DELETE destroy" do
+ let(:type) { create(:type, name: "My type") }
+ let(:type2) { create(:type, name: "My type 2", projects: [project]) }
+ let(:type3) { create(:type, name: "My type 3", is_standard: true) }
- describe 'successful destroy' do
- let(:params) { { 'id' => type.id } }
+ describe "successful destroy" do
+ let(:params) { { "id" => type.id } }
before do
delete :destroy, params:
@@ -357,16 +357,16 @@
it { expect(response).to be_redirect }
it { expect(response).to redirect_to(types_path) }
- it 'has a successful destroy flash' do
+ it "has a successful destroy flash" do
expect(flash[:notice]).to eq(I18n.t(:notice_successful_delete))
end
- it 'is not present in the database' do
- expect(Type.find_by(name: 'My type')).to be_nil
+ it "is not present in the database" do
+ expect(Type.find_by(name: "My type")).to be_nil
end
end
- describe 'destroy type in use should fail' do
+ describe "destroy type in use should fail" do
let(:archived_project) do
create(:project,
:archived,
@@ -379,14 +379,14 @@
type: type2,
project: archived_project)
end
- let(:params) { { 'id' => type2.id } }
+ let(:params) { { "id" => type2.id } }
let(:error_message) do
archived_projects_urls = described_class
.helpers
.archived_projects_urls_for([archived_project])
[
- I18n.t(:'error_can_not_delete_type.explanation'),
+ I18n.t(:"error_can_not_delete_type.explanation"),
I18n.t(:error_can_not_delete_in_use_archived_work_packages, archived_projects_urls:)
]
end
@@ -398,17 +398,17 @@
it { expect(response).to be_redirect }
it { expect(response).to redirect_to(types_path) }
- it 'shows an error message' do
+ it "shows an error message" do
expect(sanitize_string(flash[:error])).to eq(sanitize_string(error_message))
end
- it 'is present in the database' do
- expect(Type.find_by(name: 'My type 2').id).to eq(type2.id)
+ it "is present in the database" do
+ expect(Type.find_by(name: "My type 2").id).to eq(type2.id)
end
end
- describe 'destroy standard type should fail' do
- let(:params) { { 'id' => type3.id } }
+ describe "destroy standard type should fail" do
+ let(:params) { { "id" => type3.id } }
before { delete :destroy, params: }
diff --git a/spec/controllers/users/memberships_controller_spec.rb b/spec/controllers/users/memberships_controller_spec.rb
index 8f43cff22f94..90e2ec87dd0b 100644
--- a/spec/controllers/users/memberships_controller_spec.rb
+++ b/spec/controllers/users/memberships_controller_spec.rb
@@ -26,8 +26,8 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'work_package'
+require "spec_helper"
+require "work_package"
RSpec.describe Users::MembershipsController do
shared_let(:admin) { create(:admin) }
@@ -35,11 +35,11 @@
let(:user) { create(:user) }
let(:anonymous) { create(:anonymous) }
- describe 'update memberships' do
+ describe "update memberships" do
let(:project) { create(:project) }
let(:role) { create(:project_role) }
- it 'works' do
+ it "works" do
# i.e. it should successfully add a user to a project's members
as_logged_in_user admin do
post :create,
@@ -52,7 +52,7 @@
}
end
- expect(response).to redirect_to(controller: '/users', action: 'edit', id: user.id, tab: 'memberships')
+ expect(response).to redirect_to(controller: "/users", action: "edit", id: user.id, tab: "memberships")
is_member = user.reload.memberships.any? do |m|
m.project_id == project.id && m.role_ids.include?(role.id)
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index f211f357f61f..9c590f3b7aad 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -26,22 +26,22 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'work_package'
+require "spec_helper"
+require "work_package"
RSpec.describe UsersController do
shared_let(:admin) { create(:admin) }
shared_let(:anonymous) { User.anonymous }
- shared_let(:user_password) { 'bob!' * 4 }
+ shared_let(:user_password) { "bob!" * 4 }
shared_let(:user) do
create(:user,
- login: 'bob',
+ login: "bob",
password: user_password,
password_confirmation: user_password)
end
- describe 'GET new' do
+ describe "GET new" do
context "without user limit reached" do
before do
as_logged_in_user admin do
@@ -49,17 +49,17 @@
end
end
- it 'is success' do
+ it "is success" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the template' do
+ it "renders the template" do
expect(response)
- .to have_rendered('new')
+ .to have_rendered("new")
end
- it 'have a user object initialized' do
+ it "have a user object initialized" do
expect(assigns(:user))
.to be_a(User)
end
@@ -106,10 +106,10 @@
end
end
- describe 'GET deletion_info' do
- let(:params) { { 'id' => user.id.to_s } }
+ describe "GET deletion_info" do
+ let(:params) { { "id" => user.id.to_s } }
- context 'when the current user is the requested user' do
+ context "when the current user is the requested user" do
current_user { user }
context "when the setting users_deletable_by_self is set to true",
@@ -120,11 +120,11 @@
it { expect(response).to have_http_status(:success) }
- it 'assigns @user to requested user' do
+ it "assigns @user to requested user" do
expect(assigns(:user)).to eq(user)
end
- it { expect(response).to render_template('deletion_info') }
+ it { expect(response).to render_template("deletion_info") }
end
context "when the setting users_deletable_by_self is set to false",
@@ -137,7 +137,7 @@
end
end
- context 'when the current user is the anonymous user' do
+ context "when the current user is the anonymous user" do
current_user { anonymous }
before do
@@ -145,10 +145,10 @@
end
it {
- expect(response).to redirect_to(controller: 'account',
- action: 'login',
- back_url: controller.url_for(controller: 'users',
- action: 'deletion_info'))
+ expect(response).to redirect_to(controller: "account",
+ action: "login",
+ back_url: controller.url_for(controller: "users",
+ action: "deletion_info"))
}
end
@@ -163,11 +163,11 @@
it { expect(response).to have_http_status(:success) }
- it 'assigns @user to requested user' do
+ it "assigns @user to requested user" do
expect(assigns(:user)).to eq(user)
end
- it { expect(response).to render_template('deletion_info') }
+ it { expect(response).to render_template("deletion_info") }
end
context "when the setting users_deletable_by_admins is set to false",
@@ -181,10 +181,10 @@
end
end
- describe 'POST resend_invitation' do
+ describe "POST resend_invitation" do
let(:invited_user) { create(:invited_user) }
- context 'without admin rights' do
+ context "without admin rights" do
let(:normal_user) { create(:user) }
before do
@@ -193,12 +193,12 @@
end
end
- it 'returns 403 forbidden' do
+ it "returns 403 forbidden" do
expect(response.status).to eq 403
end
end
- context 'with admin rights' do
+ context "with admin rights" do
before do
expect(ActionMailer::Base.deliveries).to be_empty
@@ -209,51 +209,51 @@
end
end
- it 'redirects back to the edit user page' do
+ it "redirects back to the edit user page" do
expect(response).to redirect_to edit_user_path(invited_user)
end
- it 'sends another activation email' do
+ it "sends another activation email" do
mail = ActionMailer::Base.deliveries.first.body.parts.first.body.to_s
token = Token::Invitation.find_by user_id: invited_user.id
- expect(mail).to include 'activate your account'
+ expect(mail).to include "activate your account"
expect(mail).to include token.value
end
end
end
- describe 'GET edit' do
+ describe "GET edit" do
before do
as_logged_in_user admin do
get :edit, params: { id: user.id }
end
end
- it 'is success' do
+ it "is success" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the template' do
+ it "renders the template" do
expect(response)
- .to have_rendered('edit')
+ .to have_rendered("edit")
end
- it 'have a user object initialized' do
+ it "have a user object initialized" do
expect(assigns(:user))
.to eql user
end
end
- describe 'POST destroy' do
- let(:base_params) { { 'id' => user.id.to_s, back_url: my_account_path } }
+ describe "POST destroy" do
+ let(:base_params) { { "id" => user.id.to_s, back_url: my_account_path } }
before do
disable_flash_sweep
end
- context 'when the password confirmation is missing' do
+ context "when the password confirmation is missing" do
before do
allow(Setting).to receive(:users_deletable_by_self?).and_return(true)
@@ -263,18 +263,18 @@
end
it do
- expect(response).to redirect_to(controller: 'my', action: 'account')
+ expect(response).to redirect_to(controller: "my", action: "account")
end
it { expect(flash[:error]).to eq(I18n.t(:notice_password_confirmation_failed)) }
end
- context 'when password confirmation is present' do
+ context "when password confirmation is present" do
let(:params) do
base_params.merge(_password_confirmation: user_password)
end
- context 'when the current user is the requested one' do
+ context "when the current user is the requested one" do
current_user { user }
context "when the setting users_deletable_by_self is set to true",
@@ -284,13 +284,13 @@
end
it do
- expect(response).to redirect_to(controller: 'account', action: 'login')
+ expect(response).to redirect_to(controller: "account", action: "login")
end
- it { expect(flash[:notice]).to eq(I18n.t('account.deletion_pending')) }
+ it { expect(flash[:notice]).to eq(I18n.t("account.deletion_pending")) }
end
- context 'when the setting users_deletable_by_self is set to false',
+ context "when the setting users_deletable_by_self is set to false",
with_settings: { users_deletable_by_self: false } do
before do
post :destroy, params:
@@ -300,10 +300,10 @@
end
end
- context 'when the current user is the anonymous user' do
+ context "when the current user is the anonymous user" do
current_user { anonymous }
- context 'even when the setting login_required is set to false and users_deletable_by_self is set to true',
+ context "even when the setting login_required is set to false and users_deletable_by_self is set to true",
with_settings: { login_required: false, users_deletable_by_self: true } do
before do
post :destroy, params: params.merge(id: anonymous.id.to_s)
@@ -314,7 +314,7 @@
end
end
- context 'when the current user is the admin' do
+ context "when the current user is the admin" do
current_user { admin }
context "when the given password does NOT match and the setting users_deletable_by_admins is set to true",
@@ -323,8 +323,8 @@
post :destroy, params:
end
- it 'redirects with error' do
- expect(response).to redirect_to(controller: 'my', action: 'account')
+ it "redirects with error" do
+ expect(response).to redirect_to(controller: "my", action: "account")
expect(flash[:notice]).to be_nil
expect(flash[:error]).to eq(I18n.t(:notice_password_confirmation_failed))
end
@@ -333,14 +333,14 @@
context "when the given password does match and the setting users_deletable_by_admins is set to true",
with_settings: { users_deletable_by_admins: true } do
before do
- post :destroy, params: params.merge(_password_confirmation: 'adminADMIN!')
+ post :destroy, params: params.merge(_password_confirmation: "adminADMIN!")
end
it do
- expect(response).to redirect_to(controller: 'users', action: 'index')
+ expect(response).to redirect_to(controller: "users", action: "index")
end
- it { expect(flash[:notice]).to eq(I18n.t('account.deletion_pending')) }
+ it { expect(flash[:notice]).to eq(I18n.t("account.deletion_pending")) }
end
context "when the setting users_deletable_by_admins is set to false",
@@ -355,7 +355,7 @@
end
end
- describe '#change_status_info' do
+ describe "#change_status_info" do
let!(:registered_user) do
create(:user, status: User.statuses[:registered])
end
@@ -370,52 +370,52 @@
end
end
- shared_examples 'valid status info' do
- it 'renders the status info' do
+ shared_examples "valid status info" do
+ it "renders the status info" do
expect(response).to be_successful
- expect(response).to render_template 'users/change_status_info'
+ expect(response).to render_template "users/change_status_info"
expect(assigns(:user)).to eq(registered_user)
expect(assigns(:status_change)).to eq(change_action)
end
end
- describe 'with valid activate' do
+ describe "with valid activate" do
let(:change_action) { :activate }
- it_behaves_like 'valid status info'
+ it_behaves_like "valid status info"
end
- describe 'with valid unlock' do
+ describe "with valid unlock" do
let(:change_action) { :unlock }
- it_behaves_like 'valid status info'
+ it_behaves_like "valid status info"
end
- describe 'with valid lock' do
+ describe "with valid lock" do
let(:change_action) { :lock }
- it_behaves_like 'valid status info'
+ it_behaves_like "valid status info"
end
- describe 'bogus status' do
+ describe "bogus status" do
let(:change_action) { :wtf }
- it 'renders 400' do
+ it "renders 400" do
expect(response.status).to eq(400)
- expect(response).not_to render_template 'users/change_status_info'
+ expect(response).not_to render_template "users/change_status_info"
end
end
end
- describe '#change_status',
+ describe "#change_status",
with_settings: {
available_languages: %w[en de],
bcc_recipients: 1
} do
- describe 'WHEN activating a registered user' do
+ describe "WHEN activating a registered user" do
let!(:registered_user) do
create(:user, status: User.statuses[:registered],
- language: 'de')
+ language: "de")
end
let(:user_limit_reached) { false }
@@ -428,22 +428,22 @@
params: {
id: registered_user.id,
user: { status: User.statuses[:active] },
- activate: '1'
+ activate: "1"
}
end
end
- it 'activates the user' do
+ it "activates the user" do
assert registered_user.reload.active?
end
- it 'sends an email to the correct user in the correct language' do
+ it "sends an email to the correct user in the correct language" do
perform_enqueued_jobs
mail = ActionMailer::Base.deliveries.last
expect(mail).not_to be_nil
expect([registered_user.mail]).to eq(mail.to)
mail.parts.each do |part|
- expect(part.body.encoded).to include(I18n.t(:notice_account_activated, locale: 'de'))
+ expect(part.body.encoded).to include(I18n.t(:notice_account_activated, locale: "de"))
end
end
@@ -461,7 +461,7 @@
end
end
- describe 'GET #index' do
+ describe "GET #index" do
let(:params) { {} }
before do
@@ -470,45 +470,45 @@
end
end
- it 'to be success' do
+ it "to be success" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the index' do
+ it "renders the index" do
expect(response)
- .to have_rendered('index')
+ .to have_rendered("index")
end
- it 'assigns users' do
+ it "assigns users" do
expect(assigns(:users))
.to contain_exactly(user, admin)
end
- context 'with a name filter' do
+ context "with a name filter" do
let(:params) { { name: user.firstname } }
- it 'assigns users' do
+ it "assigns users" do
expect(assigns(:users))
.to contain_exactly(user)
end
end
- context 'with a group filter' do
+ context "with a group filter" do
let(:group) { create(:group, members: [user]) }
let(:params) do
{ group_id: group.id }
end
- it 'assigns users' do
+ it "assigns users" do
expect(assigns(:users))
.to contain_exactly(user)
end
end
end
- describe 'session lifetime' do
+ describe "session lifetime" do
# TODO move this section to a proper place because we test a
# before_action from the application controller
@@ -517,120 +517,120 @@
User.current = nil
end
- shared_examples_for 'index action with disabled session lifetime or inactivity not exceeded' do
+ shared_examples_for "index action with disabled session lifetime or inactivity not exceeded" do
it "doesn't logout the user and renders the index action" do
expect(User.current).to eq(admin)
- expect(response).to render_template 'index'
+ expect(response).to render_template "index"
end
end
- shared_examples_for 'index action with enabled session lifetime and inactivity exceeded' do
- it 'logs out the user and redirects with a warning that he has been locked out' do
- expect(response.redirect_url).to eq(signin_url + '?back_url=' + CGI::escape(@controller.url_for(controller: 'users',
- action: 'index')))
+ shared_examples_for "index action with enabled session lifetime and inactivity exceeded" do
+ it "logs out the user and redirects with a warning that he has been locked out" do
+ expect(response.redirect_url).to eq(signin_url + "?back_url=" + CGI::escape(@controller.url_for(controller: "users",
+ action: "index")))
expect(User.current).not_to eq(admin)
expect(flash[:warning]).to eq(I18n.t(:notice_forced_logout, ttl_time: Setting.session_ttl))
end
end
- context 'disabled' do
+ context "disabled" do
before do
allow(Setting).to receive(:session_ttl_enabled?).and_return(false)
@controller.send(:logged_user=, admin)
get :index
end
- it_behaves_like 'index action with disabled session lifetime or inactivity not exceeded'
+ it_behaves_like "index action with disabled session lifetime or inactivity not exceeded"
end
- context 'enabled' do
+ context "enabled" do
before do
allow(Setting).to receive(:session_ttl_enabled?).and_return(true)
- allow(Setting).to receive(:session_ttl).and_return('120')
+ allow(Setting).to receive(:session_ttl).and_return("120")
@controller.send(:logged_user=, admin)
end
- context 'before 120 min of inactivity' do
+ context "before 120 min of inactivity" do
before do
session[:updated_at] = Time.now - 1.hour
get :index
end
- it_behaves_like 'index action with disabled session lifetime or inactivity not exceeded'
+ it_behaves_like "index action with disabled session lifetime or inactivity not exceeded"
end
- context 'after 120 min of inactivity' do
+ context "after 120 min of inactivity" do
before do
session[:updated_at] = Time.now - 3.hours
get :index
end
- it_behaves_like 'index action with enabled session lifetime and inactivity exceeded'
+ it_behaves_like "index action with enabled session lifetime and inactivity exceeded"
end
- context 'without last activity time in the session' do
+ context "without last activity time in the session" do
before do
- allow(Setting).to receive(:session_ttl).and_return('60')
+ allow(Setting).to receive(:session_ttl).and_return("60")
session[:updated_at] = nil
get :index
end
- it_behaves_like 'index action with enabled session lifetime and inactivity exceeded'
+ it_behaves_like "index action with enabled session lifetime and inactivity exceeded"
end
- context 'with ttl = 0' do
+ context "with ttl = 0" do
before do
- allow(Setting).to receive(:session_ttl).and_return('0')
+ allow(Setting).to receive(:session_ttl).and_return("0")
session[:updated_at] = Time.now - 1.hour
get :index
end
- it_behaves_like 'index action with disabled session lifetime or inactivity not exceeded'
+ it_behaves_like "index action with disabled session lifetime or inactivity not exceeded"
end
- context 'with ttl < 0' do
+ context "with ttl < 0" do
before do
- allow(Setting).to receive(:session_ttl).and_return('-60')
+ allow(Setting).to receive(:session_ttl).and_return("-60")
session[:updated_at] = Time.now - 1.hour
get :index
end
- it_behaves_like 'index action with disabled session lifetime or inactivity not exceeded'
+ it_behaves_like "index action with disabled session lifetime or inactivity not exceeded"
end
- context 'with ttl < 5 > 0' do
+ context "with ttl < 5 > 0" do
before do
- allow(Setting).to receive(:session_ttl).and_return('4')
+ allow(Setting).to receive(:session_ttl).and_return("4")
session[:updated_at] = Time.now - 1.hour
get :index
end
- it_behaves_like 'index action with disabled session lifetime or inactivity not exceeded'
+ it_behaves_like "index action with disabled session lifetime or inactivity not exceeded"
end
end
end
- describe 'PATCH #update' do
+ describe "PATCH #update" do
shared_let(:user_with_manage_user_global_permission) do
- create(:user, login: 'human-resources', global_permissions: [:manage_user])
+ create(:user, login: "human-resources", global_permissions: [:manage_user])
end
- shared_let(:some_user) { create(:user, firstname: 'User being updated') }
- shared_let(:some_admin) { create(:admin, firstname: 'Admin being updated') }
+ shared_let(:some_user) { create(:user, firstname: "User being updated") }
+ shared_let(:some_admin) { create(:admin, firstname: "Admin being updated") }
- context 'when updating fields as an admin' do
+ context "when updating fields as an admin" do
current_user { admin }
let(:params) do
{
id: some_user.id,
user: {
- firstname: 'Changed',
- login: 'changed_login',
+ firstname: "Changed",
+ login: "changed_login",
force_password_change: true
},
pref: {
- hide_mail: '1',
- comments_sorting: 'desc'
+ hide_mail: "1",
+ comments_sorting: "desc"
}
}
end
@@ -641,69 +641,69 @@
end
end
- it 'redirects to the edit page' do
+ it "redirects to the edit page" do
expect(response).to render_template :edit
end
- it 'is assigned their new values' do
+ it "is assigned their new values" do
some_user_from_db = User.find(some_user.id)
- expect(some_user_from_db.firstname).to eq('Changed')
- expect(some_user_from_db.login).to eq('changed_login')
+ expect(some_user_from_db.firstname).to eq("Changed")
+ expect(some_user_from_db.login).to eq("changed_login")
expect(some_user_from_db.force_password_change).to be(true)
expect(some_user_from_db.pref[:hide_mail]).to be_truthy
- expect(some_user_from_db.pref[:comments_sorting]).to eq('desc')
+ expect(some_user_from_db.pref[:comments_sorting]).to eq("desc")
end
- it 'sends no mail' do
+ it "sends no mail" do
expect(ActionMailer::Base.deliveries).to be_empty
end
- context 'when updating the password' do
+ context "when updating the password" do
let(:params) do
{
id: some_user.id,
- user: { password: 'newpassPASS!',
- password_confirmation: 'newpassPASS!' },
- send_information: '1'
+ user: { password: "newpassPASS!",
+ password_confirmation: "newpassPASS!" },
+ send_information: "1"
}
end
- it 'sends an email to the user with the password in it' do
+ it "sends an email to the user with the password in it" do
mail = ActionMailer::Base.deliveries.last
expect(mail.to)
.to contain_exactly(some_user.mail)
expect(mail.body.encoded)
- .to include('newpassPASS!')
+ .to include("newpassPASS!")
end
end
- context 'with invalid params' do
+ context "with invalid params" do
let(:params) do
{
id: some_user.id,
user: {
- firstname: ''
+ firstname: ""
}
}
end
- it 'is success' do
+ it "is success" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the edit template with errors' do
+ it "renders the edit template with errors" do
expect(response)
- .to have_rendered('edit')
+ .to have_rendered("edit")
expect(assigns(:user).errors.first)
.to have_attributes(attribute: :firstname, type: :blank)
end
end
end
- shared_examples 'it can update field' do |field:, value:, edited_user:, current_user:|
+ shared_examples "it can update field" do |field:, value:, edited_user:, current_user:|
it "can change field #{field} " \
"of #{edited_user.to_s.humanize(capitalize: false)} " \
"as #{current_user.to_s.humanize(capitalize: false)}" do
@@ -720,7 +720,7 @@
end
end
- shared_examples 'it cannot update field' do |field:, value:, edited_user:, current_user:|
+ shared_examples "it cannot update field" do |field:, value:, edited_user:, current_user:|
it "cannot change field #{field} " \
"of #{edited_user.to_s.humanize(capitalize: false)} " \
"as #{current_user.to_s.humanize(capitalize: false)}" do
@@ -738,122 +738,122 @@
end
# admin field
- include_examples 'it can update field',
+ include_examples "it can update field",
field: :admin,
value: true,
edited_user: :some_user,
current_user: :admin
- include_examples 'it can update field',
+ include_examples "it can update field",
field: :admin,
value: false,
edited_user: :some_admin,
current_user: :admin
- include_examples 'it cannot update field',
+ include_examples "it cannot update field",
field: :admin,
value: true,
edited_user: :some_user,
current_user: :user
- include_examples 'it cannot update field',
+ include_examples "it cannot update field",
field: :admin,
value: true,
edited_user: :some_user,
current_user: :user_with_manage_user_global_permission
# email field
- include_examples 'it can update field',
+ include_examples "it can update field",
field: :mail,
- value: 'another_email@example.com',
+ value: "another_email@example.com",
edited_user: :some_user,
current_user: :admin
- include_examples 'it can update field',
+ include_examples "it can update field",
field: :mail,
- value: 'another_email@example.com',
+ value: "another_email@example.com",
edited_user: :some_admin,
current_user: :admin
- include_examples 'it can update field',
+ include_examples "it can update field",
field: :mail,
- value: 'another_email@example.com',
+ value: "another_email@example.com",
edited_user: :some_user,
current_user: :user_with_manage_user_global_permission
- include_examples 'it cannot update field',
+ include_examples "it cannot update field",
field: :mail,
- value: 'another_email@example.com',
+ value: "another_email@example.com",
edited_user: :some_admin,
current_user: :user_with_manage_user_global_permission
- include_examples 'it cannot update field',
+ include_examples "it cannot update field",
field: :mail,
- value: 'another_email@example.com',
+ value: "another_email@example.com",
edited_user: :some_user,
current_user: :user
- context 'with external authentication' do
- let(:some_user) { create(:user, identity_url: 'some:identity') }
+ context "with external authentication" do
+ let(:some_user) { create(:user, identity_url: "some:identity") }
before do
as_logged_in_user(admin) do
- put :update, params: { id: some_user.id, user: { force_password_change: 'true' } }
+ put :update, params: { id: some_user.id, user: { force_password_change: "true" } }
end
some_user.reload
end
- it 'ignores setting force_password_change' do
+ it "ignores setting force_password_change" do
expect(some_user.force_password_change).to be(false)
end
end
- context 'with ldap auth source' do
+ context "with ldap auth source" do
let(:ldap_auth_source) { create(:ldap_auth_source) }
- it 'switching to internal authentication on a password change' do
+ it "switching to internal authentication on a password change" do
some_user.ldap_auth_source = ldap_auth_source
as_logged_in_user admin do
put :update,
params: {
id: some_user.id,
- user: { ldap_auth_source_id: '', password: 'newpassPASS!',
- password_confirmation: 'newpassPASS!' }
+ user: { ldap_auth_source_id: "", password: "newpassPASS!",
+ password_confirmation: "newpassPASS!" }
}
end
expect(some_user.reload.ldap_auth_source).to be_nil
- expect(some_user.check_password?('newpassPASS!')).to be true
+ expect(some_user.check_password?("newpassPASS!")).to be true
end
end
- context 'with disabled_password_choice',
+ context "with disabled_password_choice",
with_config: { disable_password_choice: true } do
- it 'ignores password parameters and leaves the password unchanged' do
+ it "ignores password parameters and leaves the password unchanged" do
as_logged_in_user(admin) do
put :update,
params: {
id: user.id,
- user: { password: 'changedpass!', password_confirmation: 'changedpass!' }
+ user: { password: "changedpass!", password_confirmation: "changedpass!" }
}
end
- expect(user.reload.check_password?('changedpass!')).to be false
+ expect(user.reload.check_password?("changedpass!")).to be false
end
end
end
- describe 'Anonymous should not be able to create a user' do
- it 'redirects to the login page' do
+ describe "Anonymous should not be able to create a user" do
+ it "redirects to the login page" do
post :create,
params: {
user: {
- login: 'psmith',
- firstname: 'Paul',
- lastname: 'Smith'
+ login: "psmith",
+ firstname: "Paul",
+ lastname: "Smith"
},
- password: 'psmithPSMITH09',
- password_confirmation: 'psmithPSMITH09'
+ password: "psmithPSMITH09",
+ password_confirmation: "psmithPSMITH09"
}
- expect(response).to redirect_to '/login?back_url=http%3A%2F%2Ftest.host%2Fusers'
+ expect(response).to redirect_to "/login?back_url=http%3A%2F%2Ftest.host%2Fusers"
end
end
- describe 'GET #show' do
- describe 'general' do
+ describe "GET #show" do
+ describe "general" do
let(:current_user) { user }
let(:params) { { id: user.id } }
let(:action) { :show }
@@ -864,73 +864,73 @@
end
end
- it 'responds with success', :aggregate_failures do
+ it "responds with success", :aggregate_failures do
expect(response).to be_successful
- expect(response).to render_template 'show'
+ expect(response).to render_template "show"
expect(assigns(:user)).to eq(user)
end
context 'when requesting special value "me"' do
- let(:params) { { id: 'me' } }
+ let(:params) { { id: "me" } }
- it 'responds with success', :aggregate_failures do
+ it "responds with success", :aggregate_failures do
expect(response).to be_successful
- expect(response).to render_template 'show'
+ expect(response).to render_template "show"
expect(assigns(:user)).to eq(user)
end
end
- context 'when not being logged in' do
+ context "when not being logged in" do
let(:current_user) { User.anonymous }
- context 'when login_required', with_settings: { login_required: true } do
- it 'redirects to login' do
+ context "when login_required", with_settings: { login_required: true } do
+ it "redirects to login" do
expect(response).to redirect_to signin_path(back_url: user_url(user.id))
end
end
- context 'when not login_required', with_settings: { login_required: false } do
- it 'responds with 404' do
+ context "when not login_required", with_settings: { login_required: false } do
+ it "responds with 404" do
expect(response)
.to have_http_status(:not_found)
end
end
context 'when requesting special value "me"' do
- let(:params) { { id: 'me' } }
+ let(:params) { { id: "me" } }
- it 'redirects to login', :aggregate_failures do
- expect(response).to redirect_to signin_url(back_url: user_url('me'))
+ it "redirects to login", :aggregate_failures do
+ expect(response).to redirect_to signin_url(back_url: user_url("me"))
end
end
end
- context 'when the user is locked for an admin' do
+ context "when the user is locked for an admin" do
let(:current_user) do
user.locked!
admin
end
- it 'responds with 200' do
+ it "responds with 200" do
expect(response)
.to have_http_status(:ok)
end
end
- context 'when the user is locked for an non admin' do
+ context "when the user is locked for an non admin" do
let(:current_user) do
user.locked!
create(:user)
end
- it 'responds with 200' do
+ it "responds with 200" do
expect(response)
.to have_http_status(:not_found)
end
end
end
- describe 'for user with Activity' do
+ describe "for user with Activity" do
render_views
let(:work_package) do
@@ -974,26 +974,26 @@
get :show, params: { id: user.id }
end
- it 'includes the number of reported work packages' do
+ it "includes the number of reported work packages" do
label = Regexp.escape(I18n.t(:label_reported_work_packages))
- expect(response.body).to have_css('p', text: /#{label}.*42/)
+ expect(response.body).to have_css("p", text: /#{label}.*42/)
end
end
end
- describe 'POST #create' do
+ describe "POST #create" do
current_user { admin }
let(:params) do
{
user: {
- firstname: 'John',
- lastname: 'Doe',
- login: 'jdoe',
- password: 'adminADMIN!',
- password_confirmation: 'adminADMIN!',
- mail: 'jdoe@gmail.com'
+ firstname: "John",
+ lastname: "Doe",
+ login: "jdoe",
+ password: "adminADMIN!",
+ password_confirmation: "adminADMIN!",
+ mail: "jdoe@gmail.com"
},
pref: {}
}
@@ -1005,17 +1005,17 @@
end
end
- it 'is successful' do
+ it "is successful" do
expect(response)
.to redirect_to edit_user_path(User.newest.first)
end
- it 'creates the user with the provided params' do
+ it "creates the user with the provided params" do
expect(User.newest.first.attributes.with_indifferent_access.slice(:firstname, :lastname, :login, :mail))
.to eql params[:user].with_indifferent_access.slice(:firstname, :lastname, :login, :mail)
end
- it 'sends an activation mail' do
+ it "sends an activation mail" do
mail = ActionMailer::Base.deliveries.last
expect(mail.to)
@@ -1029,12 +1029,12 @@
assert(mail.body.encoded =~ activation_link)
end
- context 'with invalid parameters' do
- let(:params) { { user: { login: 'jdoe' } } }
+ context "with invalid parameters" do
+ let(:params) { { user: { login: "jdoe" } } }
- it 'renders new' do
+ it "renders new" do
expect(response)
- .to render_template 'new'
+ .to render_template "new"
end
end
end
diff --git a/spec/controllers/versions_controller_spec.rb b/spec/controllers/versions_controller_spec.rb
index 1746c43ea993..38ae203668d3 100644
--- a/spec/controllers/versions_controller_spec.rb
+++ b/spec/controllers/versions_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe VersionsController do
let(:user) { create(:admin) }
@@ -35,7 +35,7 @@
let(:version2) { create(:version, project:) }
let(:version3) { create(:version, project:, effective_date: (Date.today - 14.days)) }
- describe '#index' do
+ describe "#index" do
render_views
before do
@@ -44,31 +44,31 @@
version3
end
- context 'without additional params' do
+ context "without additional params" do
before do
login_as(user)
get :index, params: { project_id: project.id }
end
it { expect(response).to be_successful }
- it { expect(response).to render_template('index') }
+ it { expect(response).to render_template("index") }
subject { assigns(:versions) }
- it 'shows Version with no date set' do
+ it "shows Version with no date set" do
expect(subject.include?(version1)).to be_truthy
end
- it 'shows Version with date set' do
+ it "shows Version with date set" do
expect(subject.include?(version2)).to be_truthy
end
- it 'not shows Completed version' do
+ it "not shows Completed version" do
expect(subject.include?(version3)).to be_falsey
end
end
- context 'with showing selected types' do
+ context "with showing selected types" do
let(:type_a) { create(:type) }
let(:type_b) { create(:type) }
@@ -84,13 +84,13 @@
login_as(user)
end
- describe 'with all types' do
+ describe "with all types" do
before do
- get :index, params: { project_id: project, completed: '1' }
+ get :index, params: { project_id: project, completed: "1" }
end
it { expect(response).to be_successful }
- it { expect(response).to render_template('index') }
+ it { expect(response).to render_template("index") }
it "shows all work packages" do
issues_by_version = assigns(:wps_by_version)
@@ -101,13 +101,13 @@
end
end
- describe 'with selected types' do
+ describe "with selected types" do
before do
- get :index, params: { project_id: project, completed: '1', type_ids: [type_b.id] }
+ get :index, params: { project_id: project, completed: "1", type_ids: [type_b.id] }
end
it { expect(response).to be_successful }
- it { expect(response).to render_template('index') }
+ it { expect(response).to render_template("index") }
it "shows only work packages of the selected type" do
issues_by_version = assigns(:wps_by_version)
@@ -119,31 +119,31 @@
end
end
- context 'with showing completed versions' do
+ context "with showing completed versions" do
before do
login_as(user)
- get :index, params: { project_id: project, completed: '1' }
+ get :index, params: { project_id: project, completed: "1" }
end
it { expect(response).to be_successful }
- it { expect(response).to render_template('index') }
+ it { expect(response).to render_template("index") }
subject { assigns(:versions) }
- it 'shows Version with no date set' do
+ it "shows Version with no date set" do
expect(subject.include?(version1)).to be_truthy
end
- it 'shows Version with date set' do
+ it "shows Version with date set" do
expect(subject.include?(version2)).to be_truthy
end
- it 'not shows Completed version' do
+ it "not shows Completed version" do
expect(subject.include?(version3)).to be_truthy
end
end
- describe 'Sub Project Versions' do
+ describe "Sub Project Versions" do
let!(:sub_project) { create(:public_project, parent_id: project.id) }
let!(:sub_project_version) { create(:version, project: sub_project) }
@@ -155,19 +155,19 @@
subject { assigns(:versions) }
- shared_examples 'is successful' do
+ shared_examples "is successful" do
it { expect(response).to be_successful }
- it { expect(response).to render_template('index') }
+ it { expect(response).to render_template("index") }
end
- shared_examples 'shows versions with and without a date set' do
+ shared_examples "shows versions with and without a date set" do
it do
expect(subject).to include(version1, version2)
end
end
shared_examples "shows sub project's' version" do
- it 'sets @with_subprojects to true' do
+ it "sets @with_subprojects to true" do
expect(assigns(:with_subprojects)).to be_truthy
end
@@ -177,7 +177,7 @@
end
shared_examples "does not show sub project's versions" do
- it 'sets @with_subprojects to false' do
+ it "sets @with_subprojects to false" do
expect(assigns(:with_subprojects)).to be_falsey
end
@@ -186,40 +186,40 @@
end
end
- context 'when with_subprojects param is set to 1' do
+ context "when with_subprojects param is set to 1" do
let(:params) { { project_id: project.id, with_subprojects: 1 } }
- include_examples 'is successful'
+ include_examples "is successful"
include_examples "shows sub project's' version"
end
- context 'when with_subprojects param is set to 0' do
+ context "when with_subprojects param is set to 0" do
let(:params) { { project_id: project.id, with_subprojects: 0 } }
- include_examples 'is successful'
+ include_examples "is successful"
include_examples "does not show sub project's versions"
end
- context 'with sub projects included by default',
+ context "with sub projects included by default",
with_settings: { display_subprojects_work_packages: true } do
- context 'and with_subprojects is not a param' do
+ context "and with_subprojects is not a param" do
let(:params) { { project_id: project.id } }
- include_examples 'is successful'
+ include_examples "is successful"
include_examples "shows sub project's' version"
end
- context 'and with_subprojects is set to 0' do
+ context "and with_subprojects is set to 0" do
let(:params) { { project_id: project.id, with_subprojects: 0 } }
- include_examples 'is successful'
+ include_examples "is successful"
include_examples "does not show sub project's versions"
end
end
end
end
- describe '#show' do
+ describe "#show" do
render_views
before do
@@ -229,42 +229,42 @@
end
it { expect(response).to be_successful }
- it { expect(response).to render_template('show') }
- it { assert_select 'h2', content: version2.name }
+ it { expect(response).to render_template("show") }
+ it { assert_select "h2", content: version2.name }
subject { assigns(:version) }
it { is_expected.to eq(version2) }
end
- describe '#new' do
+ describe "#new" do
# This spec is here because at one point the `new` action was requiring
# the `version` key in params, so visiting it without one failed.
- it 'renders correctly' do
+ it "renders correctly" do
login_as(user)
get :new, params: { project_id: project.id }
expect(response.status).to eq(200)
end
end
- describe '#create' do
- context 'with valid attributes' do
+ describe "#create" do
+ context "with valid attributes" do
before do
login_as(user)
- post :create, params: { project_id: project.id, version: { name: 'test_add_version' } }
+ post :create, params: { project_id: project.id, version: { name: "test_add_version" } }
end
it { expect(response).to redirect_to(project_settings_versions_path(project)) }
- it 'generates the new version' do
- version = Version.find_by(name: 'test_add_version')
+ it "generates the new version" do
+ version = Version.find_by(name: "test_add_version")
expect(version).not_to be_nil
expect(version.project).to eq(project)
end
end
end
- describe '#edit' do
+ describe "#edit" do
render_views
before do
@@ -273,33 +273,33 @@
get :edit, params: { id: version2.id }
end
- context 'when resource is found' do
+ context "when resource is found" do
it { expect(response).to be_successful }
- it { expect(response).to render_template('edit') }
+ it { expect(response).to render_template("edit") }
end
end
- describe '#close_completed' do
+ describe "#close_completed" do
before do
login_as(user)
- version1.update_attribute :status, 'open'
- version2.update_attribute :status, 'open'
- version3.update_attribute :status, 'open'
+ version1.update_attribute :status, "open"
+ version2.update_attribute :status, "open"
+ version3.update_attribute :status, "open"
put :close_completed, params: { project_id: project.id }
end
it { expect(response).to redirect_to(project_settings_versions_path(project)) }
- it { expect(Version.find_by(status: 'closed')).to eq(version3) }
+ it { expect(Version.find_by(status: "closed")).to eq(version3) }
end
- describe '#update' do
- context 'with valid params' do
+ describe "#update" do
+ context "with valid params" do
let(:params) do
{
id: version1.id,
version: {
- name: 'New version name',
- effective_date: Date.today.strftime('%Y-%m-%d')
+ name: "New version name",
+ effective_date: Date.today.strftime("%Y-%m-%d")
}
}
end
@@ -310,7 +310,7 @@
end
it { expect(response).to redirect_to(project_settings_versions_path(project)) }
- it { expect(Version.find_by(name: 'New version name')).to eq(version1) }
+ it { expect(Version.find_by(name: "New version name")).to eq(version1) }
it { expect(version1.reload.effective_date).to eq(Date.today) }
end
@@ -321,8 +321,8 @@
patch :update,
params: {
id: version1.id,
- version: { name: 'New version name',
- effective_date: Date.today.strftime('%Y-%m-%d') },
+ version: { name: "New version name",
+ effective_date: Date.today.strftime("%Y-%m-%d") },
back_url: home_path
}
end
@@ -330,31 +330,31 @@
it { expect(response).to redirect_to(home_path) }
end
- context 'with invalid params' do
+ context "with invalid params" do
before do
login_as(user)
patch :update,
params: {
id: version1.id,
- version: { name: '',
- effective_date: Date.today.strftime('%Y-%m-%d') }
+ version: { name: "",
+ effective_date: Date.today.strftime("%Y-%m-%d") }
}
end
it { expect(response).to be_successful }
- it { expect(response).to render_template('edit') }
+ it { expect(response).to render_template("edit") }
it { expect(assigns(:version).errors.symbols_for(:name)).to contain_exactly(:blank) }
end
end
- describe '#destroy' do
+ describe "#destroy" do
before do
login_as(user)
@deleted = version3.id
delete :destroy, params: { id: @deleted }
end
- it 'redirects to projects versions and the version is deleted' do
+ it "redirects to projects versions and the version is deleted" do
expect(response).to redirect_to(project_settings_versions_path(project))
expect { Version.find(@deleted) }.to raise_error ActiveRecord::RecordNotFound
end
diff --git a/spec/controllers/wiki_controller_spec.rb b/spec/controllers/wiki_controller_spec.rb
index 43ece7d6c8c7..9adb49497620 100644
--- a/spec/controllers/wiki_controller_spec.rb
+++ b/spec/controllers/wiki_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe WikiController do
shared_let(:admin) { create(:admin) }
@@ -37,45 +37,45 @@
shared_let(:wiki) { project.wiki }
shared_let(:existing_page) do
- create(:wiki_page, wiki_id: project.wiki.id, title: 'ExistingPage', author: admin)
+ create(:wiki_page, wiki_id: project.wiki.id, title: "ExistingPage", author: admin)
end
- describe 'actions' do
+ describe "actions" do
before do
allow(controller).to receive(:set_localization)
end
current_user { admin }
- describe 'index' do
+ describe "index" do
before do
get :index, params: { project_id: project.identifier }
end
- it 'is successful' do
+ it "is successful" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the index template' do
+ it "renders the index template" do
expect(response)
.to render_template(:index)
end
- it 'assigns pages' do
+ it "assigns pages" do
expect(assigns[:pages])
.to eq project.wiki.pages
end
end
shared_examples_for "a 'new' action" do
- it 'assigns @project to the current project' do
+ it "assigns @project to the current project" do
get_page
expect(assigns[:project]).to eq(project)
end
- it 'assigns @page to a newly created wiki page' do
+ it "assigns @page to a newly created wiki page" do
get_page
expect(assigns[:page]).to be_new_record
@@ -83,38 +83,38 @@
expect(assigns[:page].wiki).to eq(project.wiki)
end
- it 'renders the new action' do
+ it "renders the new action" do
get_page
- expect(response).to render_template 'new'
+ expect(response).to render_template "new"
end
end
- describe 'new' do
- let(:get_page) { get 'new', params: { project_id: project } }
+ describe "new" do
+ let(:get_page) { get "new", params: { project_id: project } }
it_behaves_like "a 'new' action"
end
- describe 'new_child' do
- let(:get_page) { get 'new_child', params: { project_id: project, id: existing_page.title } }
+ describe "new_child" do
+ let(:get_page) { get "new_child", params: { project_id: project, id: existing_page.title } }
it_behaves_like "a 'new' action"
- it 'sets the parent page for the new page' do
+ it "sets the parent page for the new page" do
get_page
expect(assigns[:page].parent).to eq(existing_page)
end
- it 'renders 404 if used with an unknown page title' do
- get 'new_child', params: { project_id: project, id: 'foobar' }
+ it "renders 404 if used with an unknown page title" do
+ get "new_child", params: { project_id: project, id: "foobar" }
expect(response.status).to eq(404) # not found
end
end
- describe 'show' do
+ describe "show" do
let(:permissions) { %w[view_wiki_pages] }
let(:user) { create(:user, member_with_permissions: { project => permissions }) }
@@ -124,40 +124,40 @@
get_page
end
- context 'when querying for an existing page' do
+ context "when querying for an existing page" do
let(:get_page) { get :show, params: { project_id: project, id: existing_page.title } }
- it 'is a success' do
+ it "is a success" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the show template' do
+ it "renders the show template" do
expect(response)
.to render_template(:show)
end
- it 'assigns the page' do
+ it "assigns the page" do
expect(assigns[:page])
.to eql existing_page
end
end
- context 'when querying for the wiki root page with edit permissions' do
- let(:get_page) { get :show, params: { project_id: project, id: 'wiki' } }
+ context "when querying for the wiki root page with edit permissions" do
+ let(:get_page) { get :show, params: { project_id: project, id: "wiki" } }
let(:permissions) { %w[view_wiki_pages edit_wiki_pages] }
- it 'is a success' do
+ it "is a success" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the new template' do
+ it "renders the new template" do
expect(response)
.to render_template(:new)
end
- it 'assigns a new page that is unpersisted' do
+ it "assigns a new page that is unpersisted" do
expect(assigns[:page])
.to be_a WikiPages::AtVersion
@@ -166,21 +166,21 @@
end
end
- context 'when querying for an unexisting page with edit permissions' do
- let(:get_page) { get :show, params: { project_id: project, id: 'new_page' } }
+ context "when querying for an unexisting page with edit permissions" do
+ let(:get_page) { get :show, params: { project_id: project, id: "new_page" } }
let(:permissions) { %w[view_wiki_pages edit_wiki_pages] }
- it 'is a success' do
+ it "is a success" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the new template' do
+ it "renders the new template" do
expect(response)
.to render_template(:new)
end
- it 'assigns a new page that is unpersisted' do
+ it "assigns a new page that is unpersisted" do
expect(assigns[:page])
.to be_a WikiPages::AtVersion
@@ -189,52 +189,52 @@
end
end
- context 'when querying for no specific page' do
+ context "when querying for no specific page" do
let(:get_page) do
project.wiki.update_column(:start_page, existing_page.title)
get :show, params: { project_id: project }
end
- it 'is a success' do
+ it "is a success" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the show template' do
+ it "renders the show template" do
expect(response)
.to render_template(:show)
end
- it 'assigns the wiki start page' do
+ it "assigns the wiki start page" do
expect(assigns[:page])
.to eql existing_page
end
end
- context 'when querying for the wiki root page without edit permissions' do
- let(:get_page) { get :show, params: { project_id: project, id: 'wiki' } }
+ context "when querying for the wiki root page without edit permissions" do
+ let(:get_page) { get :show, params: { project_id: project, id: "wiki" } }
- it 'redirects to index' do
+ it "redirects to index" do
expect(response).to redirect_to action: :index
end
- it 'shows a flash info' do
- expect(flash[:info]).to include I18n.t('wiki.page_not_editable_index')
+ it "shows a flash info" do
+ expect(flash[:info]).to include I18n.t("wiki.page_not_editable_index")
end
end
- context 'when querying for a non existing page without edit permissions' do
- let(:get_page) { get :show, params: { project_id: project, id: 'new_page' } }
+ context "when querying for a non existing page without edit permissions" do
+ let(:get_page) { get :show, params: { project_id: project, id: "new_page" } }
- it 'returns 404' do
+ it "returns 404" do
expect(response)
.to have_http_status(:not_found)
end
end
end
- describe 'edit' do
+ describe "edit" do
let(:permissions) { %i[view_wiki_pages edit_wiki_pages] }
let(:params) do
@@ -250,22 +250,22 @@
get :edit, params:, flash:
end
- context 'with an existing wiki page' do
+ context "with an existing wiki page" do
let(:params) do
{ project_id: project, id: existing_page.title }
end
- it 'is sucessful' do
+ it "is sucessful" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the edit template' do
+ it "renders the edit template" do
expect(response)
.to render_template :edit
end
- it 'assigns the page' do
+ it "assigns the page" do
expect(assigns[:page])
.to eq existing_page
@@ -274,36 +274,36 @@
end
end
- context 'with an existing wiki page that is protected' do
+ context "with an existing wiki page that is protected" do
let(:params) do
existing_page.update_column(:protected, true)
{ project_id: project, id: existing_page.title }
end
- it 'is forbiddend' do
+ it "is forbiddend" do
expect(response)
.to have_http_status(:forbidden)
end
end
- context 'with an existing wiki page that is protected and having the necessary permission' do
+ context "with an existing wiki page that is protected and having the necessary permission" do
let(:permissions) do
existing_page.update_column(:protected, true)
%i[view_wiki_pages edit_wiki_pages protect_wiki_pages]
end
- it 'is sucessful' do
+ it "is sucessful" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the edit template' do
+ it "renders the edit template" do
expect(response)
.to render_template :edit
end
- it 'assigns the page' do
+ it "assigns the page" do
expect(assigns[:page])
.to eq existing_page
@@ -312,23 +312,23 @@
end
end
- context 'with a related wiki page in the flash and a non existing wiki page' do
+ context "with a related wiki page in the flash and a non existing wiki page" do
let(:flash) { { _related_wiki_page_id: 1234 } }
let(:params) do
- { project_id: project, id: 'foobar' }
+ { project_id: project, id: "foobar" }
end
- it 'is sucessful' do
+ it "is sucessful" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the edit template' do
+ it "renders the edit template" do
expect(response)
.to render_template :edit
end
- it 'assigns @page to a new wiki page with the parent id set' do
+ it "assigns @page to a new wiki page with the parent id set" do
expect(assigns[:page])
.to be_a WikiPages::AtVersion
@@ -341,99 +341,99 @@
end
end
- describe 'create' do
- describe 'successful action' do
- it 'redirects to the show action' do
- post 'create',
+ describe "create" do
+ describe "successful action" do
+ it "redirects to the show action" do
+ post "create",
params: {
project_id: project,
- page: { text: 'h1. abc', title: 'abc' }
+ page: { text: "h1. abc", title: "abc" }
}
- expect(response).to redirect_to action: 'show', project_id: project, id: 'abc'
+ expect(response).to redirect_to action: "show", project_id: project, id: "abc"
end
- it 'saves a new WikiPage with proper content' do
- post 'create',
+ it "saves a new WikiPage with proper content" do
+ post "create",
params: {
project_id: project,
- page: { text: 'h1. abc', title: 'abc' }
+ page: { text: "h1. abc", title: "abc" }
}
- page = project.wiki.pages.find_by title: 'abc'
+ page = project.wiki.pages.find_by title: "abc"
expect(page).not_to be_nil
- expect(page.text).to eq('h1. abc')
+ expect(page.text).to eq("h1. abc")
end
end
- describe 'unsuccessful action' do
+ describe "unsuccessful action" do
it 'renders "wiki/new"' do
- post 'create',
+ post "create",
params: {
project_id: project,
- page: { text: 'h1. abc', title: '' }
+ page: { text: "h1. abc", title: "" }
}
- expect(response).to render_template('new')
+ expect(response).to render_template("new")
end
- it 'assigns project to work with new template' do
- post 'create',
+ it "assigns project to work with new template" do
+ post "create",
params: {
project_id: project,
- page: { text: 'h1. abc', title: '' }
+ page: { text: "h1. abc", title: "" }
}
expect(assigns[:project]).to eq(project)
end
- it 'assigns wiki to work with new template' do
- post 'create',
+ it "assigns wiki to work with new template" do
+ post "create",
params: {
project_id: project,
- page: { text: 'h1. abc', title: '' }
+ page: { text: "h1. abc", title: "" }
}
expect(assigns[:wiki]).to eq(project.wiki)
expect(assigns[:wiki]).not_to be_new_record
end
- it 'assigns page to work with new template' do
- post 'create',
+ it "assigns page to work with new template" do
+ post "create",
params: {
project_id: project,
- page: { text: 'h1. abc', title: '' }
+ page: { text: "h1. abc", title: "" }
}
expect(assigns[:page]).to be_new_record
expect(assigns[:page].wiki.project).to eq(project)
- expect(assigns[:page].title).to eq('')
- expect(assigns[:page].text).to eq('h1. abc')
+ expect(assigns[:page].title).to eq("")
+ expect(assigns[:page].text).to eq("h1. abc")
expect(assigns[:page]).not_to be_valid
end
end
end
- describe 'update' do
- context 'when the page is locked' do
+ describe "update" do
+ context "when the page is locked" do
before do
existing_page.update!(protected: true)
end
- it 'redirects to the show action' do
- post 'update',
+ it "redirects to the show action" do
+ post "update",
params: {
project_id: project,
id: existing_page.title,
- page: { text: 'h1. abc', title: 'foobar' }
+ page: { text: "h1. abc", title: "foobar" }
}
- expect(response).to redirect_to action: 'show', project_id: project, id: 'foobar'
+ expect(response).to redirect_to action: "show", project_id: project, id: "foobar"
end
end
end
- describe 'destroy' do
+ describe "destroy" do
shared_let(:parent_page) { create(:wiki_page, wiki:) }
shared_let(:child_page) { create(:wiki_page, wiki:, parent: parent_page) }
@@ -449,13 +449,13 @@
response
end
- context 'when it is not the only wiki page' do
- it 'redirects to wiki#index' do
+ context "when it is not the only wiki page" do
+ it "redirects to wiki#index" do
expect(subject)
- .to redirect_to action: 'index', project_id: project, id: redirect_page_after_destroy
+ .to redirect_to action: "index", project_id: project, id: redirect_page_after_destroy
end
- it 'destroys the page' do
+ it "destroys the page" do
expect { subject }
.to change { WikiPage.where(id: existing_page.id).count }
.from(1)
@@ -463,17 +463,17 @@
end
end
- context 'when it is the only wiki page' do
+ context "when it is the only wiki page" do
before do
WikiPage.where.not(id: existing_page.id).delete_all
end
- it 'redirects to projects#show' do
+ it "redirects to projects#show" do
expect(subject)
.to redirect_to project_path(project)
end
- it 'destroys the page' do
+ it "destroys the page" do
expect { subject }
.to change { WikiPage.where(id: existing_page.id).count }
.from(1)
@@ -481,17 +481,17 @@
end
end
- context 'when destroying a child' do
+ context "when destroying a child" do
let(:params) do
{ project_id: project, id: child_page }
end
- it 'redirects to wiki#index' do
+ it "redirects to wiki#index" do
expect(subject)
- .to redirect_to action: 'index', project_id: project, id: redirect_page_after_destroy
+ .to redirect_to action: "index", project_id: project, id: redirect_page_after_destroy
end
- it 'destroys the page' do
+ it "destroys the page" do
expect { subject }
.to change { WikiPage.where(id: child_page.id).count }
.from(1)
@@ -499,40 +499,40 @@
end
end
- context 'when destroying a parent without specifying todo' do
+ context "when destroying a parent without specifying todo" do
let(:params) do
{ project_id: project, id: parent_page }
end
- it 'responds with success' do
+ it "responds with success" do
expect(subject)
.to have_http_status(:ok)
end
- it 'destroys the page' do
+ it "destroys the page" do
expect { subject }
.not_to change(WikiPage, :count)
end
end
- context 'when destroying a parent with nullify' do
+ context "when destroying a parent with nullify" do
let(:params) do
- { project_id: project, id: parent_page, todo: 'nullify' }
+ { project_id: project, id: parent_page, todo: "nullify" }
end
- it 'redirects to wiki#index' do
+ it "redirects to wiki#index" do
expect(subject)
- .to redirect_to action: 'index', project_id: project, id: redirect_page_after_destroy
+ .to redirect_to action: "index", project_id: project, id: redirect_page_after_destroy
end
- it 'destroys the page' do
+ it "destroys the page" do
expect { subject }
.to change { WikiPage.where(id: parent_page.id).count }
.from(1)
.to(0)
end
- it 'sets the parent_id of the child to nil' do
+ it "sets the parent_id of the child to nil" do
subject
expect(child_page.parent_id)
@@ -540,17 +540,17 @@
end
end
- context 'when destroying a parent with todo = destroy' do
+ context "when destroying a parent with todo = destroy" do
let(:params) do
- { project_id: project, id: parent_page, todo: 'destroy' }
+ { project_id: project, id: parent_page, todo: "destroy" }
end
- it 'redirects to wiki#index' do
+ it "redirects to wiki#index" do
expect(subject)
- .to redirect_to action: 'index', project_id: project, id: redirect_page_after_destroy
+ .to redirect_to action: "index", project_id: project, id: redirect_page_after_destroy
end
- it 'destroys the page' do
+ it "destroys the page" do
expect { subject }
.to change { WikiPage.where(id: [parent_page, child_page]).count }
.from(2)
@@ -558,24 +558,24 @@
end
end
- context 'when destroying a parent with reassign' do
+ context "when destroying a parent with reassign" do
let(:params) do
- { project_id: project, id: parent_page, todo: 'reassign', reassign_to_id: existing_page.id }
+ { project_id: project, id: parent_page, todo: "reassign", reassign_to_id: existing_page.id }
end
- it 'redirects to wiki#index' do
+ it "redirects to wiki#index" do
expect(subject)
- .to redirect_to action: 'index', project_id: project, id: redirect_page_after_destroy
+ .to redirect_to action: "index", project_id: project, id: redirect_page_after_destroy
end
- it 'destroys the page' do
+ it "destroys the page" do
expect { subject }
.to change { WikiPage.where(id: parent_page).count }
.from(1)
.to(0)
end
- it 'sets the parent_id of the child to the specified page' do
+ it "sets the parent_id of the child to the specified page" do
subject
expect(child_page.parent_id)
@@ -584,7 +584,7 @@
end
end
- describe 'rename' do
+ describe "rename" do
shared_let(:parent_page) { create(:wiki_page, wiki:) }
shared_let(:child_page) { create(:wiki_page, wiki:, parent: parent_page) }
@@ -606,45 +606,45 @@
response
end
- context 'when getting for a page' do
- it 'is success' do
+ context "when getting for a page" do
+ it "is success" do
expect(subject)
.to have_http_status(:ok)
end
- it 'renders the template' do
+ it "renders the template" do
expect(subject)
.to render_template :rename
end
end
- context 'when getting for a child page' do
+ context "when getting for a child page" do
let(:params) do
{ project_id: project, id: child_page.title }
end
- it 'is success' do
+ it "is success" do
expect(subject)
.to have_http_status(:ok)
end
- it 'renders the template' do
+ it "renders the template" do
expect(subject)
.to render_template :rename
end
end
- context 'when getting for a page without permissions' do
+ context "when getting for a page without permissions" do
let(:permissions) { %i[view_wiki_pages] }
- it 'is forbidden' do
+ it "is forbidden" do
expect(subject)
.to have_http_status(:forbidden)
end
end
- context 'when patching with redirect' do
- let(:new_title) { 'The new page title' }
+ context "when patching with redirect" do
+ let(:new_title) { "The new page title" }
let!(:old_title) { existing_page.title }
let(:params) do
@@ -662,19 +662,19 @@
patch :rename, params:
end
- it 'redirects to the show page with the altered name' do
+ it "redirects to the show page with the altered name" do
expect(subject)
- .to redirect_to action: 'show', project_id: project.identifier, id: 'the-new-page-title'
+ .to redirect_to action: "show", project_id: project.identifier, id: "the-new-page-title"
end
- it 'renames the page' do
+ it "renames the page" do
subject
expect(existing_page.reload.title)
.to eql new_title
end
- it 'finds the page by the old name' do
+ it "finds the page by the old name" do
subject
expect(wiki.find_page(old_title))
@@ -682,8 +682,8 @@
end
end
- context 'when patching without redirect' do
- let(:new_title) { 'The new page title' }
+ context "when patching without redirect" do
+ let(:new_title) { "The new page title" }
let!(:old_title) { existing_page.title }
let(:params) do
@@ -692,7 +692,7 @@
id: existing_page.title,
page: {
title: new_title,
- redirect_existing_links: '0'
+ redirect_existing_links: "0"
}
}
end
@@ -701,19 +701,19 @@
patch :rename, params:
end
- it 'redirects to the show page with the altered name' do
+ it "redirects to the show page with the altered name" do
expect(subject)
- .to redirect_to action: 'show', project_id: project.identifier, id: 'the-new-page-title'
+ .to redirect_to action: "show", project_id: project.identifier, id: "the-new-page-title"
end
- it 'renames the page' do
+ it "renames the page" do
subject
expect(existing_page.reload.title)
.to eql new_title
end
- it 'does not find the page by the old name' do
+ it "does not find the page by the old name" do
subject
expect(wiki.find_page(old_title))
@@ -722,10 +722,10 @@
end
end
- describe 'diffs' do
+ describe "diffs" do
let!(:journal_from) { existing_page.journals.last }
let!(:journal_to) do
- existing_page.text = 'new_text'
+ existing_page.text = "new_text"
existing_page.save
existing_page.journals.reload.last
@@ -754,17 +754,17 @@
response
end
- it 'is success' do
+ it "is success" do
expect(subject)
.to have_http_status(:ok)
end
- it 'renders the template' do
+ it "renders the template" do
expect(subject)
.to render_template :diff
end
- it 'assigns html_diff' do
+ it "assigns html_diff" do
subject
expect(assigns[:html_diff])
@@ -772,10 +772,10 @@
end
end
- describe 'annotates' do
+ describe "annotates" do
let!(:journal_from) { existing_page.journals.last }
let!(:journal_to) do
- existing_page.text = 'new_text'
+ existing_page.text = "new_text"
existing_page.save
existing_page.journals.reload.last
@@ -799,18 +799,18 @@
response
end
- it 'is success' do
+ it "is success" do
expect(subject)
.to have_http_status(:ok)
end
- it 'renders the template' do
+ it "renders the template" do
expect(subject)
.to render_template :annotate
end
end
- describe 'export' do
+ describe "export" do
let(:permissions) { %i[view_wiki_pages export_wiki_pages] }
current_user { create(:user, member_with_permissions: { project => permissions }) }
@@ -819,36 +819,36 @@
get :export, params: { project_id: project.identifier }
end
- it 'is successful' do
+ it "is successful" do
expect(response)
.to have_http_status(:ok)
end
- it 'assigns pages' do
+ it "assigns pages" do
expect(assigns[:pages])
.to eq project.wiki.pages
end
- it 'is an html response' do
+ it "is an html response" do
expect(response.content_type)
- .to eq 'text/html'
+ .to eq "text/html"
end
- context 'for an unauthorized user' do
+ context "for an unauthorized user" do
let(:permissions) { %i[view_wiki_pages] }
- it 'prevents access' do
+ it "prevents access" do
expect(response)
.to have_http_status(:forbidden)
end
end
end
- describe 'protect' do
+ describe "protect" do
let(:permissions) { %i[view_wiki_pages protect_wiki_pages] }
let(:params) do
- { project_id: project, id: existing_page.title, protected: '1' }
+ { project_id: project, id: existing_page.title, protected: "1" }
end
let(:request) do
@@ -862,21 +862,21 @@
response
end
- context 'with an existing wiki page' do
- it 'set the protected property of the page' do
+ context "with an existing wiki page" do
+ it "set the protected property of the page" do
expect { subject }
.to change { existing_page.reload.protected? }
.from(false)
.to(true)
end
- it 'redirects to the show page' do
+ it "redirects to the show page" do
expect(subject)
- .to redirect_to action: 'show', project_id: project.identifier, id: existing_page.title.downcase
+ .to redirect_to action: "show", project_id: project.identifier, id: existing_page.title.downcase
end
end
- context 'with an existing wiki page that is protected' do
+ context "with an existing wiki page that is protected" do
let(:permissions) do
existing_page.update_column :protected, true
@@ -884,40 +884,40 @@
end
let(:params) do
- { project_id: project, id: existing_page.title, protected: '0' }
+ { project_id: project, id: existing_page.title, protected: "0" }
end
- it 'set the protected property of the page' do
+ it "set the protected property of the page" do
expect { subject }
.to change { existing_page.reload.protected? }
.from(true)
.to(false)
end
- it 'redirects to the show page' do
+ it "redirects to the show page" do
expect(subject)
- .to redirect_to action: 'show', project_id: project.identifier, id: existing_page.title.downcase
+ .to redirect_to action: "show", project_id: project.identifier, id: existing_page.title.downcase
end
end
- context 'with an existing wiki page but missing permissions' do
+ context "with an existing wiki page but missing permissions" do
let(:permissions) do
%i[view_wiki_pages]
end
- it 'does not change the protected property of the page' do
+ it "does not change the protected property of the page" do
expect { subject }
.not_to change { existing_page.reload.protected? }
end
- it 'return forbidden' do
+ it "return forbidden" do
expect(subject)
.to have_http_status(:forbidden)
end
end
end
- describe 'history' do
+ describe "history" do
let(:permissions) { %i[view_wiki_edits] }
current_user { create(:user, member_with_permissions: { project => permissions }) }
@@ -926,27 +926,27 @@
get :history, params: { project_id: project.identifier, id: existing_page.title }
end
- it 'is successful' do
+ it "is successful" do
expect(response)
.to have_http_status(:ok)
end
- it 'renders the template' do
+ it "renders the template" do
expect(response)
.to render_template :history
end
- it 'assigns versions' do
+ it "assigns versions" do
expect(assigns[:versions])
.to eq existing_page.journals
end
- context 'for a non existing page' do
+ context "for a non existing page" do
before do
- get :history, params: { project_id: project.identifier, id: 'bogus' }
+ get :history, params: { project_id: project.identifier, id: "bogus" }
end
- it 'states not found' do
+ it "states not found" do
expect(response)
.to have_http_status(:not_found)
end
@@ -954,7 +954,7 @@
end
end
- describe 'view related stuff' do
+ describe "view related stuff" do
render_views
shared_let(:project) do
@@ -965,19 +965,19 @@
let!(:page_with_content) do
create(:wiki_page,
wiki_id: project.wiki.id,
- title: 'PagewithContent',
+ title: "PagewithContent",
author_id: admin.id)
end
let!(:page_default) do
create(:wiki_page,
wiki_id: project.wiki.id,
- title: 'Wiki',
+ title: "Wiki",
author_id: admin.id)
end
let!(:unrelated_page) do
create(:wiki_page,
wiki_id: project.wiki.id,
- title: 'UnrelatedPage',
+ title: "UnrelatedPage",
author_id: admin.id)
end
@@ -1002,27 +1002,27 @@
current_user { admin }
- describe '- main menu links' do
+ describe "- main menu links" do
before do
@main_menu_item_for_page_with_content = create(:wiki_menu_item,
navigatable_id: project.wiki.id,
- title: 'Item for Page with Content',
+ title: "Item for Page with Content",
name: page_with_content.slug)
@main_menu_item_for_new_wiki_page = create(:wiki_menu_item,
navigatable_id: project.wiki.id,
- title: 'Item for new WikiPage',
- name: 'new-wiki-page')
+ title: "Item for new WikiPage",
+ name: "new-wiki-page")
@other_menu_item = create(:wiki_menu_item,
navigatable_id: project.wiki.id,
- title: 'Item for other page',
+ title: "Item for other page",
name: unrelated_page.slug)
end
- shared_examples_for 'all wiki menu items' do
- it 'is inactive, when an unrelated page is shown' do
- get 'show', params: { id: unrelated_page.slug, project_id: project.id }
+ shared_examples_for "all wiki menu items" do
+ it "is inactive, when an unrelated page is shown" do
+ get "show", params: { id: unrelated_page.slug, project_id: project.id }
expect(response).to be_successful
@@ -1031,17 +1031,17 @@
end
it "is inactive, when another wiki menu item's page is shown" do
- get 'show', params: { id: @other_wiki_menu_item.name, project_id: project.id }
+ get "show", params: { id: @other_wiki_menu_item.name, project_id: project.id }
expect(response).to be_successful
- expect(response.body).to have_css('.main-menu--children a.selected', count: 0)
+ expect(response.body).to have_css(".main-menu--children a.selected", count: 0)
assert_select "#main-menu a.#{@wiki_menu_item.menu_identifier}-menu-item"
assert_select "#main-menu a.#{@wiki_menu_item.menu_identifier}-menu-item.selected", false
end
- it 'is active, when the given wiki menu item is shown' do
- get 'show', params: { id: @wiki_menu_item.name, project_id: project.id }
+ it "is active, when the given wiki menu item is shown" do
+ get "show", params: { id: @wiki_menu_item.name, project_id: project.id }
expect(response).to be_successful
@@ -1049,130 +1049,130 @@
end
end
- shared_examples_for 'all existing wiki menu items' do
+ shared_examples_for "all existing wiki menu items" do
# TODO: Add tests for new and toc options within menu item
- it 'is active on parents item, when new page is shown' do
- get 'new_child', params: { id: @wiki_menu_item.name, project_id: project.identifier }
+ it "is active on parents item, when new page is shown" do
+ get "new_child", params: { id: @wiki_menu_item.name, project_id: project.identifier }
expect(response).to be_successful
assert_select "#main-menu a.#{@wiki_menu_item.menu_identifier}-menu-item.selected"
end
- it 'is active, when a toc page is shown' do
- get 'index', params: { id: @wiki_menu_item.name, project_id: project.id }
+ it "is active, when a toc page is shown" do
+ get "index", params: { id: @wiki_menu_item.name, project_id: project.id }
expect(response).to be_successful
- assert_select '#content h2', text: 'Table of Contents'
+ assert_select "#content h2", text: "Table of Contents"
assert_select "#main-menu a.#{@wiki_menu_item.menu_identifier}-menu-item.selected"
end
end
- shared_examples_for 'all wiki menu items with child pages' do
- it 'is active, when the given wiki menu item is an ancestor of the shown page' do
- get 'show', params: { id: child_page.slug, project_id: project.id }
+ shared_examples_for "all wiki menu items with child pages" do
+ it "is active, when the given wiki menu item is an ancestor of the shown page" do
+ get "show", params: { id: child_page.slug, project_id: project.id }
expect(response).to be_successful
- expect(response.body).to have_css('#main-menu a.selected', count: 1)
+ expect(response.body).to have_css("#main-menu a.selected", count: 1)
assert_select "#main-menu a.#{@wiki_menu_item.menu_identifier}-menu-item.selected"
end
end
- describe '- wiki menu item pointing to a saved wiki page' do
+ describe "- wiki menu item pointing to a saved wiki page" do
before do
@wiki_menu_item = @main_menu_item_for_page_with_content
@other_wiki_menu_item = @other_menu_item
end
- it_behaves_like 'all wiki menu items'
- it_behaves_like 'all existing wiki menu items'
- it_behaves_like 'all wiki menu items with child pages'
+ it_behaves_like "all wiki menu items"
+ it_behaves_like "all existing wiki menu items"
+ it_behaves_like "all wiki menu items with child pages"
end
- describe '- wiki menu item pointing to a new wiki page' do
+ describe "- wiki menu item pointing to a new wiki page" do
before do
@wiki_menu_item = @main_menu_item_for_new_wiki_page
@other_wiki_menu_item = @other_menu_item
end
- it_behaves_like 'all wiki menu items'
+ it_behaves_like "all wiki menu items"
end
- describe '- wiki_menu_item containing special chars only' do
+ describe "- wiki_menu_item containing special chars only" do
before do
@wiki_menu_item = create(:wiki_menu_item,
navigatable_id: project.wiki.id,
- title: '?',
- name: 'help')
+ title: "?",
+ name: "help")
@other_wiki_menu_item = @other_menu_item
end
- it_behaves_like 'all wiki menu items'
+ it_behaves_like "all wiki menu items"
end
end
- describe '- wiki sidebar' do
- describe 'configure menu items link' do
- describe 'on a show page' do
- describe 'being authorized to configure menu items' do
- it 'is visible' do
- get 'show', params: { project_id: project.id }
+ describe "- wiki sidebar" do
+ describe "configure menu items link" do
+ describe "on a show page" do
+ describe "being authorized to configure menu items" do
+ it "is visible" do
+ get "show", params: { project_id: project.id }
expect(response).to be_successful
- assert_select '#content a', 'Configure menu item'
+ assert_select "#content a", "Configure menu item"
end
end
- describe 'being unauthorized to configure menu items' do
+ describe "being unauthorized to configure menu items" do
before do
allow(User).to receive(:current).and_return @anon
end
- it 'is invisible' do
- get 'show', params: { project_id: project.id }
+ it "is invisible" do
+ get "show", params: { project_id: project.id }
expect(response).to be_successful
- assert_select '#content a', text: 'Configure menu item', count: 0
+ assert_select "#content a", text: "Configure menu item", count: 0
end
end
end
end
- describe 'new child page link' do
- describe 'on an index page' do
- describe 'being authorized to edit wiki pages' do
- it 'is invisible' do
- get 'index', params: { project_id: project.id }
+ describe "new child page link" do
+ describe "on an index page" do
+ describe "being authorized to edit wiki pages" do
+ it "is invisible" do
+ get "index", params: { project_id: project.id }
expect(response).to be_successful
- assert_select '#content a', text: 'Wiki page', count: 0
+ assert_select "#content a", text: "Wiki page", count: 0
end
end
- describe 'being unauthorized to edit wiki pages' do
+ describe "being unauthorized to edit wiki pages" do
before do
allow(User).to receive(:current).and_return @anon
end
- it 'is invisible' do
- get 'index', params: { project_id: project.id }
+ it "is invisible" do
+ get "index", params: { project_id: project.id }
expect(response).to be_successful
- assert_select '#content a', text: 'Wiki page', count: 0
+ assert_select "#content a", text: "Wiki page", count: 0
end
end
end
- describe 'on a wiki page' do
- describe 'being authorized to edit wiki pages' do
- describe 'with a wiki page present' do
- it 'is visible' do
- get 'show',
+ describe "on a wiki page" do
+ describe "being authorized to edit wiki pages" do
+ describe "with a wiki page present" do
+ it "is visible" do
+ get "show",
params: { id: page_with_content.title, project_id: project.identifier }
expect(response).to be_successful
@@ -1182,62 +1182,62 @@
path = new_child_project_wiki_path(project_id: project, id: page_with_content.slug)
- assert_select "#content a[href='#{path}']", 'Wiki page'
+ assert_select "#content a[href='#{path}']", "Wiki page"
end
end
- describe 'with no wiki page present' do
- it 'is invisible' do
- get 'show', params: { id: 'i-am-a-ghostpage', project_id: project.identifier }
+ describe "with no wiki page present" do
+ it "is invisible" do
+ get "show", params: { id: "i-am-a-ghostpage", project_id: project.identifier }
expect(response).to be_successful
assert_select "#content a[href='#{new_child_project_wiki_path(project_id: project, id: 'i-am-a-ghostpage')}']",
- text: 'Wiki page', count: 0
+ text: "Wiki page", count: 0
end
end
end
- describe 'being unauthorized to edit wiki pages' do
+ describe "being unauthorized to edit wiki pages" do
before do
allow(User).to receive(:current).and_return @anon
end
- it 'is invisible' do
- get 'show', params: { id: page_with_content.title, project_id: project.identifier }
+ it "is invisible" do
+ get "show", params: { id: page_with_content.title, project_id: project.identifier }
expect(response).to be_successful
- assert_select '#content a', text: 'Wiki page', count: 0
+ assert_select "#content a", text: "Wiki page", count: 0
end
end
end
end
- describe 'new page link' do
- describe 'on a show page' do
- describe 'being authorized to edit wiki pages' do
- it 'is visible' do
- get 'show', params: { project_id: project.id }
+ describe "new page link" do
+ describe "on a show page" do
+ describe "being authorized to edit wiki pages" do
+ it "is visible" do
+ get "show", params: { project_id: project.id }
expect(response).to be_successful
assert_select ".toolbar-items a[href='#{new_child_project_wiki_path(project_id: project, id: 'wiki')}']",
- 'Wiki page'
+ "Wiki page"
end
end
- describe 'being unauthorized to edit wiki pages' do
+ describe "being unauthorized to edit wiki pages" do
before do
allow(User).to receive(:current).and_return @anon
end
- it 'is invisible' do
- get 'show', params: { project_id: project.id }
+ it "is invisible" do
+ get "show", params: { project_id: project.id }
expect(response).to be_successful
- assert_select '.toolbar-items a', text: 'Wiki page', count: 0
+ assert_select ".toolbar-items a", text: "Wiki page", count: 0
end
end
end
diff --git a/spec/controllers/wiki_menu_authentication_spec.rb b/spec/controllers/wiki_menu_authentication_spec.rb
index 5d33ff2a7ef9..f67dc5b33bcc 100644
--- a/spec/controllers/wiki_menu_authentication_spec.rb
+++ b/spec/controllers/wiki_menu_authentication_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe WikiMenuItemsController do
before do
@@ -42,25 +42,25 @@
@params[:id] = page.title
end
- describe 'w/ valid auth' do
- it 'renders the edit action' do
+ describe "w/ valid auth" do
+ it "renders the edit action" do
admin_user = create(:admin)
allow(User).to receive(:current).and_return admin_user
- permission_role = create(:project_role, name: 'accessgranted', permissions: [:manage_wiki_menu])
+ permission_role = create(:project_role, name: "accessgranted", permissions: [:manage_wiki_menu])
member = create(:member, principal: admin_user, user: admin_user, project: @project, roles: [permission_role])
- get 'edit', params: @params
+ get "edit", params: @params
expect(response).to be_successful
end
end
- describe 'w/o valid auth' do
- it 'be forbidden' do
+ describe "w/o valid auth" do
+ it "be forbidden" do
allow(User).to receive(:current).and_return create(:user)
- get 'edit', params: @params
+ get "edit", params: @params
expect(response.status).to eq(403) # forbidden
end
diff --git a/spec/controllers/wiki_menu_items_controller_spec.rb b/spec/controllers/wiki_menu_items_controller_spec.rb
index 9ebf004b18fb..507185359dbe 100644
--- a/spec/controllers/wiki_menu_items_controller_spec.rb
+++ b/spec/controllers/wiki_menu_items_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe WikiMenuItemsController do
let(:current_user) { create(:admin) }
@@ -45,7 +45,7 @@
allow(User).to receive(:current).and_return current_user
end
- describe '#edit' do
+ describe "#edit" do
# more wiki pages with menu items
let(:another_wiki_page) { create(:wiki_page, wiki:) } # second wiki page with two child pages
let!(:another_wiki_page_top_level_wiki_menu_item) do
@@ -63,19 +63,19 @@
let(:grand_child_page) { create(:wiki_page, parent: child_page, wiki:) }
let!(:grand_child_page_wiki_menu_item) { create(:wiki_menu_item, wiki:, name: grand_child_page.slug) }
- context 'when no parent wiki menu item has been configured yet' do
- context 'and it is a child page' do
+ context "when no parent wiki menu item has been configured yet" do
+ context "and it is a child page" do
before { get :edit, params: { project_id: project.id, id: child_page.slug } }
subject { response }
- it 'preselects the wiki menu item of the parent page as parent wiki menu item option' do
- expect(assigns['selected_parent_menu_item_id']).to eq(another_wiki_page_top_level_wiki_menu_item.id)
+ it "preselects the wiki menu item of the parent page as parent wiki menu item option" do
+ expect(assigns["selected_parent_menu_item_id"]).to eq(another_wiki_page_top_level_wiki_menu_item.id)
# see FIXME in menu_helper.rb
end
end
- context 'and it is a grand child page the parent of which is not a main item' do
+ context "and it is a grand child page the parent of which is not a main item" do
before do
# ensure the parent page of grand_child_page is not a main item
child_page_wiki_menu_item.tap { |page| page.parent = top_level_wiki_menu_item }.save
@@ -84,38 +84,38 @@
subject { response }
- it 'preselects the wiki menu item of the grand parent page as parent wiki menu item option' do
- expect(assigns['selected_parent_menu_item_id']).to eq(another_wiki_page_top_level_wiki_menu_item.id)
+ it "preselects the wiki menu item of the grand parent page as parent wiki menu item option" do
+ expect(assigns["selected_parent_menu_item_id"]).to eq(another_wiki_page_top_level_wiki_menu_item.id)
end
end
end
- context 'when a parent wiki menu item has already been configured' do
+ context "when a parent wiki menu item has already been configured" do
before { get :edit, params: { project_id: project.id, id: another_child_page.slug } }
subject { response }
- it 'preselects the parent wiki menu item that is already assigned' do
- expect(assigns['selected_parent_menu_item_id']).to eq(top_level_wiki_menu_item.id)
+ it "preselects the parent wiki menu item that is already assigned" do
+ expect(assigns["selected_parent_menu_item_id"]).to eq(top_level_wiki_menu_item.id)
end
end
end
- shared_context 'when there is one more wiki page with a child page' do
+ shared_context "when there is one more wiki page with a child page" do
let!(:child_page) { create(:wiki_page, parent: wiki_page, wiki:) }
let!(:another_wiki_page) { create(:wiki_page, wiki:) } # second wiki page with two child pages
let!(:another_child_page) { create(:wiki_page, parent: another_wiki_page, wiki:) }
end
- describe '#select_main_menu_item' do
- include_context 'when there is one more wiki page with a child page'
+ describe "#select_main_menu_item" do
+ include_context "when there is one more wiki page with a child page"
before { get :select_main_menu_item, params: { project_id: project, id: wiki_page.id } }
- subject { assigns['possible_wiki_pages'] }
+ subject { assigns["possible_wiki_pages"] }
- context 'when selecting a new wiki page to replace the current main menu item' do
+ context "when selecting a new wiki page to replace the current main menu item" do
it { is_expected.to include wiki_page }
it { is_expected.to include child_page }
it { is_expected.to include another_wiki_page }
@@ -123,10 +123,10 @@
end
end
- describe '#replace_main_menu_item' do
- include_context 'when there is one more wiki page with a child page'
+ describe "#replace_main_menu_item" do
+ include_context "when there is one more wiki page with a child page"
- context 'when another wiki page is selected for replacement' do
+ context "when another wiki page is selected for replacement" do
let(:selected_page) { child_page }
let(:new_menu_item) { selected_page.menu_item }
@@ -139,21 +139,21 @@
}
end
- it 'destroys the current wiki menu item' do
+ it "destroys the current wiki menu item" do
expect(wiki_page.menu_item).to be_nil
end
- it 'creates a new main menu item for the selected wiki page' do
+ it "creates a new main menu item for the selected wiki page" do
expect(selected_page.menu_item).to be_present
expect(selected_page.menu_item.parent).to be_nil
end
- it 'transfers the menu item options to the selected wiki page' do
+ it "transfers the menu item options to the selected wiki page" do
expect(new_menu_item.options).to eq(index_page: true, new_wiki_page: true)
end
end
- context 'when its own wiki page is selected for replacement' do
+ context "when its own wiki page is selected for replacement" do
let!(:wiki_menu_item) { wiki_page.menu_item }
before do
@@ -165,7 +165,7 @@
}
end
- it 'does not destroy the wiki menu item' do
+ it "does not destroy the wiki menu item" do
expect(wiki_menu_item.reload).to be_present
end
end
diff --git a/spec/controllers/work_packages/auto_completes_controller_spec.rb b/spec/controllers/work_packages/auto_completes_controller_spec.rb
index 4d6c2b0037ce..e1eafd6ab8c2 100644
--- a/spec/controllers/work_packages/auto_completes_controller_spec.rb
+++ b/spec/controllers/work_packages/auto_completes_controller_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe WorkPackages::AutoCompletesController do
let(:user) { create(:user) }
@@ -49,13 +49,13 @@
let(:work_package_2) do
create(:work_package,
- subject: 'Error when updating a recipe',
+ subject: "Error when updating a recipe",
project:)
end
let(:work_package_3) do
create(:work_package,
- subject: 'Lorem ipsum',
+ subject: "Lorem ipsum",
project:)
end
@@ -69,37 +69,37 @@
work_package_3
end
- shared_examples_for 'successful response' do
+ shared_examples_for "successful response" do
subject { response }
it { is_expected.to be_successful }
end
- shared_examples_for 'contains expected values' do
+ shared_examples_for "contains expected values" do
subject { assigns(:work_packages) }
it { is_expected.to include(*expected_values) }
end
- describe '#work_packages' do
- describe 'search is case insensitive' do
+ describe "#work_packages" do
+ describe "search is case insensitive" do
let(:expected_values) { [work_package_1, work_package_2] }
before do
get :index,
params: {
project_id: project.id,
- q: 'ReCiPe'
+ q: "ReCiPe"
},
format: :json
end
- it_behaves_like 'successful response'
+ it_behaves_like "successful response"
- it_behaves_like 'contains expected values'
+ it_behaves_like "contains expected values"
end
- describe 'returns work package for given id' do
+ describe "returns work package for given id" do
let(:expected_values) { work_package_1 }
before do
@@ -111,12 +111,12 @@
format: :json
end
- it_behaves_like 'successful response'
+ it_behaves_like "successful response"
- it_behaves_like 'contains expected values'
+ it_behaves_like "contains expected values"
end
- describe 'returns work package for given id' do
+ describe "returns work package for given id" do
# this relies on all expected work packages to have ids that contain the given string
# we do not want to have work_package_3 so we take it's id + 1 to create a string
# we are sure to not be part of work_package_3's id.
@@ -156,11 +156,11 @@
format: :json
end
- it_behaves_like 'successful response'
+ it_behaves_like "successful response"
- it_behaves_like 'contains expected values'
+ it_behaves_like "contains expected values"
- context 'uniq' do
+ context "uniq" do
let(:assigned) { assigns(:work_packages) }
subject { assigned.size }
@@ -169,7 +169,7 @@
end
end
- describe 'returns work package for given id' do
+ describe "returns work package for given id" do
render_views
let(:work_package_4) do
create(:work_package,
@@ -187,15 +187,15 @@
format: :json
end
- it_behaves_like 'successful response'
- it_behaves_like 'contains expected values'
+ it_behaves_like "successful response"
+ it_behaves_like "contains expected values"
- it 'escapes html' do
- expect(response.body).not_to include ''
]
end
@@ -87,25 +87,25 @@
visit project_wiki_path(project, :wiki)
# Set value
- find('.ck-content').base.send_keys(wiki_body)
- click_button 'Save'
+ find(".ck-content").base.send_keys(wiki_body)
+ click_button "Save"
- expect(page).to have_css('.title-container h2', text: 'Wiki')
- expect(page).to have_css('a.wiki-page', count: 5)
+ expect(page).to have_css(".title-container h2", text: "Wiki")
+ expect(page).to have_css("a.wiki-page", count: 5)
end
- it 'shows renders correct links' do
+ it "shows renders correct links" do
expected_titles.each_with_index do |title, i|
visit project_wiki_path(project, :wiki)
- expect(page).to have_css('div.wiki-content')
- target_link = all('div.wiki-content a.wiki-page')[i]
+ expect(page).to have_css("div.wiki-content")
+ target_link = all("div.wiki-content a.wiki-page")[i]
expect(target_link.text).to eq(title)
expect(target_link[:href]).to match("/wiki/#{expected_slugs[i]}")
target_link.click
- expect(page).to have_css('.title-container h2', text: title)
+ expect(page).to have_css(".title-container h2", text: title)
end
end
end
diff --git a/spec/features/work_package_show_spec.rb b/spec/features/work_package_show_spec.rb
index 88336e5d2545..c6bfa27491f5 100644
--- a/spec/features/work_package_show_spec.rb
+++ b/spec/features/work_package_show_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package show page', :selenium do
+RSpec.describe "Work package show page", :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_package) do
@@ -43,7 +43,7 @@
work_package.save!
end
- it 'all different angular based work package views', :js do
+ it "all different angular based work package views", :js do
wp_page = Pages::FullWorkPackage.new(work_package)
wp_page.visit!
diff --git a/spec/features/work_packages/attribute_help_texts_spec.rb b/spec/features/work_packages/attribute_help_texts_spec.rb
index 383cdb20719a..253082a3dad3 100644
--- a/spec/features/work_packages/attribute_help_texts_spec.rb
+++ b/spec/features/work_packages/attribute_help_texts_spec.rb
@@ -26,16 +26,16 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package attribute help texts', :js do
+RSpec.describe "Work package attribute help texts", :js do
let(:project) { create(:project) }
let(:work_package) { create(:work_package, project:) }
let(:instance) do
create(:work_package_help_text,
attribute_name: :status,
- help_text: 'Some **help text** for status.')
+ help_text: "Some **help text** for status.")
end
let(:modal) { Components::AttributeHelpTextModal.new(instance) }
@@ -50,30 +50,30 @@
wp_page.ensure_page_loaded
end
- shared_examples 'allows to view help texts' do
- it 'shows an indicator for whatever help text exists' do
+ shared_examples "allows to view help texts" do
+ it "shows an indicator for whatever help text exists" do
expect(page).to have_css('.work-package--single-view [data-qa-help-text-for="status"]')
# Open help text modal
modal.open!
- expect(modal.modal_container).to have_css('strong', text: 'help text')
+ expect(modal.modal_container).to have_css("strong", text: "help text")
modal.expect_edit(editable: user.allowed_globally?(:edit_attribute_help_texts))
modal.close!
end
end
- describe 'as admin' do
+ describe "as admin" do
let(:user) { create(:admin) }
- it_behaves_like 'allows to view help texts'
+ it_behaves_like "allows to view help texts"
end
- describe 'as regular user' do
+ describe "as regular user" do
let(:user) do
create(:user, member_with_permissions: { project => [:view_work_packages] })
end
- it_behaves_like 'allows to view help texts'
+ it_behaves_like "allows to view help texts"
end
end
diff --git a/spec/features/work_packages/bulk/copy_work_package_spec.rb b/spec/features/work_packages/bulk/copy_work_package_spec.rb
index 668fe743005e..d9ffe06b2f4c 100644
--- a/spec/features/work_packages/bulk/copy_work_package_spec.rb
+++ b/spec/features/work_packages/bulk/copy_work_package_spec.rb
@@ -1,26 +1,26 @@
-require 'spec_helper'
-require 'features/page_objects/notification'
-require 'support/components/autocompleter/ng_select_autocomplete_helpers'
+require "spec_helper"
+require "features/page_objects/notification"
+require "support/components/autocompleter/ng_select_autocomplete_helpers"
-RSpec.describe 'Copy work packages through Rails view', :js, :with_cuprite do
+RSpec.describe "Copy work packages through Rails view", :js, :with_cuprite do
include Components::Autocompleter::NgSelectAutocompleteHelpers
- shared_let(:type) { create(:type, name: 'Bug') }
- shared_let(:type2) { create(:type, name: 'Risk') }
+ shared_let(:type) { create(:type, name: "Bug") }
+ shared_let(:type2) { create(:type, name: "Risk") }
- shared_let(:project) { create(:project, name: 'Source', types: [type, type2]) }
- shared_let(:project2) { create(:project, name: 'Target', types: [type, type2]) }
+ shared_let(:project) { create(:project, name: "Source", types: [type, type2]) }
+ shared_let(:project2) { create(:project, name: "Target", types: [type, type2]) }
shared_let(:dev) do
create(:user,
- firstname: 'Dev',
- lastname: 'Guy',
+ firstname: "Dev",
+ lastname: "Guy",
member_with_permissions: { project => %i[view_work_packages work_package_assigned] })
end
shared_let(:mover) do
create(:user,
- firstname: 'Manager',
- lastname: 'Guy',
+ firstname: "Manager",
+ lastname: "Guy",
member_with_permissions: {
project => %i[view_work_packages copy_work_packages move_work_packages manage_subtasks assign_versions
add_work_packages],
@@ -54,42 +54,42 @@
wp_table.expect_work_package_listed work_package, work_package2
end
- describe 'copying work packages' do
+ describe "copying work packages" do
before do
# Select all work packages
- find('body').send_keys [:control, 'a']
+ find("body").send_keys [:control, "a"]
end
- context 'with permission' do
+ context "with permission" do
let(:current_user) { mover }
let(:wp_table_target) { Pages::WorkPackagesTable.new(project2) }
before do
wp_table.expect_work_package_count 2
context_menu.open_for work_package
- context_menu.choose 'Bulk copy'
+ context_menu.choose "Bulk copy"
- expect(page).to have_css('#new_project_id') # rubocop:disable RSpec/ExpectInHook
+ expect(page).to have_css("#new_project_id") # rubocop:disable RSpec/ExpectInHook
wait_for_network_idle
expect_page_reload do
- select_autocomplete page.find_test_selector('new_project_id'),
+ select_autocomplete page.find_test_selector("new_project_id"),
query: project2.name,
select_text: project2.name,
- results_selector: 'body'
+ results_selector: "body"
end
wait_for_network_idle # wait for the change of target project to finish updating the page
end
- it 'sets the version on copy and leaves a note' do
- select version.name, from: 'version_id'
- notes.set_markdown 'A note on copy'
- click_on 'Copy and follow'
+ it "sets the version on copy and leaves a note" do
+ select version.name, from: "version_id"
+ notes.set_markdown "A note on copy"
+ click_on "Copy and follow"
wp_table_target.expect_current_path
wp_table_target.expect_work_package_count 2
- expect(page).to have_css('#projects-menu', text: 'Target')
+ expect(page).to have_css("#projects-menu", text: "Target")
# Should not move the sources
work_package2.reload
@@ -99,17 +99,17 @@
copied_wps = WorkPackage.last(2)
expect(copied_wps.map(&:project_id).uniq).to eq([project2.id])
expect(copied_wps.map(&:version_id).uniq).to eq([version.id])
- expect(copied_wps.map { |wp| wp.journals.last.notes }.uniq).to eq(['A note on copy'])
+ expect(copied_wps.map { |wp| wp.journals.last.notes }.uniq).to eq(["A note on copy"])
end
- context 'when the limit to move in the frontend is 1',
+ context "when the limit to move in the frontend is 1",
with_settings: { work_packages_bulk_request_limit: 1 } do
- it 'copies them in the background and shows a status page' do
- select version.name, from: 'version_id'
- notes.set_markdown 'A note on copy'
- click_on 'Copy and follow'
+ it "copies them in the background and shows a status page" do
+ select version.name, from: "version_id"
+ notes.set_markdown "A note on copy"
+ click_on "Copy and follow"
- expect(page).to have_text 'The job has been queued and will be processed shortly.'
+ expect(page).to have_text "The job has been queued and will be processed shortly."
perform_enqueued_jobs
@@ -118,7 +118,7 @@
end
end
- context 'with a work package having a child' do
+ context "with a work package having a child" do
let!(:child) do
create(:work_package,
author: dev,
@@ -138,26 +138,26 @@
wp_table.visit!
expect_angular_frontend_initialized
wp_table.expect_work_package_listed work_package, work_package2, child
- find('body').send_keys [:control, 'a']
+ find("body").send_keys [:control, "a"]
wp_table.expect_work_package_count 3
context_menu.open_for work_package
- context_menu.choose 'Bulk copy'
+ context_menu.choose "Bulk copy"
- expect(page).to have_css('#new_project_id') # rubocop:disable RSpec/ExpectInHook
+ expect(page).to have_css("#new_project_id") # rubocop:disable RSpec/ExpectInHook
expect_page_reload do
- select_autocomplete page.find_test_selector('new_project_id'),
+ select_autocomplete page.find_test_selector("new_project_id"),
query: project2.name,
select_text: project2.name,
- results_selector: 'body'
+ results_selector: "body"
end
sleep(1) # wait for the change of target project to finish updating the page
end
- it 'copies WPs with parent/child hierarchy and relations maintained' do
- click_on 'Copy and follow'
+ it "copies WPs with parent/child hierarchy and relations maintained" do
+ click_on "Copy and follow"
wp_table_target.expect_current_path
- expect(page).to have_css('#projects-menu', text: 'Target')
+ expect(page).to have_css("#projects-menu", text: "Target")
# Should not move the sources
expect(work_package.reload.project_id).to eq(project.id)
@@ -185,7 +185,7 @@
end
end
- context 'when the target project does not have the type' do
+ context "when the target project does not have the type" do
let!(:child) do
create(:work_package,
author: dev,
@@ -198,55 +198,55 @@
project2.types = [type2]
end
- it 'fails, informing of the reasons' do
- click_on 'Copy and follow'
+ it "fails, informing of the reasons" do
+ click_on "Copy and follow"
expect(page)
.to have_css(
- '.op-toast.-error',
- text: I18n.t('work_packages.bulk.none_could_be_saved', total: 3)
+ ".op-toast.-error",
+ text: I18n.t("work_packages.bulk.none_could_be_saved", total: 3)
)
expect(page)
.to have_css(
- '.op-toast.-error',
- text: I18n.t('work_packages.bulk.selected_because_descendants', total: 3, selected: 2)
+ ".op-toast.-error",
+ text: I18n.t("work_packages.bulk.selected_because_descendants", total: 3, selected: 2)
)
expect(page)
.to have_css(
- '.op-toast.-error',
+ ".op-toast.-error",
text: "#{work_package.id}: Type #{I18n.t('activerecord.errors.messages.inclusion')}"
)
expect(page)
.to have_css(
- '.op-toast.-error',
+ ".op-toast.-error",
text: "#{work_package2.id}: Type #{I18n.t('activerecord.errors.messages.inclusion')}"
)
expect(page)
.to have_css(
- '.op-toast.-error',
+ ".op-toast.-error",
text: "#{child.id} (descendant of selected): Type #{I18n.t('activerecord.errors.messages.inclusion')}"
)
end
- context 'when the limit to move in the frontend is 0',
+ context "when the limit to move in the frontend is 0",
with_settings: { work_packages_bulk_request_limit: 0 } do
- it 'shows the errors properly in the frontend' do
- click_on 'Copy and follow'
+ it "shows the errors properly in the frontend" do
+ click_on "Copy and follow"
- expect(page).to have_text 'The job has been queued and will be processed shortly.'
+ expect(page).to have_text "The job has been queued and will be processed shortly."
perform_enqueued_jobs
- expect(page).to have_text 'The work packages could not be copied.', wait: 10
+ expect(page).to have_text "The work packages could not be copied.", wait: 10
- expect(page).to have_text I18n.t('work_packages.bulk.none_could_be_saved', total: 3)
+ expect(page).to have_text I18n.t("work_packages.bulk.none_could_be_saved", total: 3)
expect(page)
- .to have_text I18n.t('work_packages.bulk.selected_because_descendants', total: 3, selected: 2)
+ .to have_text I18n.t("work_packages.bulk.selected_because_descendants", total: 3, selected: 2)
expect(page)
.to have_text "#{work_package.id}: Type #{I18n.t('activerecord.errors.messages.inclusion')}"
@@ -261,27 +261,27 @@
end
end
- context 'without permission' do
+ context "without permission" do
let(:current_user) { dev }
- it 'does not allow to copy' do
+ it "does not allow to copy" do
context_menu.open_for work_package
- context_menu.expect_no_options 'Bulk copy'
+ context_menu.expect_no_options "Bulk copy"
end
end
end
- describe 'copying work package to clipboard' do
+ describe "copying work package to clipboard" do
let(:current_user) { dev }
let(:wp_table_target) { Pages::WorkPackagesTable.new(project2) }
before do
wp_table.expect_work_package_count 2
context_menu.open_for work_package
- context_menu.choose 'Copy link to clipboard'
+ context_menu.choose "Copy link to clipboard"
end
- it 'successfully copies the short url of the work package' do
+ it "successfully copies the short url of the work package" do
# We cannot access the navigator.clipboard from a headless browser.
# This test makes sure the copy to clipboard logic is working,
# regardless of the browser permissions.
@@ -289,7 +289,7 @@
end
end
- describe 'unsetting the assignee as the current assignee is not a member in the project' do
+ describe "unsetting the assignee as the current assignee is not a member in the project" do
let(:work_packages) { [work_package] }
let(:current_user) { mover }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -299,30 +299,30 @@
work_package.save
end
- it 'copies the work package' do
+ it "copies the work package" do
context_menu.open_for work_package
- context_menu.choose 'Copy to other project'
+ context_menu.choose "Copy to other project"
# On work packages move page
expect_page_reload do
- select_autocomplete page.find_test_selector('new_project_id'),
+ select_autocomplete page.find_test_selector("new_project_id"),
query: project2.name,
select_text: project2.name,
- results_selector: 'body'
+ results_selector: "body"
end
wait_for_network_idle # wait for page reload after selecting the target project
- select 'nobody', from: 'Assignee'
+ select "nobody", from: "Assignee"
- click_on 'Copy and follow'
+ click_on "Copy and follow"
expect(page)
- .to have_css('.op-toast.-success',
+ .to have_css(".op-toast.-success",
text: I18n.t(:notice_successful_create))
wp_page = Pages::FullWorkPackage.new(WorkPackage.last)
- wp_page.expect_attributes assignee: '-'
+ wp_page.expect_attributes assignee: "-"
end
end
end
diff --git a/spec/features/work_packages/bulk/move_work_package_spec.rb b/spec/features/work_packages/bulk/move_work_package_spec.rb
index 21dd70e0ccf2..43f3b35bf9d8 100644
--- a/spec/features/work_packages/bulk/move_work_package_spec.rb
+++ b/spec/features/work_packages/bulk/move_work_package_spec.rb
@@ -1,8 +1,8 @@
-require 'spec_helper'
-require 'features/page_objects/notification'
-require 'support/components/autocompleter/ng_select_autocomplete_helpers'
+require "spec_helper"
+require "features/page_objects/notification"
+require "support/components/autocompleter/ng_select_autocomplete_helpers"
-RSpec.describe 'Moving a work package through Rails view', :js do
+RSpec.describe "Moving a work package through Rails view", :js do
include Components::Autocompleter::NgSelectAutocompleteHelpers
let(:dev_role) do
@@ -15,22 +15,22 @@
end
let(:dev) do
create(:user,
- firstname: 'Dev',
- lastname: 'Guy',
+ firstname: "Dev",
+ lastname: "Guy",
member_with_roles: { project => dev_role })
end
let(:mover) do
create(:admin,
- firstname: 'Manager',
- lastname: 'Guy',
+ firstname: "Manager",
+ lastname: "Guy",
member_with_roles: { project => mover_role })
end
- let(:type) { create(:type, name: 'Bug') }
- let(:type2) { create(:type, name: 'Risk') }
+ let(:type) { create(:type, name: "Bug") }
+ let(:type2) { create(:type, name: "Risk") }
- let!(:project) { create(:project, name: 'Source', types: [type, type2]) }
- let!(:project2) { create(:project, name: 'Target', types: [type, type2]) }
+ let!(:project) { create(:project, name: "Source", types: [type, type2]) }
+ let!(:project2) { create(:project, name: "Target", types: [type, type2]) }
let(:work_package) do
create(:work_package,
@@ -62,7 +62,7 @@
expect_angular_frontend_initialized
end
- describe 'moving a work package and its children' do
+ describe "moving a work package and its children" do
let(:work_packages) { [work_package, child_wp] }
let(:child_wp) do
create(:work_package,
@@ -73,19 +73,19 @@
status:)
end
- context 'with permission' do
+ context "with permission" do
before do
expect(child_wp.project_id).to eq(project.id)
context_menu.open_for work_package
- context_menu.choose 'Change project'
+ context_menu.choose "Change project"
# On work packages move page
- expect(page).to have_css('#new_project_id')
- select_autocomplete page.find_test_selector('new_project_id'),
- query: 'Target',
- select_text: 'Target',
- results_selector: 'body'
+ expect(page).to have_css("#new_project_id")
+ select_autocomplete page.find_test_selector("new_project_id"),
+ query: "Target",
+ select_text: "Target",
+ results_selector: "body"
if using_cuprite?
wait_for_network_idle
else
@@ -93,14 +93,14 @@
end
end
- context 'when the limit to move in the frontend is 1',
+ context "when the limit to move in the frontend is 1",
with_settings: { work_packages_bulk_request_limit: 1 } do
- it 'copies them in the background and shows a status page', :with_cuprite do
- click_on 'Move and follow'
+ it "copies them in the background and shows a status page", :with_cuprite do
+ click_on "Move and follow"
wait_for_reload
- page.find_test_selector('job-status--header')
+ page.find_test_selector("job-status--header")
- expect(page).to have_text 'The job has been queued and will be processed shortly.'
+ expect(page).to have_text "The job has been queued and will be processed shortly."
perform_enqueued_jobs
@@ -108,29 +108,29 @@
expect(work_package.project_id).to eq(project2.id)
expect(page).to have_current_path "/projects/#{project2.identifier}/work_packages/#{work_package.id}/activity"
- page.find_by_id('projects-menu', text: 'Target')
+ page.find_by_id("projects-menu", text: "Target")
end
end
- it 'moves parent and child wp to a new project', :with_cuprite do
- click_on 'Move and follow'
+ it "moves parent and child wp to a new project", :with_cuprite do
+ click_on "Move and follow"
wait_for_reload
- page.find('.inline-edit--container.subject', text: work_package.subject)
- page.find_by_id('projects-menu', text: 'Target')
+ page.find(".inline-edit--container.subject", text: work_package.subject)
+ page.find_by_id("projects-menu", text: "Target")
# Should move its children
child_wp.reload
expect(child_wp.project_id).to eq(project2.id)
end
- context 'when the target project does not have the type' do
- let!(:project2) { create(:project, name: 'Target', types: [type2]) }
+ context "when the target project does not have the type" do
+ let!(:project2) { create(:project, name: "Target", types: [type2]) }
- it 'does moves the work package and changes the type', :with_cuprite do
- click_on 'Move and follow'
+ it "does moves the work package and changes the type", :with_cuprite do
+ click_on "Move and follow"
wait_for_reload
- page.find('.inline-edit--container.subject', text: work_package.subject)
- page.find_by_id('projects-menu', text: 'Target')
+ page.find(".inline-edit--container.subject", text: work_package.subject)
+ page.find_by_id("projects-menu", text: "Target")
# Should NOT have moved
child_wp.reload
@@ -142,24 +142,24 @@
end
end
- context 'when the target project has a type with a required field' do
+ context "when the target project has a type with a required field" do
let(:required_cf) { create(:integer_wp_custom_field, is_required: true) }
- let(:type2) { create(:type, name: 'Risk', custom_fields: [required_cf]) }
- let!(:project2) { create(:project, name: 'Target', types: [type2], work_package_custom_fields: [required_cf]) }
+ let(:type2) { create(:type, name: "Risk", custom_fields: [required_cf]) }
+ let!(:project2) { create(:project, name: "Target", types: [type2], work_package_custom_fields: [required_cf]) }
- it 'does not moves the work package when the required field is missing' do
+ it "does not moves the work package when the required field is missing" do
select "Risk", from: "Type"
expect(page).to have_field(required_cf.name)
# Clicking move and follow might be broken due to the location.href
# in the refresh-on-form-changes component
retry_block do
- click_on 'Move and follow'
+ click_on "Move and follow"
end
expect(page)
- .to have_css('.op-toast.-error',
- text: I18n.t(:'work_packages.bulk.none_could_be_saved',
+ .to have_css(".op-toast.-error",
+ text: I18n.t(:"work_packages.bulk.none_could_be_saved",
total: 1))
child_wp.reload
work_package.reload
@@ -169,17 +169,17 @@
expect(child_wp.type_id).to eq(type.id)
end
- it 'does moves the work package when the required field is set' do
+ it "does moves the work package when the required field is set" do
select "Risk", from: "Type"
- fill_in required_cf.name, with: '1'
+ fill_in required_cf.name, with: "1"
# Clicking move and follow might be broken due to the location.href
# in the refresh-on-form-changes component
retry_block do
- click_on 'Move and follow'
+ click_on "Move and follow"
end
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
child_wp.reload
work_package.reload
@@ -191,51 +191,51 @@
end
end
- context 'without permission' do
+ context "without permission" do
let(:current_user) { dev }
- it 'does not allow to move' do
+ it "does not allow to move" do
context_menu.open_for work_package
- context_menu.expect_no_options 'Change project'
+ context_menu.expect_no_options "Change project"
end
end
end
- describe 'moving an unmovable (e.g. readonly status) and a movable work package', with_ee: %i[readonly_work_packages] do
+ describe "moving an unmovable (e.g. readonly status) and a movable work package", with_ee: %i[readonly_work_packages] do
let(:work_packages) { [work_package, work_package2] }
let(:work_package2_status) { create(:status, is_readonly: true) }
before do
loading_indicator_saveguard
# Select all work packages
- find('body').send_keys [:control, 'a']
+ find("body").send_keys [:control, "a"]
context_menu.open_for work_package2
- context_menu.choose 'Bulk change of project'
+ context_menu.choose "Bulk change of project"
# On work packages move page
- select_autocomplete page.find_test_selector('new_project_id'),
+ select_autocomplete page.find_test_selector("new_project_id"),
query: project2.name,
select_text: project2.name,
- results_selector: 'body'
- click_on 'Move and follow'
+ results_selector: "body"
+ click_on "Move and follow"
end
- it 'displays an error message explaining which work package could not be moved and why' do
+ it "displays an error message explaining which work package could not be moved and why" do
expect(page)
- .to have_css('.op-toast.-error',
- text: I18n.t('work_packages.bulk.could_not_be_saved'),
+ .to have_css(".op-toast.-error",
+ text: I18n.t("work_packages.bulk.could_not_be_saved"),
wait: 10)
expect(page)
.to have_css(
- '.op-toast.-error',
+ ".op-toast.-error",
text: "#{work_package2.id}: Project #{I18n.t('activerecord.errors.messages.error_readonly')}"
)
expect(page)
- .to have_css('.op-toast.-error',
- text: I18n.t('work_packages.bulk.x_out_of_y_could_be_saved',
+ .to have_css(".op-toast.-error",
+ text: I18n.t("work_packages.bulk.x_out_of_y_could_be_saved",
failing: 1,
total: 2,
success: 1))
diff --git a/spec/features/work_packages/bulk/update_work_package_spec.rb b/spec/features/work_packages/bulk/update_work_package_spec.rb
index 7f07d525b897..6689aff8ae9f 100644
--- a/spec/features/work_packages/bulk/update_work_package_spec.rb
+++ b/spec/features/work_packages/bulk/update_work_package_spec.rb
@@ -1,19 +1,19 @@
-require 'spec_helper'
-require 'features/page_objects/notification'
+require "spec_helper"
+require "features/page_objects/notification"
-RSpec.describe 'Bulk update work packages through Rails view', :js, :with_cuprite do
- shared_let(:type) { create(:type, name: 'Bug') }
- shared_let(:project) { create(:project, name: 'Source', types: [type]) }
+RSpec.describe "Bulk update work packages through Rails view", :js, :with_cuprite do
+ shared_let(:type) { create(:type, name: "Bug") }
+ shared_let(:project) { create(:project, name: "Source", types: [type]) }
shared_let(:status) { create(:status) }
shared_let(:custom_field) do
create(:string_wp_custom_field,
- name: 'Text CF',
+ name: "Text CF",
types: [type],
projects: [project])
end
shared_let(:custom_field_removed) do
create(:string_wp_custom_field,
- name: 'Text CF Removed',
+ name: "Text CF Removed",
types: [type],
projects: [project])
end
@@ -27,14 +27,14 @@
end
shared_let(:dev) do
create(:user,
- firstname: 'Dev',
- lastname: 'Guy',
+ firstname: "Dev",
+ lastname: "Guy",
member_with_roles: { project => dev_role })
end
shared_let(:mover) do
create(:admin,
- firstname: 'Manager',
- lastname: 'Guy',
+ firstname: "Manager",
+ lastname: "Guy",
member_with_roles: { project => mover_role })
end
@@ -75,22 +75,22 @@
wp_table.expect_work_package_listed work_package, work_package2
# Select all work packages
- find('body').send_keys [:control, 'a']
+ find("body").send_keys [:control, "a"]
end
- context 'with permission' do
+ context "with permission" do
let(:current_user) { mover }
before do
context_menu.open_for work_package
- context_menu.choose 'Bulk edit'
+ context_menu.choose "Bulk edit"
- notes.set_markdown('The typed note')
+ notes.set_markdown("The typed note")
end
- it 'sets status and leaves a note' do
- select status2.name, from: 'work_package_status_id'
- click_on 'Submit'
+ it "sets status and leaves a note" do
+ select status2.name, from: "work_package_status_id"
+ click_on "Submit"
expect_angular_frontend_initialized
wp_table.expect_work_package_count 2
@@ -100,32 +100,32 @@
.to eq([status2.id])
expect([work_package.journals.last.notes, work_package2.journals.last.notes].uniq)
- .to eq(['The typed note'])
+ .to eq(["The typed note"])
end
- context 'when making an error in the form' do
+ context "when making an error in the form" do
let(:work_package2_status) { create(:status) } # without creating a workflow
- it 'does not update the work packages' do
- select status2.name, from: 'work_package_status_id'
- fill_in 'Parent', with: '-1'
- click_on 'Submit'
+ it "does not update the work packages" do
+ select status2.name, from: "work_package_status_id"
+ fill_in "Parent", with: "-1"
+ click_on "Submit"
expect(page)
.to have_css(
- '.op-toast.-error',
- text: I18n.t('work_packages.bulk.none_could_be_saved', total: 2)
+ ".op-toast.-error",
+ text: I18n.t("work_packages.bulk.none_could_be_saved", total: 2)
)
expect(page)
.to have_css(
- '.op-toast.-error',
+ ".op-toast.-error",
text: "#{work_package.id}: Parent #{I18n.t('activerecord.errors.messages.does_not_exist')}"
)
expect(page)
.to have_css(
- '.op-toast.-error',
+ ".op-toast.-error",
text: <<~MSG.squish
#{work_package2.id}:
Parent #{I18n.t('activerecord.errors.messages.does_not_exist')}
@@ -141,27 +141,27 @@
end
end
- describe 'custom fields' do
- context 'when editing custom field of work packages with a readonly status (regression#44673)' do
+ describe "custom fields" do
+ context "when editing custom field of work packages with a readonly status (regression#44673)" do
let(:work_package2_status) { create(:status, :readonly) }
- context 'with enterprise', with_ee: %i[readonly_work_packages] do
- it 'does not update the work packages' do
+ context "with enterprise", with_ee: %i[readonly_work_packages] do
+ it "does not update the work packages" do
expect(work_package.send(custom_field.attribute_getter)).to be_nil
expect(work_package2.send(custom_field.attribute_getter)).to be_nil
- fill_in custom_field.name, with: 'Custom field text'
- click_on 'Submit'
+ fill_in custom_field.name, with: "Custom field text"
+ click_on "Submit"
expect(page)
.to have_css(
- '.op-toast.-error',
- text: I18n.t('work_packages.bulk.x_out_of_y_could_be_saved', total: 2, failing: 1, success: 1)
+ ".op-toast.-error",
+ text: I18n.t("work_packages.bulk.x_out_of_y_could_be_saved", total: 2, failing: 1, success: 1)
)
expect(page)
.to have_css(
- '.op-toast.-error',
+ ".op-toast.-error",
text: <<~MSG.squish
#{work_package2.id}:
#{custom_field.name} #{I18n.t('activerecord.errors.messages.error_readonly')}
@@ -174,60 +174,60 @@
work_package2.reload
expect(work_package.send(custom_field.attribute_getter))
- .to eq('Custom field text')
+ .to eq("Custom field text")
expect(work_package2.send(custom_field.attribute_getter))
.to be_nil
end
end
- context 'without enterprise', with_ee: false do
- it 'ignores the readonly status and updates the work packages' do
+ context "without enterprise", with_ee: false do
+ it "ignores the readonly status and updates the work packages" do
expect(work_package.send(custom_field.attribute_getter)).to be_nil
expect(work_package2.send(custom_field.attribute_getter)).to be_nil
- fill_in custom_field.name, with: 'Custom field text'
- click_on 'Submit'
+ fill_in custom_field.name, with: "Custom field text"
+ click_on "Submit"
- expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_update))
+ expect(page).to have_css(".op-toast.-success", text: I18n.t(:notice_successful_update))
# Should update 2 work package custom fields
work_package.reload
work_package2.reload
expect(work_package.send(custom_field.attribute_getter))
- .to eq('Custom field text')
+ .to eq("Custom field text")
expect(work_package2.send(custom_field.attribute_getter))
- .to eq('Custom field text')
+ .to eq("Custom field text")
end
end
end
- describe 'unsetting values for different fields' do
+ describe "unsetting values for different fields" do
let(:boolean_cf) do
create(:boolean_wp_custom_field,
- name: 'Bool CF',
+ name: "Bool CF",
types: [type],
projects: [project])
end
let(:required_boolean_cf) do
create(:boolean_wp_custom_field,
- name: 'Required Bool CF',
+ name: "Required Bool CF",
types: [type],
projects: [project],
is_required: true)
end
let(:list_cf) do
create(:list_wp_custom_field,
- name: 'List CF',
+ name: "List CF",
types: [type],
projects: [project],
possible_values: %w[A B C])
end
let(:required_list_cf) do
create(:list_wp_custom_field,
- name: 'Required List CF',
+ name: "Required List CF",
types: [type],
projects: [project],
possible_values: %w[A B C],
@@ -235,20 +235,20 @@
end
let(:multi_list_cf) do
create(:list_wp_custom_field, :multi_list,
- name: 'Multi select List CF',
+ name: "Multi select List CF",
types: [type],
projects: [project],
possible_values: %w[A B C])
end
let(:user_cf) do
create(:user_wp_custom_field,
- name: 'User CF',
+ name: "User CF",
types: [type],
projects: [project])
end
let(:multi_user_cf) do
create(:user_wp_custom_field, :multi_user,
- name: 'Multi user CF',
+ name: "Multi user CF",
types: [type],
projects: [project])
end
@@ -274,33 +274,33 @@
wait_for_reload
end
- it 'clears the chosen values' do
+ it "clears the chosen values" do
# Required fields should not have a 'none' option
- expect(page).to have_no_select(required_boolean_cf.name, with_options: ['none'])
- expect(page).to have_no_select(required_list_cf.name, with_options: ['none'])
+ expect(page).to have_no_select(required_boolean_cf.name, with_options: ["none"])
+ expect(page).to have_no_select(required_list_cf.name, with_options: ["none"])
# Unset any non-required fields
- select 'none', from: boolean_cf.name
- select 'none', from: list_cf.name
- select 'none', from: multi_list_cf.name
- select 'nobody', from: user_cf.name
- select 'nobody', from: multi_user_cf.name
+ select "none", from: boolean_cf.name
+ select "none", from: list_cf.name
+ select "none", from: multi_list_cf.name
+ select "nobody", from: user_cf.name
+ select "nobody", from: multi_user_cf.name
- click_on 'Submit'
+ click_on "Submit"
expect_angular_frontend_initialized
wp_table.expect_work_package_count 2
# It clears all the values except the required fields
expect(work_package.reload.custom_field_values.pluck(:value).compact)
- .to eq(['f', required_list_cf.custom_options.find_by(value: "B").id.to_s])
+ .to eq(["f", required_list_cf.custom_options.find_by(value: "B").id.to_s])
expect(work_package2.reload.custom_field_values.pluck(:value).compact)
- .to eq(['f', required_list_cf.custom_options.find_by(value: "B").id.to_s])
+ .to eq(["f", required_list_cf.custom_options.find_by(value: "B").id.to_s])
end
end
- context 'when custom fields are removed from types' do
- it 'does not display them on the form' do
+ context "when custom fields are removed from types" do
+ it "does not display them on the form" do
expect(page).to have_field custom_field_removed.name
custom_field_removed.types = []
@@ -314,12 +314,12 @@
end
end
- context 'without permission' do
+ context "without permission" do
let(:current_user) { dev }
- it 'does not allow to copy' do
+ it "does not allow to copy" do
context_menu.open_for work_package
- context_menu.expect_no_options 'Bulk edit'
+ context_menu.expect_no_options "Bulk edit"
end
end
end
diff --git a/spec/features/work_packages/cancel_editing_spec.rb b/spec/features/work_packages/cancel_editing_spec.rb
index 038d1cd36944..8a16f99f4e11 100644
--- a/spec/features/work_packages/cancel_editing_spec.rb
+++ b/spec/features/work_packages/cancel_editing_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Cancel editing work package', :js do
+RSpec.describe "Cancel editing work package", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_package) { create(:work_package, project:) }
@@ -53,22 +53,22 @@
def expect_active_edit(path)
visit path
expect_angular_frontend_initialized
- expect(page).to have_css('#wp-new-inline-edit--field-subject', wait: 10)
+ expect(page).to have_css("#wp-new-inline-edit--field-subject", wait: 10)
end
def expect_subject(val)
- subject = page.find_by_id('wp-new-inline-edit--field-subject')
+ subject = page.find_by_id("wp-new-inline-edit--field-subject")
expect(subject.value).to eq(val)
end
def move_to_home_page(alert: true)
- find('.op-logo--link').click
+ find(".op-logo--link").click
page.driver.browser.switch_to.alert.accept if alert
- expect(page).to have_css('#projects-menu', text: 'Select a project')
+ expect(page).to have_css("#projects-menu", text: "Select a project")
end
- it 'does not show an alert when moving to other pages' do
+ it "does not show an alert when moving to other pages" do
# This used to show an alert until browsers dropped support
# for `onbeforeunload`.
#
@@ -84,7 +84,7 @@ def move_to_home_page(alert: true)
end
end
- it 'shows an alert when moving to other states' do
+ it "shows an alert when moving to other states" do
expect_active_edit(new_split_work_packages_path)
loading_indicator_saveguard
wp_table.expect_work_package_listed(work_package2)
@@ -92,11 +92,11 @@ def move_to_home_page(alert: true)
wp_table.open_split_view(work_package2)
page.driver.browser.switch_to.alert.dismiss
- expect(page).to have_css('#wp-new-inline-edit--field-subject')
+ expect(page).to have_css("#wp-new-inline-edit--field-subject")
expect(wp_page).not_to have_alert_dialog
end
- it 'shows an alert when moving to other states while editing a single attribute (Regression #25135)' do
+ it "shows an alert when moving to other states while editing a single attribute (Regression #25135)" do
wp_table.visit!
wp_table.expect_work_package_listed(work_package, work_package2)
@@ -119,45 +119,45 @@ def move_to_home_page(alert: true)
version.expect_inactive!
end
- it 'cancels the editing when clicking the button' do
+ it "cancels the editing when clicking the button" do
paths.each do |path|
expect_active_edit(path)
- find_by_id('work-packages--edit-actions-cancel').click
+ find_by_id("work-packages--edit-actions-cancel").click
expect(wp_page).not_to have_alert_dialog
end
end
- it 'allows to move from split to full screen in edit mode' do
+ it "allows to move from split to full screen in edit mode" do
# Start creating on split view
expect_active_edit(new_split_work_packages_path)
- find_by_id('wp-new-inline-edit--field-subject').set 'foobar'
+ find_by_id("wp-new-inline-edit--field-subject").set "foobar"
# Expect editing works when moving to full screen
- find('.work-packages-show-view-button').click
+ find(".work-packages-show-view-button").click
expect(wp_page).not_to have_alert_dialog
- expect(page).to have_css('#wp-new-inline-edit--field-subject')
- expect_subject('foobar')
+ expect(page).to have_css("#wp-new-inline-edit--field-subject")
+ expect_subject("foobar")
# Moving back also works
- page.execute_script('window.history.back()')
+ page.execute_script("window.history.back()")
expect(wp_page).not_to have_alert_dialog
- expect(page).to have_css('#wp-new-inline-edit--field-subject')
- expect_subject('foobar')
+ expect(page).to have_css("#wp-new-inline-edit--field-subject")
+ expect_subject("foobar")
# Cancel edition
- find_by_id('work-packages--edit-actions-cancel').click
+ find_by_id("work-packages--edit-actions-cancel").click
expect(wp_page).not_to have_alert_dialog
# Visiting another page does not create alert
- find('.op-logo--link').click
+ find(".op-logo--link").click
expect(wp_page).not_to have_alert_dialog
end
- it 'correctly cancels setting the back route (Regression #30714)' do
+ it "correctly cancels setting the back route (Regression #30714)" do
wp_page = Pages::FullWorkPackage.new work_package
wp_page.visit!
wp_page.ensure_page_loaded
@@ -165,7 +165,7 @@ def move_to_home_page(alert: true)
# Edit description in full view
description = wp_page.edit_field :description
description.activate!
- description.click_and_type_slowly 'foobar'
+ description.click_and_type_slowly "foobar"
# Try to move back to list, expect warning
wp_page.go_back
@@ -180,12 +180,12 @@ def move_to_home_page(alert: true)
wp_table.expect_work_package_listed(work_package, work_package2)
end
- context 'when user does not want to be warned' do
+ context "when user does not want to be warned" do
before do
create(:user_preference, user:, others: { warn_on_leaving_unsaved: false })
end
- it 'does not alert when moving anywhere' do
+ it "does not alert when moving anywhere" do
# Moving to angular states
expect_active_edit(new_split_work_packages_path)
wp_table.expect_work_package_listed(work_package2)
@@ -193,8 +193,8 @@ def move_to_home_page(alert: true)
wp_table.open_split_view(work_package2)
expect(wp_page).not_to have_alert_dialog
- expect(page).to have_no_css('#wp-new-inline-edit--field-subject')
- expect(page).to have_css('.work-packages--details--subject', text: work_package2.subject)
+ expect(page).to have_no_css("#wp-new-inline-edit--field-subject")
+ expect(page).to have_css(".work-packages--details--subject", text: work_package2.subject)
# Moving somewhere else
expect_active_edit(new_split_work_packages_path)
diff --git a/spec/features/work_packages/copy_spec.rb b/spec/features/work_packages/copy_spec.rb
index 53ccc792d3ba..4073eccc4c73 100644
--- a/spec/features/work_packages/copy_spec.rb
+++ b/spec/features/work_packages/copy_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package copy', :js, :selenium do
+RSpec.describe "Work package copy", :js, :selenium do
let(:user) do
create(:user,
member_with_roles: { project => create_role })
@@ -63,20 +63,20 @@
let(:role) { build(:project_role, permissions: %i[view_work_packages work_package_assigned]) }
let(:assignee) do
create(:user,
- firstname: 'An',
- lastname: 'assignee',
+ firstname: "An",
+ lastname: "assignee",
member_with_roles: { project => role })
end
let(:responsible) do
create(:user,
- firstname: 'The',
- lastname: 'responsible',
+ firstname: "The",
+ lastname: "responsible",
member_with_roles: { project => role })
end
let(:author) do
create(:user,
- firstname: 'The',
- lastname: 'author',
+ firstname: "The",
+ lastname: "author",
member_with_roles: { project => role })
end
let(:version) do
@@ -90,21 +90,21 @@
work_flow.save!
end
- it 'on fullscreen page' do
+ it "on fullscreen page" do
original_work_package_page = Pages::FullWorkPackage.new(original_work_package, project)
to_copy_work_package_page = original_work_package_page.visit_copy!
to_copy_work_package_page.expect_current_path
to_copy_work_package_page.expect_fully_loaded
- to_copy_work_package_page.update_attributes Description: 'Copied WP Description'
+ to_copy_work_package_page.update_attributes Description: "Copied WP Description"
to_copy_work_package_page.save!
- expect(page).to have_css('.op-toast--content',
- text: I18n.t('js.notice_successful_create'),
+ expect(page).to have_css(".op-toast--content",
+ text: I18n.t("js.notice_successful_create"),
wait: 20)
- copied_work_package = WorkPackage.order(created_at: 'desc').first
+ copied_work_package = WorkPackage.order(created_at: "desc").first
expect(copied_work_package).not_to eql original_work_package
@@ -112,7 +112,7 @@
work_package_page.ensure_page_loaded
work_package_page.expect_attributes Subject: original_work_package.subject,
- Description: 'Copied WP Description',
+ Description: "Copied WP Description",
Version: original_work_package.version,
Priority: original_work_package.priority,
Assignee: original_work_package.assigned_to.name,
@@ -123,41 +123,41 @@
work_package_page.visit_tab! :relations
expect_angular_frontend_initialized
- expect(page).to have_css('.relation-group--header', text: 'RELATED TO', wait: 20)
- expect(page).to have_test_selector('op-relation--row-subject', text: original_work_package.subject)
+ expect(page).to have_css(".relation-group--header", text: "RELATED TO", wait: 20)
+ expect(page).to have_test_selector("op-relation--row-subject", text: original_work_package.subject)
end
- describe 'when source work package has an attachment' do
- it 'still allows copying through menu (Regression #30518)' do
+ describe "when source work package has an attachment" do
+ it "still allows copying through menu (Regression #30518)" do
wp_page = Pages::FullWorkPackage.new(original_work_package, project)
wp_page.visit!
wp_page.ensure_page_loaded
# Go to add cost entry page
- find('#action-show-more-dropdown-menu .button').click
- find('.menu-item', text: 'Copy', exact_text: true).click
+ find("#action-show-more-dropdown-menu .button").click
+ find(".menu-item", text: "Copy", exact_text: true).click
to_copy_work_package_page = Pages::FullWorkPackageCreate.new(original_work_package:)
- to_copy_work_package_page.update_attributes Description: 'Copied WP Description'
+ to_copy_work_package_page.update_attributes Description: "Copied WP Description"
to_copy_work_package_page.save!
- to_copy_work_package_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_create')
+ to_copy_work_package_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_create")
end
end
- it 'on split screen page' do
+ it "on split screen page" do
original_work_package_page = Pages::SplitWorkPackage.new(original_work_package, project)
to_copy_work_package_page = original_work_package_page.visit_copy!
to_copy_work_package_page.expect_current_path
to_copy_work_package_page.expect_fully_loaded
- to_copy_work_package_page.update_attributes Description: 'Copied WP Description'
+ to_copy_work_package_page.update_attributes Description: "Copied WP Description"
to_copy_work_package_page.save!
- find('.op-toast--content', text: I18n.t('js.notice_successful_create'), wait: 20)
+ find(".op-toast--content", text: I18n.t("js.notice_successful_create"), wait: 20)
- copied_work_package = WorkPackage.order(created_at: 'desc').first
+ copied_work_package = WorkPackage.order(created_at: "desc").first
expect(copied_work_package).not_to eql original_work_package
@@ -165,7 +165,7 @@
work_package_page.ensure_page_loaded
work_package_page.expect_attributes Subject: original_work_package.subject,
- Description: 'Copied WP Description',
+ Description: "Copied WP Description",
Version: original_work_package.version,
Priority: original_work_package.priority,
Assignee: original_work_package.assigned_to,
@@ -174,9 +174,9 @@
work_package_page.expect_activity user, number: 1
work_package_page.expect_current_path
- work_package_page.visit_tab!('relations')
+ work_package_page.visit_tab!("relations")
expect_angular_frontend_initialized
- expect(page).to have_css('.relation-group--header', text: 'RELATED TO', wait: 20)
- expect(page).to have_test_selector('op-relation--row-subject', text: original_work_package.subject)
+ expect(page).to have_css(".relation-group--header", text: "RELATED TO", wait: 20)
+ expect(page).to have_test_selector("op-relation--row-subject", text: original_work_package.subject)
end
end
diff --git a/spec/features/work_packages/custom_actions/custom_actions_me_value_spec.rb b/spec/features/work_packages/custom_actions/custom_actions_me_value_spec.rb
index f6dcd7ea364e..6f1938bf9be5 100644
--- a/spec/features/work_packages/custom_actions/custom_actions_me_value_spec.rb
+++ b/spec/features/work_packages/custom_actions/custom_actions_me_value_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Custom actions me value', :js, :with_cuprite, with_ee: %i[custom_actions] do
+RSpec.describe "Custom actions me value", :js, :with_cuprite, with_ee: %i[custom_actions] do
shared_let(:admin) { create(:admin) }
let(:permissions) { %i(view_work_packages edit_work_packages) }
@@ -37,7 +37,7 @@
create(:user, member_with_roles: { project => role })
end
let(:type) { create(:type_task) }
- let(:project) { create(:project, types: [type], name: 'This project') }
+ let(:project) { create(:project, types: [type], name: "This project") }
let!(:custom_field) { create(:user_wp_custom_field, types: [type], projects: [project]) }
let!(:work_package) do
create(:work_package,
@@ -47,7 +47,7 @@
let(:wp_page) { Pages::FullWorkPackage.new(work_package) }
let(:default_priority) do
- create(:default_priority, name: 'Normal')
+ create(:default_priority, name: "Normal")
end
let(:index_ca_page) { Pages::Admin::CustomActions::Index.new }
@@ -55,26 +55,26 @@
login_as(admin)
end
- it 'can assign user custom field to self' do
+ it "can assign user custom field to self" do
# create custom action 'Unassign'
index_ca_page.visit!
new_ca_page = index_ca_page.new
- new_ca_page.set_name('Set CF to me')
- new_ca_page.add_action(custom_field.name, I18n.t('custom_actions.actions.assigned_to.executing_user_value'))
+ new_ca_page.set_name("Set CF to me")
+ new_ca_page.add_action(custom_field.name, I18n.t("custom_actions.actions.assigned_to.executing_user_value"))
new_ca_page.create
assign = CustomAction.last
expect(assign.actions.length).to eq(1)
expect(assign.conditions.length).to eq(0)
- expect(assign.actions.first.values).to eq(['current_user'])
+ expect(assign.actions.first.values).to eq(["current_user"])
login_as user
wp_page.visit!
- wp_page.expect_custom_action('Set CF to me')
- wp_page.click_custom_action('Set CF to me')
+ wp_page.expect_custom_action("Set CF to me")
+ wp_page.click_custom_action("Set CF to me")
wp_page.expect_attributes "customField#{custom_field.id}": user.name
end
end
diff --git a/spec/features/work_packages/custom_actions/custom_actions_spec.rb b/spec/features/work_packages/custom_actions/custom_actions_spec.rb
index d2690c01f2b4..f3f40b859dab 100644
--- a/spec/features/work_packages/custom_actions/custom_actions_spec.rb
+++ b/spec/features/work_packages/custom_actions/custom_actions_spec.rb
@@ -26,27 +26,27 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Custom actions', :js, :with_cuprite,
+RSpec.describe "Custom actions", :js, :with_cuprite,
with_ee: %i[custom_actions] do
shared_let(:admin) { create(:admin) }
shared_let(:permissions) { %i(view_work_packages edit_work_packages move_work_packages work_package_assigned) }
shared_let(:role) { create(:project_role, permissions:) }
shared_let(:other_role) { create(:project_role, permissions:) }
- shared_let(:project) { create(:project, name: 'This project') }
- shared_let(:other_project) { create(:project, name: 'Other project') }
+ shared_let(:project) { create(:project, name: "This project") }
+ shared_let(:other_project) { create(:project, name: "Other project") }
shared_let(:user) do
create(:user,
- firstname: 'A',
- lastname: 'User',
+ firstname: "A",
+ lastname: "User",
member_with_roles: { project => [role], other_project => [role] })
end
shared_let(:other_member_user) do
create(:user,
- firstname: 'Other member',
- lastname: 'User',
+ firstname: "Other member",
+ lastname: "User",
member_with_roles: { project => role })
end
@@ -60,21 +60,21 @@
let(:wp_page) { Pages::FullWorkPackage.new(work_package) }
let(:default_priority) do
- create(:default_priority, name: 'Normal')
+ create(:default_priority, name: "Normal")
end
let!(:immediate_priority) do
create(:issue_priority,
- name: 'At once',
+ name: "At once",
position: IssuePriority.maximum(:position) + 1)
end
let(:default_status) do
- create(:default_status, name: 'Default status')
+ create(:default_status, name: "Default status")
end
let(:closed_status) do
- create(:closed_status, name: 'Closed')
+ create(:closed_status, name: "Closed")
end
let(:rejected_status) do
- create(:closed_status, name: 'Rejected')
+ create(:closed_status, name: "Rejected")
end
let(:other_type) do
type = create(:type)
@@ -134,21 +134,21 @@
login_as admin
end
- it 'viewing workflow buttons' do
+ it "viewing workflow buttons" do
# create custom action 'Unassign'
index_ca_page.visit!
new_ca_page = index_ca_page.new
- new_ca_page.set_name('Unassign')
- new_ca_page.set_description('Removes the assignee')
- new_ca_page.add_action('Assignee', '-')
- new_ca_page.expect_action('assigned_to', nil)
+ new_ca_page.set_name("Unassign")
+ new_ca_page.set_description("Removes the assignee")
+ new_ca_page.add_action("Assignee", "-")
+ new_ca_page.expect_action("assigned_to", nil)
new_ca_page.create
index_ca_page.expect_current_path
- index_ca_page.expect_listed('Unassign')
+ index_ca_page.expect_listed("Unassign")
unassign = CustomAction.last
expect(unassign.actions.length).to eq(1)
@@ -158,22 +158,22 @@
new_ca_page = index_ca_page.new
- new_ca_page.set_name('Close')
+ new_ca_page.set_name("Close")
- new_ca_page.add_action('Status', 'Close')
- new_ca_page.expect_action('status', closed_status.id)
+ new_ca_page.add_action("Status", "Close")
+ new_ca_page.expect_action("status", closed_status.id)
- new_ca_page.set_condition('Role', role.name)
+ new_ca_page.set_condition("Role", role.name)
new_ca_page.expect_selected_option role.name
- new_ca_page.set_condition('Status', [default_status.name, rejected_status.name])
+ new_ca_page.set_condition("Status", [default_status.name, rejected_status.name])
new_ca_page.expect_selected_option default_status.name
new_ca_page.expect_selected_option rejected_status.name
new_ca_page.create
index_ca_page.expect_current_path
- index_ca_page.expect_listed('Unassign', 'Close')
+ index_ca_page.expect_listed("Unassign", "Close")
close = CustomAction.last
expect(close.actions.length).to eq(1)
@@ -182,22 +182,22 @@
# create custom action 'Escalate'
new_ca_page = index_ca_page.new
- new_ca_page.set_name('Escalate')
- new_ca_page.add_action('Priority', immediate_priority.name)
- new_ca_page.expect_action('priority', immediate_priority.id)
+ new_ca_page.set_name("Escalate")
+ new_ca_page.add_action("Priority", immediate_priority.name)
+ new_ca_page.expect_action("priority", immediate_priority.id)
- new_ca_page.add_action('Notify', other_member_user.name)
+ new_ca_page.add_action("Notify", other_member_user.name)
new_ca_page.expect_selected_option other_member_user.name
new_ca_page.add_action(list_custom_field.name, selected_list_custom_field_options.map(&:name))
- new_ca_page.expect_selected_option 'A'
- new_ca_page.expect_selected_option 'G'
+ new_ca_page.expect_selected_option "A"
+ new_ca_page.expect_selected_option "G"
new_ca_page.create
index_ca_page.expect_current_path
- index_ca_page.expect_listed('Unassign', 'Close', 'Escalate')
+ index_ca_page.expect_listed("Unassign", "Close", "Escalate")
escalate = CustomAction.last
expect(escalate.actions.length).to eq(3)
@@ -207,28 +207,28 @@
new_ca_page = index_ca_page.new
- new_ca_page.set_name('Reset')
+ new_ca_page.set_name("Reset")
- new_ca_page.add_action('Priority', default_priority.name)
- new_ca_page.expect_action('priority', default_priority.id)
+ new_ca_page.add_action("Priority", default_priority.name)
+ new_ca_page.expect_action("priority", default_priority.id)
- new_ca_page.add_action('Status', default_status.name)
- new_ca_page.expect_action('status', default_status.id)
+ new_ca_page.add_action("Status", default_status.name)
+ new_ca_page.expect_action("status", default_status.id)
- new_ca_page.add_action('Assignee', user.name)
- new_ca_page.expect_action('assigned_to', user.id)
+ new_ca_page.add_action("Assignee", user.name)
+ new_ca_page.expect_action("assigned_to", user.id)
# This custom field is not applicable
- new_ca_page.add_action(int_custom_field.name, '1')
- new_ca_page.expect_action(int_custom_field.attribute_name, '1')
+ new_ca_page.add_action(int_custom_field.name, "1")
+ new_ca_page.expect_action(int_custom_field.attribute_name, "1")
- new_ca_page.set_condition('Status', closed_status.name)
+ new_ca_page.set_condition("Status", closed_status.name)
new_ca_page.expect_selected_option closed_status.name
new_ca_page.create
index_ca_page.expect_current_path
- index_ca_page.expect_listed('Unassign', 'Close', 'Escalate', 'Reset')
+ index_ca_page.expect_listed("Unassign", "Close", "Escalate", "Reset")
reset = CustomAction.last
expect(reset.actions.length).to eq(4)
@@ -238,17 +238,17 @@
new_ca_page = index_ca_page.new
- new_ca_page.set_name('Other roles action')
+ new_ca_page.set_name("Other roles action")
- new_ca_page.add_action('Status', default_status.name)
- new_ca_page.expect_action('status', default_status.id)
+ new_ca_page.add_action("Status", default_status.name)
+ new_ca_page.expect_action("status", default_status.id)
- new_ca_page.set_condition('Role', other_role.name)
+ new_ca_page.set_condition("Role", other_role.name)
new_ca_page.expect_selected_option other_role.name
new_ca_page.create
index_ca_page.expect_current_path
- index_ca_page.expect_listed('Unassign', 'Close', 'Escalate', 'Reset', 'Other roles action')
+ index_ca_page.expect_listed("Unassign", "Close", "Escalate", "Reset", "Other roles action")
other_roles_action = CustomAction.last
expect(other_roles_action.actions.length).to eq(1)
@@ -259,36 +259,36 @@
new_ca_page = index_ca_page.new
retry_block do
- new_ca_page.set_name('Move project')
+ new_ca_page.set_name("Move project")
# Add date custom action which has a different admin layout
ignore_ferrum_javascript_error do
- select date_custom_field.name, from: 'Add action'
+ select date_custom_field.name, from: "Add action"
end
ignore_ferrum_javascript_error do
- select 'on', from: date_custom_field.name
+ select "on", from: date_custom_field.name
end
date = (Date.current + 5.days)
find("#custom_action_actions_custom_field_#{date_custom_field.id}_visible").click
- datepicker = Components::Datepicker.new 'body'
+ datepicker = Components::Datepicker.new "body"
datepicker.set_date date
- new_ca_page.add_action('Type', other_type.name)
- new_ca_page.expect_action('type', other_type.id)
+ new_ca_page.add_action("Type", other_type.name)
+ new_ca_page.expect_action("type", other_type.id)
- new_ca_page.add_action('Project', other_project.name)
- new_ca_page.expect_action('project', other_project.id)
+ new_ca_page.add_action("Project", other_project.name)
+ new_ca_page.expect_action("project", other_project.id)
- new_ca_page.set_condition('Project', project.name)
+ new_ca_page.set_condition("Project", project.name)
new_ca_page.expect_selected_option project.name
end
new_ca_page.create
index_ca_page.expect_current_path
- index_ca_page.expect_listed('Unassign', 'Close', 'Escalate', 'Reset', 'Other roles action', 'Move project')
+ index_ca_page.expect_listed("Unassign", "Close", "Escalate", "Reset", "Other roles action", "Move project")
move_project = CustomAction.last
expect(move_project.actions.length).to eq(3)
@@ -299,50 +299,50 @@
wp_page.visit!
- wp_page.expect_custom_action('Unassign')
- wp_page.expect_custom_action('Close')
- wp_page.expect_custom_action('Escalate')
- wp_page.expect_custom_action('Move project')
- wp_page.expect_no_custom_action('Reset')
- wp_page.expect_no_custom_action('Other roles action')
- wp_page.expect_custom_action_order('Unassign', 'Close', 'Escalate', 'Move project')
+ wp_page.expect_custom_action("Unassign")
+ wp_page.expect_custom_action("Close")
+ wp_page.expect_custom_action("Escalate")
+ wp_page.expect_custom_action("Move project")
+ wp_page.expect_no_custom_action("Reset")
+ wp_page.expect_no_custom_action("Other roles action")
+ wp_page.expect_custom_action_order("Unassign", "Close", "Escalate", "Move project")
- within('.custom-actions') do
+ within(".custom-actions") do
# When hovering over the button, the description is displayed
- button = find('.custom-action--button', text: 'Unassign')
- expect(button['title'])
- .to eql 'Removes the assignee'
+ button = find(".custom-action--button", text: "Unassign")
+ expect(button["title"])
+ .to eql "Removes the assignee"
end
- wp_page.click_custom_action('Unassign')
- wp_page.expect_attributes assignee: '-'
- within '.work-package-details-activities-list' do
+ wp_page.click_custom_action("Unassign")
+ wp_page.expect_attributes assignee: "-"
+ within ".work-package-details-activities-list" do
expect(page)
- .to have_css('.op-user-activity .op-user-activity--user-name',
+ .to have_css(".op-user-activity .op-user-activity--user-name",
text: user.name,
wait: 10)
end
- wp_page.click_custom_action('Escalate')
+ wp_page.click_custom_action("Escalate")
wp_page.expect_attributes priority: immediate_priority.name,
status: default_status.name,
- assignee: '-',
+ assignee: "-",
"customField#{list_custom_field.id}" => selected_list_custom_field_options.map(&:name).join("\n")
- within '.work-package-details-activities-list' do
+ within ".work-package-details-activities-list" do
expect(page)
- .to have_css('.op-user-activity a.user-mention',
+ .to have_css(".op-user-activity a.user-mention",
text: other_member_user.name,
wait: 10)
end
- wp_page.click_custom_action('Close')
+ wp_page.click_custom_action("Close")
wp_page.expect_attributes status: closed_status.name,
priority: immediate_priority.name
- wp_page.expect_custom_action('Reset')
- wp_page.expect_no_custom_action('Close')
+ wp_page.expect_custom_action("Reset")
+ wp_page.expect_no_custom_action("Close")
- wp_page.click_custom_action('Reset')
+ wp_page.click_custom_action("Reset")
wp_page.expect_attributes priority: default_priority.name,
status: default_status.name,
@@ -354,130 +354,130 @@
index_ca_page.visit!
- edit_ca_page = index_ca_page.edit('Reset')
+ edit_ca_page = index_ca_page.edit("Reset")
retry_block do
- edit_ca_page.set_name 'Reject'
- edit_ca_page.remove_action 'Priority'
- edit_ca_page.set_action 'Assignee', '-'
- edit_ca_page.expect_action 'assigned_to', nil
+ edit_ca_page.set_name "Reject"
+ edit_ca_page.remove_action "Priority"
+ edit_ca_page.set_action "Assignee", "-"
+ edit_ca_page.expect_action "assigned_to", nil
- edit_ca_page.set_action 'Status', rejected_status.name
- edit_ca_page.expect_action 'status', rejected_status.id
+ edit_ca_page.set_action "Status", rejected_status.name
+ edit_ca_page.expect_action "status", rejected_status.id
- edit_ca_page.set_condition 'Status', default_status.name
+ edit_ca_page.set_condition "Status", default_status.name
edit_ca_page.expect_selected_option default_status.name
end
edit_ca_page.save
index_ca_page.expect_current_path
- index_ca_page.expect_listed('Unassign', 'Close', 'Escalate', 'Reject')
+ index_ca_page.expect_listed("Unassign", "Close", "Escalate", "Reject")
- reset = CustomAction.find_by(name: 'Reject')
+ reset = CustomAction.find_by(name: "Reject")
expect(reset.actions.length).to eq(3)
expect(reset.conditions.length).to eq(1)
- index_ca_page.move_top 'Move project'
- index_ca_page.move_bottom 'Escalate'
- index_ca_page.move_up 'Close'
- index_ca_page.move_down 'Unassign'
+ index_ca_page.move_top "Move project"
+ index_ca_page.move_bottom "Escalate"
+ index_ca_page.move_up "Close"
+ index_ca_page.move_down "Unassign"
# Check the altered button
login_as(user)
wp_page.visit!
- wp_page.expect_custom_action('Unassign')
- wp_page.expect_custom_action('Close')
- wp_page.expect_custom_action('Escalate')
- wp_page.expect_custom_action('Move project')
- wp_page.expect_custom_action('Reject')
- wp_page.expect_no_custom_action('Reset')
- wp_page.expect_custom_action_order('Move project', 'Close', 'Reject', 'Unassign', 'Escalate')
+ wp_page.expect_custom_action("Unassign")
+ wp_page.expect_custom_action("Close")
+ wp_page.expect_custom_action("Escalate")
+ wp_page.expect_custom_action("Move project")
+ wp_page.expect_custom_action("Reject")
+ wp_page.expect_no_custom_action("Reset")
+ wp_page.expect_custom_action_order("Move project", "Close", "Reject", "Unassign", "Escalate")
- wp_page.click_custom_action('Reject')
- wp_page.expect_attributes assignee: '-',
+ wp_page.click_custom_action("Reject")
+ wp_page.expect_attributes assignee: "-",
status: rejected_status.name,
priority: default_priority.name
- wp_page.expect_custom_action('Close')
- wp_page.expect_no_custom_action('Reject')
+ wp_page.expect_custom_action("Close")
+ wp_page.expect_no_custom_action("Reject")
# Delete 'Reject' from list of actions
login_as(admin)
index_ca_page.visit!
- index_ca_page.delete('Unassign')
+ index_ca_page.delete("Unassign")
index_ca_page.expect_current_path
- index_ca_page.expect_listed('Close', 'Escalate', 'Reject')
+ index_ca_page.expect_listed("Close", "Escalate", "Reject")
login_as(user)
wp_page.visit!
- wp_page.expect_no_custom_action('Unassign')
- wp_page.expect_custom_action('Close')
- wp_page.expect_custom_action('Escalate')
- wp_page.expect_no_custom_action('Reject')
+ wp_page.expect_no_custom_action("Unassign")
+ wp_page.expect_custom_action("Close")
+ wp_page.expect_custom_action("Escalate")
+ wp_page.expect_no_custom_action("Reject")
# Move project
- wp_page.click_custom_action('Move project')
+ wp_page.click_custom_action("Move project")
- wp_page.expect_attributes assignee: '-',
+ wp_page.expect_attributes assignee: "-",
status: rejected_status.name,
type: other_type.name.upcase,
- "customField#{date_custom_field.id}" => (Date.today + 5.days).strftime('%m/%d/%Y')
+ "customField#{date_custom_field.id}" => (Date.today + 5.days).strftime("%m/%d/%Y")
expect(page)
- .to have_content(I18n.t('js.project.click_to_switch_to_project', projectname: other_project.name))
+ .to have_content(I18n.t("js.project.click_to_switch_to_project", projectname: other_project.name))
## Bump the lockVersion and by that force a conflict.
work_package.reload.touch
- wp_page.click_custom_action('Escalate', expect_success: false)
+ wp_page.click_custom_action("Escalate", expect_success: false)
- wp_page.expect_toast type: :error, message: I18n.t('api_v3.errors.code_409')
+ wp_page.expect_toast type: :error, message: I18n.t("api_v3.errors.code_409")
end
- it 'editing a current date custom action (Regression #30949)' do
+ it "editing a current date custom action (Regression #30949)" do
# create custom action 'Unassign'
index_ca_page.visit!
new_ca_page = index_ca_page.new
- new_ca_page.set_name('Current date')
- new_ca_page.set_description('Sets the current date')
- new_ca_page.add_action('Date', 'Current date')
+ new_ca_page.set_name("Current date")
+ new_ca_page.set_description("Sets the current date")
+ new_ca_page.add_action("Date", "Current date")
new_ca_page.create
index_ca_page.expect_current_path
- index_ca_page.expect_listed('Current date')
+ index_ca_page.expect_listed("Current date")
date_action = CustomAction.last
expect(date_action.actions.length).to eq(1)
expect(date_action.conditions.length).to eq(0)
- edit_page = index_ca_page.edit('Current date')
- expect(page).to have_select('custom_action_actions_date', selected: 'Current date')
+ edit_page = index_ca_page.edit("Current date")
+ expect(page).to have_select("custom_action_actions_date", selected: "Current date")
end
- it 'disables the custom action button and editing other fields when submiting the custom action' do
+ it "disables the custom action button and editing other fields when submiting the custom action" do
# create custom action 'Unassign'
index_ca_page.visit!
new_ca_page = index_ca_page.new
- new_ca_page.set_name('Unassign')
- new_ca_page.set_description('Removes the assignee')
- new_ca_page.add_action('Assignee', '-')
- new_ca_page.expect_action('assigned_to', nil)
+ new_ca_page.set_name("Unassign")
+ new_ca_page.set_description("Removes the assignee")
+ new_ca_page.add_action("Assignee", "-")
+ new_ca_page.expect_action("assigned_to", nil)
new_ca_page.create
index_ca_page.expect_current_path
- index_ca_page.expect_listed('Unassign')
+ index_ca_page.expect_listed("Unassign")
unassign = CustomAction.last
expect(unassign.actions.length).to eq(1)
@@ -491,17 +491,17 @@
# Stop sending ajax requests in order to test disabled fields upon submit
wp_page.disable_ajax_requests
- wp_page.click_custom_action('Unassign', expect_success: false)
- wp_page.expect_custom_action_disabled('Unassign')
+ wp_page.click_custom_action("Unassign", expect_success: false)
+ wp_page.expect_custom_action_disabled("Unassign")
find('[data-field-name="estimatedTime"]').click
expect(page).to have_css("#wp-#{work_package.id}-inline-edit--field-estimatedTime[disabled]")
end
- context 'with baseline enabled' do
+ context "with baseline enabled" do
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:query) do
create(:query,
- name: 'Timestamps Query',
+ name: "Timestamps Query",
project:,
user:,
timestamps: ["P-1d", "PT0S"])
@@ -510,17 +510,17 @@
before do
create(:custom_action,
actions: [CustomActions::Actions::AssignedTo.new(value: nil)],
- name: 'Unassign')
+ name: "Unassign")
end
- it 'executes the custom action (Regression#49588)' do
+ it "executes the custom action (Regression#49588)" do
login_as(user)
wp_table.visit_query(query)
wp_page = wp_table.open_full_screen_by_link(work_package)
wp_page.ensure_page_loaded
- wp_page.click_custom_action('Unassign', expect_success: true)
+ wp_page.click_custom_action("Unassign", expect_success: true)
end
end
end
diff --git a/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb b/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb
index b8d4a3ceb300..7c9c182c9d08 100644
--- a/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb
@@ -26,11 +26,11 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'support/edit_fields/edit_field'
+require "spec_helper"
+require "support/edit_fields/edit_field"
-RSpec.describe 'Datepicker logic on follow relationships', :js, :with_cuprite,
- with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe "Datepicker logic on follow relationships", :js, :with_cuprite,
+ with_settings: { date_format: "%Y-%m-%d" } do
shared_let(:user) { create(:admin) }
shared_let(:type) { create(:type_bug) }
@@ -39,15 +39,15 @@
shared_let(:predecessor) do
create(:work_package,
type:, project:,
- start_date: Date.parse('2024-02-01'),
- due_date: Date.parse('2024-02-05'))
+ start_date: Date.parse("2024-02-01"),
+ due_date: Date.parse("2024-02-05"))
end
let(:work_packages_page) { Pages::FullWorkPackage.new(follower) }
let(:datepicker) { date_field.datepicker }
- shared_examples 'keeps the minimum date from the predecessor when toggling NWD' do
- it 'keeps the minimum dates disabled' do
+ shared_examples "keeps the minimum date from the predecessor when toggling NWD" do
+ it "keeps the minimum dates disabled" do
login_as(user)
work_packages_page.visit!
@@ -61,37 +61,37 @@
datepicker.expect_ignore_non_working_days false
datepicker.expect_scheduling_mode false
- datepicker.show_date '2024-02-05'
- datepicker.expect_disabled Date.parse('2024-02-05')
- datepicker.expect_disabled Date.parse('2024-02-04')
- datepicker.expect_disabled Date.parse('2024-02-03')
- datepicker.expect_disabled Date.parse('2024-02-02')
- datepicker.expect_disabled Date.parse('2024-02-01')
+ datepicker.show_date "2024-02-05"
+ datepicker.expect_disabled Date.parse("2024-02-05")
+ datepicker.expect_disabled Date.parse("2024-02-04")
+ datepicker.expect_disabled Date.parse("2024-02-03")
+ datepicker.expect_disabled Date.parse("2024-02-02")
+ datepicker.expect_disabled Date.parse("2024-02-01")
datepicker.toggle_ignore_non_working_days
datepicker.expect_ignore_non_working_days true
- datepicker.show_date '2024-02-05'
- datepicker.expect_disabled Date.parse('2024-02-05')
- datepicker.expect_disabled Date.parse('2024-02-04')
- datepicker.expect_disabled Date.parse('2024-02-03')
- datepicker.expect_disabled Date.parse('2024-02-02')
- datepicker.expect_disabled Date.parse('2024-02-01')
+ datepicker.show_date "2024-02-05"
+ datepicker.expect_disabled Date.parse("2024-02-05")
+ datepicker.expect_disabled Date.parse("2024-02-04")
+ datepicker.expect_disabled Date.parse("2024-02-03")
+ datepicker.expect_disabled Date.parse("2024-02-02")
+ datepicker.expect_disabled Date.parse("2024-02-01")
end
end
- context 'if the follower is a task' do
+ context "if the follower is a task" do
let!(:follower) { create(:work_package, type:, project:) }
let!(:relation) { create(:follows_relation, from: follower, to: predecessor) }
let(:date_field) { work_packages_page.edit_field(:combinedDate) }
- it_behaves_like 'keeps the minimum date from the predecessor when toggling NWD'
+ it_behaves_like "keeps the minimum date from the predecessor when toggling NWD"
end
- context 'if the follower is a milestone' do
+ context "if the follower is a milestone" do
let!(:follower) { create(:work_package, type: milestone_type, project:) }
let!(:relation) { create(:follows_relation, from: follower, to: predecessor) }
let(:date_field) { work_packages_page.edit_field(:date) }
- it_behaves_like 'keeps the minimum date from the predecessor when toggling NWD'
+ it_behaves_like "keeps the minimum date from the predecessor when toggling NWD"
end
end
diff --git a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
index 469c3c9ad10f..e4d4cecbf412 100644
--- a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'support/edit_fields/edit_field'
+require "spec_helper"
+require "support/edit_fields/edit_field"
-RSpec.describe 'Datepicker modal logic test cases (WP #43539)', :js, :with_cuprite, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe "Datepicker modal logic test cases (WP #43539)", :js, :with_cuprite, with_settings: { date_format: "%Y-%m-%d" } do
shared_let(:user) { create(:admin) }
shared_let(:type_bug) { create(:type_bug) }
@@ -55,7 +55,7 @@
def apply_and_expect_saved(attributes)
date_field.save!
- work_packages_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')
+ work_packages_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_update")
work_package.reload
@@ -78,33 +78,33 @@ def apply_and_expect_saved(attributes)
datepicker.expect_visible
end
- context 'when only start_date set, updating duration (scenario 1)' do
+ context "when only start_date set, updating duration (scenario 1)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-08'),
+ start_date: Date.parse("2021-02-08"),
due_date: nil,
duration: nil
}
end
- it 'sets finish date' do
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ it "sets finish date" do
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
datepicker.set_duration 10
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date '2021-02-19'
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date "2021-02-19"
datepicker.expect_duration 10
apply_and_expect_saved duration: 10,
- start_date: Date.parse('2021-02-08'),
- due_date: Date.parse('2021-02-19')
+ start_date: Date.parse("2021-02-08"),
+ due_date: Date.parse("2021-02-19")
end
end
- describe 'when no values set, updating duration (scenario 2)' do
+ describe "when no values set, updating duration (scenario 2)" do
let(:current_attributes) do
{
start_date: nil,
@@ -113,15 +113,15 @@ def apply_and_expect_saved(attributes)
}
end
- it 'sets only the duration' do
- datepicker.expect_start_date ''
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ it "sets only the duration" do
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
datepicker.set_duration 10
- datepicker.expect_start_date ''
- datepicker.expect_due_date ''
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date ""
datepicker.expect_duration 10
apply_and_expect_saved duration: 10,
@@ -130,238 +130,238 @@ def apply_and_expect_saved(attributes)
end
end
- describe 'when only due date set, updating duration (scenario 3)' do
+ describe "when only due date set, updating duration (scenario 3)" do
let(:current_attributes) do
{
start_date: nil,
- due_date: Date.parse('2021-02-19'),
+ due_date: Date.parse("2021-02-19"),
duration: nil
}
end
- it 'sets the start date' do
- datepicker.expect_start_date ''
- datepicker.expect_due_date '2021-02-19'
- datepicker.expect_duration ''
+ it "sets the start date" do
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date "2021-02-19"
+ datepicker.expect_duration ""
datepicker.set_duration 10
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date '2021-02-19'
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date "2021-02-19"
datepicker.expect_duration 10
apply_and_expect_saved duration: 10,
- start_date: Date.parse('2021-02-08'),
- due_date: Date.parse('2021-02-19')
+ start_date: Date.parse("2021-02-08"),
+ due_date: Date.parse("2021-02-19")
end
end
- describe 'when all values set, increasing duration (scenario 4)' do
+ describe "when all values set, increasing duration (scenario 4)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-08'),
- due_date: Date.parse('2021-02-19'),
+ start_date: Date.parse("2021-02-08"),
+ due_date: Date.parse("2021-02-19"),
duration: 10
}
end
- it 'updates the finish date to a later date' do
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date '2021-02-19'
+ it "updates the finish date to a later date" do
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date "2021-02-19"
datepicker.expect_duration 10
datepicker.set_duration 11
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date '2021-02-22'
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date "2021-02-22"
datepicker.expect_duration 11
apply_and_expect_saved duration: 11,
- start_date: Date.parse('2021-02-08'),
- due_date: Date.parse('2021-02-22')
+ start_date: Date.parse("2021-02-08"),
+ due_date: Date.parse("2021-02-22")
end
end
- describe 'when all values set, reducing duration (scenario 5)' do
+ describe "when all values set, reducing duration (scenario 5)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-08'),
- due_date: Date.parse('2021-02-22'),
+ start_date: Date.parse("2021-02-08"),
+ due_date: Date.parse("2021-02-22"),
duration: 11
}
end
- it 'updates the finish date to an earlier date' do
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date '2021-02-22'
+ it "updates the finish date to an earlier date" do
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date "2021-02-22"
datepicker.expect_duration 11
datepicker.set_duration 10
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date '2021-02-19'
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date "2021-02-19"
datepicker.expect_duration 10
apply_and_expect_saved duration: 10,
- start_date: Date.parse('2021-02-08'),
- due_date: Date.parse('2021-02-19')
+ start_date: Date.parse("2021-02-08"),
+ due_date: Date.parse("2021-02-19")
end
end
- describe 'when all values set, removing duration (scenario 6)' do
+ describe "when all values set, removing duration (scenario 6)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-09'),
- due_date: Date.parse('2021-02-12'),
+ start_date: Date.parse("2021-02-09"),
+ due_date: Date.parse("2021-02-12"),
duration: 3
}
end
- it 'also unsets the due date' do
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-12'
+ it "also unsets the due date" do
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-12"
datepicker.expect_duration 3
datepicker.clear_duration
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date ''
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date ""
datepicker.expect_duration nil
end
end
- describe 'when all values set, removing duration through icon (scenario 6a)' do
+ describe "when all values set, removing duration through icon (scenario 6a)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-09'),
- due_date: Date.parse('2021-02-12'),
+ start_date: Date.parse("2021-02-09"),
+ due_date: Date.parse("2021-02-12"),
duration: 3
}
end
- it 'also unsets the due date' do
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-12'
+ it "also unsets the due date" do
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-12"
datepicker.expect_duration 3
datepicker.clear_duration_with_icon
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date ''
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date ""
datepicker.expect_duration nil
end
end
- describe 'when all values set, removing duration and setting it again' do
+ describe "when all values set, removing duration and setting it again" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-09'),
- due_date: Date.parse('2021-02-12'),
+ start_date: Date.parse("2021-02-09"),
+ due_date: Date.parse("2021-02-12"),
duration: 3
}
end
- it 'allows re-deriving duration' do
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-12'
+ it "allows re-deriving duration" do
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-12"
datepicker.expect_duration 3
datepicker.clear_duration_with_icon
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date ''
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date ""
datepicker.expect_duration nil
# Now select a date
datepicker.select_day 5
- datepicker.expect_start_date '2021-02-05'
- datepicker.expect_due_date '2021-02-09'
+ datepicker.expect_start_date "2021-02-05"
+ datepicker.expect_due_date "2021-02-09"
datepicker.expect_duration 3
datepicker.clear_duration_with_icon
- datepicker.expect_start_date '2021-02-05'
- datepicker.expect_due_date ''
+ datepicker.expect_start_date "2021-02-05"
+ datepicker.expect_due_date ""
datepicker.expect_duration nil
datepicker.select_day 8
- datepicker.expect_start_date '2021-02-05'
- datepicker.expect_due_date '2021-02-08'
+ datepicker.expect_start_date "2021-02-05"
+ datepicker.expect_due_date "2021-02-08"
datepicker.expect_duration 2
end
end
- describe 'when all values set, changing start date in calendar (scenario 7)' do
+ describe "when all values set, changing start date in calendar (scenario 7)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-08'),
- due_date: Date.parse('2021-02-11'),
+ start_date: Date.parse("2021-02-08"),
+ due_date: Date.parse("2021-02-11"),
duration: 4
}
end
- it 'adjusts the duration' do
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date '2021-02-11'
+ it "adjusts the duration" do
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date "2021-02-11"
datepicker.expect_duration 4
- datepicker.set_start_date '2021-02-09'
+ datepicker.set_start_date "2021-02-09"
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-11'
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-11"
datepicker.expect_duration 3
end
end
# Same as scenario 7, with error state in the middle
- describe 'when all values set, setting the start date to invalid value, then to a valid value' do
+ describe "when all values set, setting the start date to invalid value, then to a valid value" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-08'),
- due_date: Date.parse('2021-02-11'),
+ start_date: Date.parse("2021-02-08"),
+ due_date: Date.parse("2021-02-11"),
duration: 4
}
end
- it 'adjusts the duration' do
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date '2021-02-11'
+ it "adjusts the duration" do
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date "2021-02-11"
datepicker.expect_duration 4
# simulate someone deleting some chars to type a new date
- datepicker.set_start_date '2021-02-'
- datepicker.set_start_date '2021-02-09'
+ datepicker.set_start_date "2021-02-"
+ datepicker.set_start_date "2021-02-09"
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-11'
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-11"
datepicker.expect_duration 3
end
end
- describe 'when all values set, changing due date (scenario 8)' do
+ describe "when all values set, changing due date (scenario 8)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-09'),
- due_date: Date.parse('2021-02-12'),
+ start_date: Date.parse("2021-02-09"),
+ due_date: Date.parse("2021-02-12"),
duration: 4
}
end
- it 'adjusts the duration' do
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-12'
+ it "adjusts the duration" do
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-12"
datepicker.expect_duration 4
- datepicker.set_due_date '2021-02-11'
+ datepicker.set_due_date "2021-02-11"
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-11'
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-11"
datepicker.expect_duration 3
end
end
- describe 'when only duration set, setting finish date (scenario 9)' do
+ describe "when only duration set, setting finish date (scenario 9)" do
let(:current_attributes) do
{
start_date: nil,
@@ -370,86 +370,86 @@ def apply_and_expect_saved(attributes)
}
end
- it 'derives the start date' do
- datepicker.expect_start_date ''
- datepicker.expect_due_date ''
+ it "derives the start date" do
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date ""
datepicker.expect_duration 4
- datepicker.set_due_date '2021-02-12'
+ datepicker.set_due_date "2021-02-12"
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-12'
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-12"
datepicker.expect_duration 4
end
end
- describe 'when only due date set, setting start date (scenario 10)' do
+ describe "when only due date set, setting start date (scenario 10)" do
let(:current_attributes) do
{
start_date: nil,
- due_date: Date.parse('2021-02-11'),
+ due_date: Date.parse("2021-02-11"),
duration: nil
}
end
- it 'derives the duration' do
- datepicker.expect_start_date ''
- datepicker.expect_due_date '2021-02-11'
- datepicker.expect_duration ''
+ it "derives the duration" do
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date "2021-02-11"
+ datepicker.expect_duration ""
- datepicker.set_start_date '2021-02-09'
+ datepicker.set_start_date "2021-02-09"
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-11'
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-11"
datepicker.expect_duration 3
end
end
- describe 'when all values set, changing the start date to the future in the picker (Scenario 13)' do
+ describe "when all values set, changing the start date to the future in the picker (Scenario 13)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-09'),
- due_date: Date.parse('2021-02-11'),
+ start_date: Date.parse("2021-02-09"),
+ due_date: Date.parse("2021-02-11"),
duration: 3
}
end
- it 'unsets the other two values' do
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-11'
+ it "unsets the other two values" do
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-11"
datepicker.expect_duration 3
- datepicker.set_start_date '2021-03-03'
+ datepicker.set_start_date "2021-03-03"
- datepicker.expect_start_date '2021-03-03'
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ datepicker.expect_start_date "2021-03-03"
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
end
end
- describe 'when only finish date set, changing the start date to the future in the picker (Scenario 13 variation)' do
+ describe "when only finish date set, changing the start date to the future in the picker (Scenario 13 variation)" do
let(:current_attributes) do
{
start_date: nil,
- due_date: Date.parse('2021-02-11'),
+ due_date: Date.parse("2021-02-11"),
duration: nil
}
end
- it 'unsets the finish date' do
- datepicker.expect_start_date ''
- datepicker.expect_due_date '2021-02-11'
- datepicker.expect_duration ''
+ it "unsets the finish date" do
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date "2021-02-11"
+ datepicker.expect_duration ""
- datepicker.set_start_date '2021-03-03'
+ datepicker.set_start_date "2021-03-03"
- datepicker.expect_start_date '2021-03-03'
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ datepicker.expect_start_date "2021-03-03"
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
end
end
- describe 'when only start date set, changing the finish date to the past with today (Scenario 13a)' do
+ describe "when only start date set, changing the finish date to the past with today (Scenario 13a)" do
let(:current_attributes) do
{
start_date: 2.days.from_now,
@@ -459,19 +459,19 @@ def apply_and_expect_saved(attributes)
}
end
- it 'unsets the other two values' do
+ it "unsets the other two values" do
datepicker.expect_start_date 2.days.from_now.to_date.iso8601
- datepicker.expect_due_date ''
+ datepicker.expect_due_date ""
datepicker.set_today :due
- datepicker.expect_start_date ''
+ datepicker.expect_start_date ""
datepicker.expect_due_date Time.zone.today.iso8601
- datepicker.expect_duration ''
+ datepicker.expect_duration ""
end
end
- describe 'when all values set, changing the finish date to the past with today (Scenario 13a)' do
+ describe "when all values set, changing the finish date to the past with today (Scenario 13a)" do
let(:current_attributes) do
{
start_date: 2.days.from_now,
@@ -480,396 +480,396 @@ def apply_and_expect_saved(attributes)
}
end
- it 'unsets the other two values' do
+ it "unsets the other two values" do
datepicker.expect_start_date 2.days.from_now.to_date.iso8601
datepicker.expect_due_date 3.days.from_now.to_date.iso8601
datepicker.set_today :due
- datepicker.expect_start_date ''
+ datepicker.expect_start_date ""
datepicker.expect_due_date Time.zone.today.iso8601
- datepicker.expect_duration ''
+ datepicker.expect_duration ""
end
end
- describe 'when all values set, changing the start date to the past in the picker (Scenario 14)' do
+ describe "when all values set, changing the start date to the past in the picker (Scenario 14)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-09'),
- due_date: Date.parse('2021-02-11'),
+ start_date: Date.parse("2021-02-09"),
+ due_date: Date.parse("2021-02-11"),
duration: 3
}
end
- it 'conserves the duration and updates the finish date' do
- datepicker.expect_start_date '2021-02-09'
- datepicker.expect_due_date '2021-02-11'
+ it "conserves the duration and updates the finish date" do
+ datepicker.expect_start_date "2021-02-09"
+ datepicker.expect_due_date "2021-02-11"
datepicker.expect_duration 3
- datepicker.set_start_date '2021-02-03'
+ datepicker.set_start_date "2021-02-03"
- datepicker.expect_start_date '2021-02-03'
- datepicker.expect_due_date '2021-02-05'
+ datepicker.expect_start_date "2021-02-03"
+ datepicker.expect_due_date "2021-02-05"
datepicker.expect_duration 3
end
end
- describe 'when all values set, changing include NWD to true (Scenario 15)' do
+ describe "when all values set, changing include NWD to true (Scenario 15)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-11'),
- due_date: Date.parse('2021-02-16'),
+ start_date: Date.parse("2021-02-11"),
+ due_date: Date.parse("2021-02-16"),
duration: 4
}
end
- it 'conserves the duration and updates the finish date' do
- datepicker.expect_start_date '2021-02-11'
- datepicker.expect_due_date '2021-02-16'
+ it "conserves the duration and updates the finish date" do
+ datepicker.expect_start_date "2021-02-11"
+ datepicker.expect_due_date "2021-02-16"
datepicker.expect_duration 4
datepicker.toggle_ignore_non_working_days
- datepicker.expect_start_date '2021-02-11'
- datepicker.expect_due_date '2021-02-14'
+ datepicker.expect_start_date "2021-02-11"
+ datepicker.expect_due_date "2021-02-14"
datepicker.expect_duration 4
end
end
- describe 'when all values set and include NWD true, changing include NWD to false (Scenario 16)' do
+ describe "when all values set and include NWD true, changing include NWD to false (Scenario 16)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-11'),
- due_date: Date.parse('2021-02-14'),
+ start_date: Date.parse("2021-02-11"),
+ due_date: Date.parse("2021-02-14"),
duration: 4,
ignore_non_working_days: true
}
end
- it 'conserves the duration and updates the finish date' do
- datepicker.expect_start_date '2021-02-11'
- datepicker.expect_due_date '2021-02-14'
+ it "conserves the duration and updates the finish date" do
+ datepicker.expect_start_date "2021-02-11"
+ datepicker.expect_due_date "2021-02-14"
datepicker.expect_duration 4
datepicker.expect_ignore_non_working_days true
datepicker.toggle_ignore_non_working_days
datepicker.expect_ignore_non_working_days false
- datepicker.expect_start_date '2021-02-11'
- datepicker.expect_due_date '2021-02-16'
+ datepicker.expect_start_date "2021-02-11"
+ datepicker.expect_due_date "2021-02-16"
datepicker.expect_duration 4
end
end
- describe 'when all values set and include NWD true, changing include NWD to false (Scenario 17)' do
+ describe "when all values set and include NWD true, changing include NWD to false (Scenario 17)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-13'),
- due_date: Date.parse('2021-02-14'),
+ start_date: Date.parse("2021-02-13"),
+ due_date: Date.parse("2021-02-14"),
duration: 2,
ignore_non_working_days: true
}
end
- it 'shifts the start date to soonest working day, and updates finish date to conserve duration' do
- datepicker.expect_start_date '2021-02-13'
- datepicker.expect_due_date '2021-02-14'
+ it "shifts the start date to soonest working day, and updates finish date to conserve duration" do
+ datepicker.expect_start_date "2021-02-13"
+ datepicker.expect_due_date "2021-02-14"
datepicker.expect_duration 2
datepicker.expect_ignore_non_working_days true
datepicker.toggle_ignore_non_working_days
datepicker.expect_ignore_non_working_days false
- datepicker.expect_start_date '2021-02-15'
- datepicker.expect_due_date '2021-02-16'
+ datepicker.expect_start_date "2021-02-15"
+ datepicker.expect_due_date "2021-02-16"
datepicker.expect_duration 2
end
end
- describe 'when all values set and include NWD true, changing include NWD to false (Scenario 18)' do
+ describe "when all values set and include NWD true, changing include NWD to false (Scenario 18)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-13'),
- due_date: Date.parse('2021-02-23'),
+ start_date: Date.parse("2021-02-13"),
+ due_date: Date.parse("2021-02-23"),
duration: 11,
ignore_non_working_days: true
}
end
- it 'shifts the start date to soonest working day, and updates finish date to conserve duration' do
- datepicker.expect_start_date '2021-02-13'
- datepicker.expect_due_date '2021-02-23'
+ it "shifts the start date to soonest working day, and updates finish date to conserve duration" do
+ datepicker.expect_start_date "2021-02-13"
+ datepicker.expect_due_date "2021-02-23"
datepicker.expect_duration 11
datepicker.expect_ignore_non_working_days true
datepicker.toggle_ignore_non_working_days
datepicker.expect_ignore_non_working_days false
- datepicker.expect_start_date '2021-02-15'
- datepicker.expect_due_date '2021-03-01'
+ datepicker.expect_start_date "2021-02-15"
+ datepicker.expect_due_date "2021-03-01"
datepicker.expect_duration 11
apply_and_expect_saved duration: 11,
- start_date: Date.parse('2021-02-15'),
- due_date: Date.parse('2021-03-01'),
+ start_date: Date.parse("2021-02-15"),
+ due_date: Date.parse("2021-03-01"),
ignore_non_working_days: false
end
end
- describe 'when only start date set and include NWD true, changing include NWD to false (Scenario 19)' do
+ describe "when only start date set and include NWD true, changing include NWD to false (Scenario 19)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-13'),
+ start_date: Date.parse("2021-02-13"),
due_date: nil,
duration: nil,
ignore_non_working_days: true
}
end
- it 'shifts the start date to soonest working day' do
- datepicker.expect_start_date '2021-02-13'
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ it "shifts the start date to soonest working day" do
+ datepicker.expect_start_date "2021-02-13"
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
datepicker.expect_ignore_non_working_days true
datepicker.toggle_ignore_non_working_days
datepicker.expect_ignore_non_working_days false
- datepicker.expect_start_date '2021-02-15'
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ datepicker.expect_start_date "2021-02-15"
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
apply_and_expect_saved duration: nil,
- start_date: Date.parse('2021-02-15'),
+ start_date: Date.parse("2021-02-15"),
due_date: nil,
ignore_non_working_days: false
end
end
- describe 'when only finish date set and include NWD true, changing include NWD to false (Scenario 20)' do
+ describe "when only finish date set and include NWD true, changing include NWD to false (Scenario 20)" do
let(:current_attributes) do
{
start_date: nil,
- due_date: Date.parse('2021-02-21'),
+ due_date: Date.parse("2021-02-21"),
duration: nil,
ignore_non_working_days: true
}
end
- it 'shifts the finish date to soonest working day' do
- datepicker.expect_start_date ''
- datepicker.expect_due_date '2021-02-21'
- datepicker.expect_duration ''
+ it "shifts the finish date to soonest working day" do
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date "2021-02-21"
+ datepicker.expect_duration ""
datepicker.expect_ignore_non_working_days true
datepicker.toggle_ignore_non_working_days
datepicker.expect_ignore_non_working_days false
- datepicker.expect_start_date ''
- datepicker.expect_due_date '2021-02-22'
- datepicker.expect_duration ''
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date "2021-02-22"
+ datepicker.expect_duration ""
apply_and_expect_saved duration: nil,
start_date: nil,
- due_date: Date.parse('2021-02-22'),
+ due_date: Date.parse("2021-02-22"),
ignore_non_working_days: false
end
end
- describe 'When all values set, clear the start date (Scenario 21a)' do
+ describe "When all values set, clear the start date (Scenario 21a)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-20'),
- due_date: Date.parse('2021-02-21'),
+ start_date: Date.parse("2021-02-20"),
+ due_date: Date.parse("2021-02-21"),
duration: 1,
ignore_non_working_days: true
}
end
- it 'also removes duration, but keeps finish date' do
- datepicker.expect_start_date '2021-02-20'
- datepicker.expect_due_date '2021-02-21'
+ it "also removes duration, but keeps finish date" do
+ datepicker.expect_start_date "2021-02-20"
+ datepicker.expect_due_date "2021-02-21"
datepicker.expect_duration 1
datepicker.expect_ignore_non_working_days true
- datepicker.set_start_date ''
- datepicker.expect_duration ''
- datepicker.expect_due_date '2021-02-21'
+ datepicker.set_start_date ""
+ datepicker.expect_duration ""
+ datepicker.expect_due_date "2021-02-21"
apply_and_expect_saved duration: nil,
start_date: nil,
- due_date: Date.parse('2021-02-21'),
+ due_date: Date.parse("2021-02-21"),
ignore_non_working_days: true
end
end
- describe 'When all values set, clear the due date (Scenario 21b)' do
+ describe "When all values set, clear the due date (Scenario 21b)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-20'),
- due_date: Date.parse('2021-02-21'),
+ start_date: Date.parse("2021-02-20"),
+ due_date: Date.parse("2021-02-21"),
duration: 1,
ignore_non_working_days: true
}
end
- it 'also removes duration, but keeps start date' do
- datepicker.expect_start_date '2021-02-20'
- datepicker.expect_due_date '2021-02-21'
+ it "also removes duration, but keeps start date" do
+ datepicker.expect_start_date "2021-02-20"
+ datepicker.expect_due_date "2021-02-21"
datepicker.expect_duration 1
datepicker.expect_ignore_non_working_days true
- datepicker.set_due_date ''
- datepicker.expect_duration ''
- datepicker.expect_start_date '2021-02-20'
+ datepicker.set_due_date ""
+ datepicker.expect_duration ""
+ datepicker.expect_start_date "2021-02-20"
apply_and_expect_saved duration: nil,
- start_date: Date.parse('2021-02-20'),
+ start_date: Date.parse("2021-02-20"),
due_date: nil,
ignore_non_working_days: true
end
end
- describe 'When only start date set, duration in focus, select earlier date (Scenario 22a)' do
+ describe "When only start date set, duration in focus, select earlier date (Scenario 22a)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-18'),
+ start_date: Date.parse("2021-02-18"),
due_date: nil,
duration: nil,
ignore_non_working_days: true
}
end
- it 'sets start date to selected value, finish date to start date' do
- datepicker.expect_start_date '2021-02-18'
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ it "sets start date to selected value, finish date to start date" do
+ datepicker.expect_start_date "2021-02-18"
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
datepicker.focus_duration
datepicker.expect_duration_highlighted
datepicker.select_day 17
- datepicker.expect_start_date '2021-02-17'
- datepicker.expect_due_date '2021-02-18'
+ datepicker.expect_start_date "2021-02-17"
+ datepicker.expect_due_date "2021-02-18"
datepicker.expect_duration 2
datepicker.expect_start_highlighted
apply_and_expect_saved duration: 2,
- start_date: Date.parse('2021-02-17'),
- due_date: Date.parse('2021-02-18'),
+ start_date: Date.parse("2021-02-17"),
+ due_date: Date.parse("2021-02-18"),
ignore_non_working_days: true
end
end
- describe 'When only start date set, duration in focus, select later date (Scenario 22b)' do
+ describe "When only start date set, duration in focus, select later date (Scenario 22b)" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-18'),
+ start_date: Date.parse("2021-02-18"),
due_date: nil,
duration: nil,
ignore_non_working_days: true
}
end
- it 'sets finish date to selected date' do
- datepicker.expect_start_date '2021-02-18'
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ it "sets finish date to selected date" do
+ datepicker.expect_start_date "2021-02-18"
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
datepicker.focus_duration
datepicker.expect_duration_highlighted
datepicker.select_day 19
- datepicker.expect_start_date '2021-02-18'
- datepicker.expect_due_date '2021-02-19'
+ datepicker.expect_start_date "2021-02-18"
+ datepicker.expect_due_date "2021-02-19"
datepicker.expect_duration 2
datepicker.expect_start_highlighted
apply_and_expect_saved duration: 2,
- start_date: Date.parse('2021-02-18'),
- due_date: Date.parse('2021-02-19'),
+ start_date: Date.parse("2021-02-18"),
+ due_date: Date.parse("2021-02-19"),
ignore_non_working_days: true
end
end
- describe 'When only due date set, duration in focus, select later date (Scenario 23a)' do
+ describe "When only due date set, duration in focus, select later date (Scenario 23a)" do
let(:current_attributes) do
{
start_date: nil,
- due_date: Date.parse('2021-02-18'),
+ due_date: Date.parse("2021-02-18"),
duration: nil,
ignore_non_working_days: true
}
end
- it 'sets due date to selected value, start to finish date, focus on start' do
- datepicker.expect_start_date ''
- datepicker.expect_due_date '2021-02-18'
- datepicker.expect_duration ''
+ it "sets due date to selected value, start to finish date, focus on start" do
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date "2021-02-18"
+ datepicker.expect_duration ""
datepicker.focus_duration
datepicker.expect_duration_highlighted
datepicker.select_day 19
- datepicker.expect_start_date '2021-02-18'
- datepicker.expect_due_date '2021-02-19'
+ datepicker.expect_start_date "2021-02-18"
+ datepicker.expect_due_date "2021-02-19"
datepicker.expect_duration 2
datepicker.expect_start_highlighted
apply_and_expect_saved duration: 2,
- start_date: Date.parse('2021-02-18'),
- due_date: Date.parse('2021-02-19'),
+ start_date: Date.parse("2021-02-18"),
+ due_date: Date.parse("2021-02-19"),
ignore_non_working_days: true
end
end
- describe 'When only due date set, duration in focus, select earlier date (Scenario 23b)' do
+ describe "When only due date set, duration in focus, select earlier date (Scenario 23b)" do
let(:current_attributes) do
{
start_date: nil,
- due_date: Date.parse('2021-02-18'),
+ due_date: Date.parse("2021-02-18"),
duration: nil,
ignore_non_working_days: true
}
end
- it 'sets start date to selected date' do
- datepicker.expect_start_date ''
- datepicker.expect_due_date '2021-02-18'
- datepicker.expect_duration ''
+ it "sets start date to selected date" do
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date "2021-02-18"
+ datepicker.expect_duration ""
datepicker.focus_duration
datepicker.expect_duration_highlighted
datepicker.select_day 17
- datepicker.expect_start_date '2021-02-17'
- datepicker.expect_due_date '2021-02-18'
+ datepicker.expect_start_date "2021-02-17"
+ datepicker.expect_due_date "2021-02-18"
datepicker.expect_duration 2
datepicker.expect_start_highlighted
apply_and_expect_saved duration: 2,
- start_date: Date.parse('2021-02-17'),
- due_date: Date.parse('2021-02-18'),
+ start_date: Date.parse("2021-02-17"),
+ due_date: Date.parse("2021-02-18"),
ignore_non_working_days: true
end
end
- describe 'when all values set and duration highlighted, selecting date in datepicker' do
+ describe "when all values set and duration highlighted, selecting date in datepicker" do
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-08'),
- due_date: Date.parse('2021-02-11'),
+ start_date: Date.parse("2021-02-08"),
+ due_date: Date.parse("2021-02-11"),
duration: 4
}
end
- it 'sets start to the selected value, keeps finish date' do
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date '2021-02-11'
+ it "sets start to the selected value, keeps finish date" do
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date "2021-02-11"
datepicker.expect_duration 4
# Focus duration
@@ -879,25 +879,25 @@ def apply_and_expect_saved(attributes)
# Select date in datepicker
datepicker.select_day 5
- datepicker.expect_start_date '2021-02-05'
- datepicker.expect_due_date '2021-02-10'
+ datepicker.expect_start_date "2021-02-05"
+ datepicker.expect_due_date "2021-02-10"
datepicker.expect_duration 4
# Focus is on start date
datepicker.expect_due_highlighted
datepicker.select_day 15
- datepicker.expect_start_date '2021-02-05'
- datepicker.expect_due_date '2021-02-15'
+ datepicker.expect_start_date "2021-02-05"
+ datepicker.expect_due_date "2021-02-15"
datepicker.expect_duration 7
apply_and_expect_saved duration: 7,
- start_date: Date.parse('2021-02-05'),
- due_date: Date.parse('2021-02-15')
+ start_date: Date.parse("2021-02-05"),
+ due_date: Date.parse("2021-02-15")
end
end
- describe 'when all values set and duration highlighted, selecting dates in datepicker' do
+ describe "when all values set and duration highlighted, selecting dates in datepicker" do
let(:current_attributes) do
{
start_date: nil,
@@ -906,98 +906,98 @@ def apply_and_expect_saved(attributes)
}
end
- it 'sets start to the selected value, moves to finish date' do
- datepicker.expect_start_date ''
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ it "sets start to the selected value, moves to finish date" do
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
# Focus duration
datepicker.duration_field.click
datepicker.expect_duration_highlighted
# Select date in datepicker
- datepicker.set_start_date Date.parse('2021-02-05')
+ datepicker.set_start_date Date.parse("2021-02-05")
- datepicker.expect_start_date '2021-02-05'
+ datepicker.expect_start_date "2021-02-05"
datepicker.expect_due_highlighted
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
datepicker.select_day 9
- datepicker.expect_start_date '2021-02-05'
- datepicker.expect_due_date '2021-02-09'
+ datepicker.expect_start_date "2021-02-05"
+ datepicker.expect_due_date "2021-02-09"
datepicker.expect_duration 3
apply_and_expect_saved duration: 3,
- start_date: Date.parse('2021-02-05'),
- due_date: Date.parse('2021-02-09')
+ start_date: Date.parse("2021-02-05"),
+ due_date: Date.parse("2021-02-09")
end
end
- context 'when setting ignore NWD to true for a milestone' do
+ context "when setting ignore NWD to true for a milestone" do
let(:date_attribute) { :date }
let(:work_package) { milestone_wp }
let(:current_attributes) do
{
- start_date: '2022-06-20',
- due_date: '2022-06-20',
+ start_date: "2022-06-20",
+ due_date: "2022-06-20",
ignore_non_working_days: false
}
end
- it 'allows to persist that value (Regression #43932)' do
- datepicker.expect_milestone_date '2022-06-20'
+ it "allows to persist that value (Regression #43932)" do
+ datepicker.expect_milestone_date "2022-06-20"
datepicker.expect_ignore_non_working_days false
datepicker.toggle_ignore_non_working_days
datepicker.expect_ignore_non_working_days true
- datepicker.expect_milestone_date '2022-06-20'
+ datepicker.expect_milestone_date "2022-06-20"
# Set date to sunday
- datepicker.set_milestone_date '2022-06-19'
- apply_and_expect_saved start_date: Date.parse('2022-06-19'),
- due_date: Date.parse('2022-06-19'),
+ datepicker.set_milestone_date "2022-06-19"
+ apply_and_expect_saved start_date: Date.parse("2022-06-19"),
+ due_date: Date.parse("2022-06-19"),
ignore_non_working_days: true
end
end
- context 'when setting scheduleManually to true for a milestone' do
+ context "when setting scheduleManually to true for a milestone" do
let(:date_attribute) { :date }
let(:work_package) { milestone_wp }
let(:current_attributes) do
{
- start_date: '2022-06-20',
- due_date: '2022-06-20',
+ start_date: "2022-06-20",
+ due_date: "2022-06-20",
schedule_manually: false
}
end
- it 'allows to persist that value (Regression #46721)' do
- datepicker.expect_milestone_date '2022-06-20'
+ it "allows to persist that value (Regression #46721)" do
+ datepicker.expect_milestone_date "2022-06-20"
datepicker.expect_scheduling_mode false
datepicker.toggle_scheduling_mode
datepicker.expect_scheduling_mode true
- datepicker.expect_milestone_date '2022-06-20'
+ datepicker.expect_milestone_date "2022-06-20"
- apply_and_expect_saved start_date: Date.parse('2022-06-20'),
- due_date: Date.parse('2022-06-20'),
+ apply_and_expect_saved start_date: Date.parse("2022-06-20"),
+ due_date: Date.parse("2022-06-20"),
schedule_manually: true
date_field.activate!
date_field.expect_active!
datepicker.expect_visible
- datepicker.expect_milestone_date '2022-06-20'
+ datepicker.expect_milestone_date "2022-06-20"
datepicker.expect_scheduling_mode true
end
end
- context 'when setting start and due date through today links' do
+ context "when setting start and due date through today links" do
let(:current_attributes) do
{
start_date: nil,
@@ -1007,20 +1007,20 @@ def apply_and_expect_saved(attributes)
}
end
- it 'allows to persist that value (Regression #44140)' do
- datepicker.expect_start_date ''
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ it "allows to persist that value (Regression #44140)" do
+ datepicker.expect_start_date ""
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
today = Time.zone.today
today_str = today.iso8601
# Setting start will set active to due
- datepicker.set_today 'start'
+ datepicker.set_today "start"
datepicker.expect_start_date today_str
datepicker.expect_due_highlighted
- datepicker.set_today 'due'
+ datepicker.set_today "due"
datepicker.expect_due_date today_str
datepicker.expect_start_highlighted
@@ -1032,32 +1032,32 @@ def apply_and_expect_saved(attributes)
end
end
- context 'when the user locale has a custom digit map' do
+ context "when the user locale has a custom digit map" do
let(:current_user) { create(:admin, language: :ar) }
let(:current_attributes) do
{
- start_date: Date.parse('2021-02-08'),
+ start_date: Date.parse("2021-02-08"),
due_date: nil,
duration: nil
}
end
- it 'still renders the traditional Arabic numbers without errors' do
+ it "still renders the traditional Arabic numbers without errors" do
work_packages_page.expect_no_toaster(type: :error, message: "is not a valid date.")
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date ''
- datepicker.expect_duration ''
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date ""
+ datepicker.expect_duration ""
datepicker.set_duration 10
- datepicker.expect_start_date '2021-02-08'
- datepicker.expect_due_date '2021-02-19'
+ datepicker.expect_start_date "2021-02-08"
+ datepicker.expect_due_date "2021-02-19"
datepicker.expect_duration 10
apply_and_expect_saved duration: 10,
- start_date: Date.parse('2021-02-08'),
- due_date: Date.parse('2021-02-19')
+ start_date: Date.parse("2021-02-08"),
+ due_date: Date.parse("2021-02-19")
end
end
end
diff --git a/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb b/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb
index a5e34ae11ebe..939287fcba12 100644
--- a/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb
@@ -26,11 +26,11 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'support/edit_fields/edit_field'
+require "spec_helper"
+require "support/edit_fields/edit_field"
-RSpec.describe 'Datepicker modal individual non working days (WP #44453)', :js,
- with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe "Datepicker modal individual non working days (WP #44453)", :js,
+ with_settings: { date_format: "%Y-%m-%d" } do
shared_let(:user) { create(:admin) }
shared_let(:project) { create(:project) }
@@ -51,12 +51,12 @@
date: Time.zone.today.end_of_year.next_occurring(:tuesday))
end
- shared_examples 'shows individual non working days' do
+ shared_examples "shows individual non working days" do
let(:work_packages_page) { Pages::FullWorkPackage.new(work_package, project) }
let(:date_field) { work_packages_page.edit_field(date_attribute) }
let(:datepicker) { date_field.datepicker }
- it 'loads and shows individual non working days when navigating' do
+ it "loads and shows individual non working days when navigating" do
login_as user
work_packages_page.visit!
@@ -76,17 +76,17 @@
end
end
- context 'for multi date work package' do
+ context "for multi date work package" do
let(:work_package) { bug_wp }
let(:date_attribute) { :combinedDate }
- it_behaves_like 'shows individual non working days'
+ it_behaves_like "shows individual non working days"
end
- context 'for milestone work package' do
+ context "for milestone work package" do
let(:work_package) { milestone_wp }
let(:date_attribute) { :date }
- it_behaves_like 'shows individual non working days'
+ it_behaves_like "shows individual non working days"
end
end
diff --git a/spec/features/work_packages/datepicker/datepicker_parent_spec.rb b/spec/features/work_packages/datepicker/datepicker_parent_spec.rb
index 1aa18d14b625..7d9d9c3494fe 100644
--- a/spec/features/work_packages/datepicker/datepicker_parent_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_parent_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'support/edit_fields/edit_field'
+require "spec_helper"
+require "support/edit_fields/edit_field"
-RSpec.describe 'Datepicker logic on parents', :js, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe "Datepicker logic on parents", :js, with_settings: { date_format: "%Y-%m-%d" } do
shared_let(:user) { create(:admin) }
# assume sat+sun are non working days
@@ -62,16 +62,16 @@
datepicker.expect_visible
end
- context 'with the child having set dates' do
+ context "with the child having set dates" do
let(:child_attributes) do
{
- start_date: '2021-02-01',
- due_date: '2021-02-02',
+ start_date: "2021-02-01",
+ due_date: "2021-02-02",
ignore_non_working_days: true
}
end
- it 'disables the non working days options' do
+ it "disables the non working days options" do
datepicker.expect_ignore_non_working_days_disabled
datepicker.expect_scheduling_mode false
diff --git a/spec/features/work_packages/details/closed_status_and_version_spec.rb b/spec/features/work_packages/details/closed_status_and_version_spec.rb
index 46293fc9c65e..6f3bef669265 100644
--- a/spec/features/work_packages/details/closed_status_and_version_spec.rb
+++ b/spec/features/work_packages/details/closed_status_and_version_spec.rb
@@ -1,12 +1,12 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Closed status and version in full view', :js do
+RSpec.describe "Closed status and version in full view", :js do
let(:type) { create(:type) }
let(:status) { create(:closed_status) }
let(:project) { create(:project, types: [type]) }
- let(:version) { create(:version, status: 'closed', project:) }
+ let(:version) { create(:version, status: "closed", project:) }
let(:work_package) { create(:work_package, project:, status:, version:) }
let(:wp_page) { Pages::FullWorkPackage.new(work_package, project) }
@@ -17,13 +17,13 @@
wp_page.visit!
end
- it 'shows a warning when trying to edit status' do
+ it "shows a warning when trying to edit status" do
# Should be initially editable (due to non specific schema)
status = page.find("#{test_selector('op-wp-status-button')} button:not([disabled])")
status.click
wp_page.expect_and_dismiss_toaster type: :error,
- message: I18n.t('js.work_packages.message_work_package_status_blocked')
+ message: I18n.t("js.work_packages.message_work_package_status_blocked")
expect(page).to have_css("#{test_selector('op-wp-status-button')} button[disabled]")
end
diff --git a/spec/features/work_packages/details/context_menu_spec.rb b/spec/features/work_packages/details/context_menu_spec.rb
index 54cab9a7b520..1620d50c1afc 100644
--- a/spec/features/work_packages/details/context_menu_spec.rb
+++ b/spec/features/work_packages/details/context_menu_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package single context menu', :js do
+RSpec.describe "Work package single context menu", :js do
let(:user) { create(:admin) }
let(:work_package) { create(:work_package) }
@@ -9,18 +9,18 @@
before do
login_as(user)
wp_view.visit!
- find('#action-show-more-dropdown-menu .button').click
+ find("#action-show-more-dropdown-menu .button").click
end
- it 'sets the correct copy project link' do
- find('.menu-item', text: 'Copy to other project', exact_text: true).click
- expect(page).to have_css('h2', text: I18n.t(:button_copy))
- expect(page).to have_css('a.work_package', text: "##{work_package.id}")
+ it "sets the correct copy project link" do
+ find(".menu-item", text: "Copy to other project", exact_text: true).click
+ expect(page).to have_css("h2", text: I18n.t(:button_copy))
+ expect(page).to have_css("a.work_package", text: "##{work_package.id}")
expect(page).to have_current_path /work_packages\/move\/new\?copy=true&ids\[\]=#{work_package.id}/
end
- it 'successfully copies the short url of the work package' do
- find('.menu-item', text: 'Copy link to clipboard', exact_text: true).click
+ it "successfully copies the short url of the work package" do
+ find(".menu-item", text: "Copy link to clipboard", exact_text: true).click
# We cannot access the navigator.clipboard from a headless browser.
# This test makes sure the copy to clipboard logic is working,
diff --git a/spec/features/work_packages/details/custom_fields/custom_field_spec.rb b/spec/features/work_packages/details/custom_fields/custom_field_spec.rb
index 5ce3fc766c47..7443dc0953b3 100644
--- a/spec/features/work_packages/details/custom_fields/custom_field_spec.rb
+++ b/spec/features/work_packages/details/custom_fields/custom_field_spec.rb
@@ -1,8 +1,8 @@
-require 'spec_helper'
-require 'features/work_packages/work_packages_page'
-require 'features/work_packages/details/inplace_editor/shared_examples'
+require "spec_helper"
+require "features/work_packages/work_packages_page"
+require "features/work_packages/details/inplace_editor/shared_examples"
-RSpec.describe 'custom field inplace editor', :js do
+RSpec.describe "custom field inplace editor", :js do
let(:user) { create(:admin) }
let(:type) { create(:type_standard, custom_fields:) }
let(:project) do
@@ -33,19 +33,19 @@ def expect_update(value, update_args)
wp_field = update_args.delete(:field) { field }
wp_field.set_value value
- wp_field.submit_by_enter if wp_field.field_type == 'input'
+ wp_field.submit_by_enter if wp_field.field_type == "input"
wp_page.expect_toast(**update_args)
wp_page.dismiss_toaster!
end
- describe 'long text' do
+ describe "long text" do
let(:custom_field) do
- create(:issue_custom_field, :text, name: 'LongText')
+ create(:issue_custom_field, :text, name: "LongText")
end
let(:field) { TextEditorField.new wp_page, property_name }
- let(:initial_custom_values) { { custom_field.id => 'foo' } }
+ let(:initial_custom_values) { { custom_field.id => "foo" } }
- it 'can cancel through the button only' do
+ it "can cancel through the button only" do
# Activate the field
field.activate!
@@ -58,11 +58,11 @@ def expect_update(value, update_args)
field.expect_inactive!
end
- it_behaves_like 'a workpackage autocomplete field'
- it_behaves_like 'not a principal autocomplete field'
+ it_behaves_like "a workpackage autocomplete field"
+ it_behaves_like "not a principal autocomplete field"
end
- describe 'custom field lists' do
+ describe "custom field lists" do
let(:custom_field1) do
create(:list_wp_custom_field,
is_required: false,
@@ -77,12 +77,12 @@ def expect_update(value, update_args)
let(:custom_fields) { [custom_field1, custom_field2] }
let(:field1) do
f = wp_page.custom_edit_field(custom_field1)
- f.field_type = 'create-autocompleter'
+ f.field_type = "create-autocompleter"
f
end
let(:field2) do
f = wp_page.custom_edit_field(custom_field2)
- f.field_type = 'create-autocompleter'
+ f.field_type = "create-autocompleter"
f
end
let(:initial_custom_values) { {} }
@@ -91,98 +91,98 @@ def custom_value(value)
CustomOption.find_by(value:).try(:id)
end
- it 'properly updates both values' do
+ it "properly updates both values" do
field1.activate!
- expect_update 'bar',
- message: I18n.t('js.notice_successful_update'),
+ expect_update "bar",
+ message: I18n.t("js.notice_successful_update"),
field: field1
field2.activate!
- expect_update 'Y',
- message: I18n.t('js.notice_successful_update'),
+ expect_update "Y",
+ message: I18n.t("js.notice_successful_update"),
field: field2
- wp_page.expect_attributes "customField#{custom_field1.id}": 'bar',
- "customField#{custom_field2.id}": 'Y'
+ wp_page.expect_attributes "customField#{custom_field1.id}": "bar",
+ "customField#{custom_field2.id}": "Y"
field1.activate!
- expect(field1.input_element).to have_text 'bar'
+ expect(field1.input_element).to have_text "bar"
field1.cancel_by_escape
field2.activate!
- expect(field2.input_element).to have_text 'Y'
+ expect(field2.input_element).to have_text "Y"
- expect_update 'X',
- message: I18n.t('js.notice_successful_update'),
+ expect_update "X",
+ message: I18n.t("js.notice_successful_update"),
field: field2
- wp_page.expect_attributes "customField#{custom_field1.id}": 'bar',
- "customField#{custom_field2.id}": 'X'
+ wp_page.expect_attributes "customField#{custom_field1.id}": "bar",
+ "customField#{custom_field2.id}": "X"
end
end
- describe 'integer type' do
+ describe "integer type" do
let(:custom_field) do
- create(:issue_custom_field, :integer, args.merge(name: 'MyNumber'))
+ create(:issue_custom_field, :integer, args.merge(name: "MyNumber"))
end
let(:initial_custom_values) { { custom_field.id => 123 } }
- context 'with length restrictions' do
+ context "with length restrictions" do
let(:args) do
{ min_length: 2, max_length: 5 }
end
- it 'renders errors for invalid entries' do
+ it "renders errors for invalid entries" do
field.activate!
# exceeding max length
- expect_update '123456',
+ expect_update "123456",
type: :error,
- message: 'MyNumber is too long (maximum is 5 characters).'
+ message: "MyNumber is too long (maximum is 5 characters)."
# below min length
- expect_update '1',
+ expect_update "1",
type: :error,
- message: 'MyNumber is too short (minimum is 2 characters).'
+ message: "MyNumber is too short (minimum is 2 characters)."
# Correct value
- expect_update '9999',
- message: I18n.t('js.notice_successful_update')
- wp_page.expect_attributes property_name => '9999'
+ expect_update "9999",
+ message: I18n.t("js.notice_successful_update")
+ wp_page.expect_attributes property_name => "9999"
end
end
- context 'with no restrictions' do
+ context "with no restrictions" do
let(:args) { {} }
- it 'renders errors for invalid entries' do
+ it "renders errors for invalid entries" do
# Valid input
field.activate!
- expect_update '9999999999',
- message: I18n.t('js.notice_successful_update')
- wp_page.expect_attributes property_name => '9999999999'
+ expect_update "9999999999",
+ message: I18n.t("js.notice_successful_update")
+ wp_page.expect_attributes property_name => "9999999999"
# Remove value
field.activate!
- expect_update '',
- message: I18n.t('js.notice_successful_update')
- wp_page.expect_attributes property_name => '-'
+ expect_update "",
+ message: I18n.t("js.notice_successful_update")
+ wp_page.expect_attributes property_name => "-"
# Zero value
field.activate_edition
- expect_update '0',
- message: I18n.t('js.notice_successful_update')
- wp_page.expect_attributes property_name => '0'
+ expect_update "0",
+ message: I18n.t("js.notice_successful_update")
+ wp_page.expect_attributes property_name => "0"
end
end
- context 'when required' do
+ context "when required" do
let(:args) { { is_required: true } }
- it 'renders errors for invalid entries' do
+ it "renders errors for invalid entries" do
# Invalid input (non-digit)
field.activate!
- field.set_value ''
+ field.set_value ""
field.expect_invalid
field.save!
@@ -193,43 +193,43 @@ def custom_value(value)
end
end
- describe 'float type' do
+ describe "float type" do
let(:custom_field) do
- create(:float_wp_custom_field, args.merge(name: 'MyFloat'))
+ create(:float_wp_custom_field, args.merge(name: "MyFloat"))
end
let(:args) { {} }
let(:initial_custom_values) { { custom_field.id => 123.50 } }
- context 'with zero value' do
- let(:user) { create(:admin, language: 'en') }
+ context "with zero value" do
+ let(:user) { create(:admin, language: "en") }
let(:initial_custom_values) { { custom_field.id => 0 } }
- it 'displays the zero (Regression #37157)' do
- field.expect_state_text '0'
+ it "displays the zero (Regression #37157)" do
+ field.expect_state_text "0"
end
end
- context 'with english locale' do
- let(:user) { create(:admin, language: 'en') }
+ context "with english locale" do
+ let(:user) { create(:admin, language: "en") }
- it 'displays the float with english locale and allows editing' do
- field.expect_state_text '123.5'
- field.update '10000.55'
- field.expect_state_text '10,000.55'
+ it "displays the float with english locale and allows editing" do
+ field.expect_state_text "123.5"
+ field.update "10000.55"
+ field.expect_state_text "10,000.55"
work_package.reload
expect(work_package.custom_value_for(custom_field.id).typed_value).to eq 10000.55
end
end
- context 'with german locale',
+ context "with german locale",
driver: :firefox_de do
- let(:user) { create(:admin, language: 'de') }
+ let(:user) { create(:admin, language: "de") }
- it 'displays the float with german locale and allows editing' do
- field.expect_state_text '123,5'
- field.update '10000,55'
- field.expect_state_text '10.000,55'
+ it "displays the float with german locale and allows editing" do
+ field.expect_state_text "123,5"
+ field.update "10000,55"
+ field.expect_state_text "10.000,55"
work_package.reload
expect(work_package.custom_value_for(custom_field.id).typed_value).to eq 10000.55
diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rb
index b0556bad4ffc..fddcd03c5d20 100644
--- a/spec/features/work_packages/details/date_editor_spec.rb
+++ b/spec/features/work_packages/details/date_editor_spec.rb
@@ -26,14 +26,14 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/page_objects/notification'
-require 'features/work_packages/details/inplace_editor/shared_examples'
-require 'features/work_packages/shared_contexts'
-require 'support/edit_fields/edit_field'
-require 'features/work_packages/work_packages_page'
-
-RSpec.describe 'date inplace editor', :js, :selenium, with_settings: { date_format: '%Y-%m-%d' } do
+require "spec_helper"
+require "features/page_objects/notification"
+require "features/work_packages/details/inplace_editor/shared_examples"
+require "features/work_packages/shared_contexts"
+require "support/edit_fields/edit_field"
+require "features/work_packages/work_packages_page"
+
+RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_format: "%Y-%m-%d" } do
shared_let(:project) { create(:project_with_types, public: true) }
shared_let(:user) { create(:admin) }
shared_let(:type) { project.types.first }
@@ -49,7 +49,7 @@
)
end
- let(:work_package) { create(:work_package, project:, start_date: Date.parse('2016-01-02'), duration: nil) }
+ let(:work_package) { create(:work_package, project:, start_date: Date.parse("2016-01-02"), duration: nil) }
let(:work_packages_page) { Pages::FullWorkPackage.new(work_package, project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -66,28 +66,28 @@
work_packages_page.ensure_page_loaded
end
- it 'can directly set the due date when only a start date is set' do
+ it "can directly set the due date when only a start date is set" do
start_date.activate!
start_date.expect_active!
- start_date.datepicker.expect_year '2016'
- start_date.datepicker.expect_month 'January'
- start_date.datepicker.select_day '25'
+ start_date.datepicker.expect_year "2016"
+ start_date.datepicker.expect_month "January"
+ start_date.datepicker.select_day "25"
- start_date.datepicker.expect_start_date '2016-01-02'
- start_date.datepicker.expect_due_date '2016-01-25'
+ start_date.datepicker.expect_start_date "2016-01-02"
+ start_date.datepicker.expect_due_date "2016-01-25"
start_date.datepicker.expect_duration 24
start_date.save!
start_date.expect_inactive!
- start_date.expect_state_text '2016-01-02 - 2016-01-25'
+ start_date.expect_state_text "2016-01-02 - 2016-01-25"
end
it 'can set "today" as a date via the provided link' do
start_date.activate!
start_date.expect_active!
- start_date.datepicker.expect_start_date '2016-01-02'
+ start_date.datepicker.expect_start_date "2016-01-02"
start_date.datepicker.expect_year work_package.start_date.year
start_date.datepicker.expect_month work_package.start_date.strftime("%B")
start_date.datepicker.expect_day work_package.start_date.day
@@ -104,84 +104,84 @@
start_date.expect_state_text "#{Time.zone.today.strftime('%Y-%m-%d')} - no finish date"
end
- context 'with start and end date set' do
+ context "with start and end date set" do
let(:work_package) do
create(:work_package,
project:,
- start_date: Date.parse('2016-01-02'),
- due_date: Date.parse('2016-01-25'))
+ start_date: Date.parse("2016-01-02"),
+ due_date: Date.parse("2016-01-25"))
end
- it 'selecting a date before the current start date will move the finish date' do
+ it "selecting a date before the current start date will move the finish date" do
start_date.activate!
start_date.expect_active!
- start_date.datepicker.expect_year '2016'
- start_date.datepicker.expect_month 'January'
- start_date.datepicker.select_day '1'
+ start_date.datepicker.expect_year "2016"
+ start_date.datepicker.expect_month "January"
+ start_date.datepicker.select_day "1"
- start_date.datepicker.expect_start_date '2016-01-01'
- start_date.datepicker.expect_due_date '2016-01-24'
+ start_date.datepicker.expect_start_date "2016-01-01"
+ start_date.datepicker.expect_due_date "2016-01-24"
start_date.datepicker.expect_duration 24
start_date.save!
start_date.expect_inactive!
- start_date.expect_state_text '2016-01-01 - 2016-01-24'
+ start_date.expect_state_text "2016-01-01 - 2016-01-24"
end
- it 'selecting a date in between changes the date that is currently in focus' do
+ it "selecting a date in between changes the date that is currently in focus" do
start_date.activate!
start_date.expect_active!
- start_date.datepicker.expect_year '2016'
- start_date.datepicker.expect_month 'January'
- start_date.datepicker.select_day '3'
+ start_date.datepicker.expect_year "2016"
+ start_date.datepicker.expect_month "January"
+ start_date.datepicker.select_day "3"
- start_date.datepicker.expect_start_date '2016-01-03'
+ start_date.datepicker.expect_start_date "2016-01-03"
# Since the focus shifts automatically, we can directly click again to modify the end date
- start_date.datepicker.select_day '21'
+ start_date.datepicker.select_day "21"
- start_date.datepicker.expect_due_date '2016-01-21'
+ start_date.datepicker.expect_due_date "2016-01-21"
start_date.datepicker.expect_duration 19
start_date.save!
start_date.expect_inactive!
- start_date.expect_state_text '2016-01-03 - 2016-01-21'
+ start_date.expect_state_text "2016-01-03 - 2016-01-21"
end
- it 'selecting a date after the current finish date will change either start or finish depending on the focus' do
+ it "selecting a date after the current finish date will change either start or finish depending on the focus" do
start_date.activate!
start_date.expect_active!
- start_date.datepicker.expect_year '2016'
- start_date.datepicker.expect_month 'January'
+ start_date.datepicker.expect_year "2016"
+ start_date.datepicker.expect_month "January"
# Focus the end date field
start_date.activate_due_date_within_modal
- start_date.datepicker.set_due_date '2016-03-01'
+ start_date.datepicker.set_due_date "2016-03-01"
# Since the end date is focused, the date will become the new end date
start_date.save!
start_date.expect_inactive!
- start_date.expect_state_text '2016-01-02 - 2016-03-01'
+ start_date.expect_state_text "2016-01-02 - 2016-03-01"
# Activating again and now changing the start date to something after the current end date
start_date.activate!
start_date.expect_active!
- start_date.datepicker.expect_year '2016'
- start_date.datepicker.expect_month 'January'
- start_date.datepicker.set_start_date '2016-04-01'
+ start_date.datepicker.expect_year "2016"
+ start_date.datepicker.expect_month "January"
+ start_date.datepicker.set_start_date "2016-04-01"
# This will set the new start and unset the end date
start_date.save!
start_date.expect_inactive!
- start_date.expect_state_text '2016-04-01 - no finish date'
+ start_date.expect_state_text "2016-04-01 - no finish date"
end
end
- context 'with the start date empty' do
+ context "with the start date empty" do
let(:work_package) { create(:work_package, project:, start_date: nil, duration: nil) }
it 'can set "today" as a date via the provided link' do
@@ -203,7 +203,7 @@
end
end
- it 'can set start and due date to the same day' do
+ it "can set start and due date to the same day" do
start_date.activate!
start_date.expect_active!
@@ -226,10 +226,10 @@
start_date.save!
start_date.expect_inactive!
- start_date.expect_state_text Time.zone.today.strftime('%Y-%m-%d')
+ start_date.expect_state_text Time.zone.today.strftime("%Y-%m-%d")
end
- it 'can set a negative duration which gets transformed (Regression #44219)' do
+ it "can set a negative duration which gets transformed (Regression #44219)" do
start_date.activate!
start_date.expect_active!
@@ -240,7 +240,7 @@
start_date.datepicker.expect_duration 128
end
- it 'saves the date when clearing and then confirming' do
+ it "saves the date when clearing and then confirming" do
start_date.activate!
start_date.input_element.click
@@ -250,35 +250,35 @@
sleep 1
start_date.save!
- work_packages_page.expect_and_dismiss_toaster message: 'Successful update.'
+ work_packages_page.expect_and_dismiss_toaster message: "Successful update."
start_date.expect_inactive!
- start_date.expect_state_text 'no start date'
+ start_date.expect_state_text "no start date"
work_package.reload
expect(work_package.start_date).to be_nil
end
- it 'closes the date picker when moving away' do
+ it "closes the date picker when moving away" do
wp_table.visit!
wp_table.open_full_screen_by_doubleclick work_package
start_date.activate!
start_date.expect_active!
- page.execute_script('window.history.back()')
+ page.execute_script("window.history.back()")
work_packages_page.accept_alert_dialog! if work_packages_page.has_alert_dialog?
# Ensure no modal survives
- expect(page).to have_no_css('.spot-modal')
+ expect(page).to have_no_css(".spot-modal")
end
- context 'with a date custom field' do
+ context "with a date custom field" do
let(:cf_field) { EditField.new page, date_cf.attribute_name(:camel_case) }
let(:datepicker) { Components::BasicDatepicker.new }
let(:create_page) { Pages::FullWorkPackageCreate.new(project:) }
- it 'can handle creating a CF date' do
+ it "can handle creating a CF date" do
create_page.visit!
type_field = create_page.edit_field(:type)
@@ -297,15 +297,15 @@
# Open date picker
cf_field.input_element.click
datepicker.set_date Time.zone.today
- create_page.edit_field(:subject).set_value 'My subject!'
+ create_page.edit_field(:subject).set_value "My subject!"
create_page.save!
- create_page.expect_and_dismiss_toaster message: 'Successful creation'
+ create_page.expect_and_dismiss_toaster message: "Successful creation"
wp = WorkPackage.last
expect(wp.custom_value_for(date_cf.id).value).to eq Time.zone.today.iso8601
end
- it 'can set the date via the in-place editing' do
+ it "can set the date via the in-place editing" do
datepicker.expect_not_visible
cf_field.activate!
@@ -313,13 +313,13 @@
datepicker.set_date Time.zone.today
- create_page.expect_and_dismiss_toaster message: 'Successful update.'
+ create_page.expect_and_dismiss_toaster message: "Successful update."
cf_field.expect_inactive!
- cf_field.expect_state_text Time.zone.today.strftime('%Y-%m-%d')
+ cf_field.expect_state_text Time.zone.today.strftime("%Y-%m-%d")
end
end
- context 'with the work package having no relations whatsoever' do
+ context "with the work package having no relations whatsoever" do
let!(:work_package) { create(:work_package, project:) }
before do
@@ -327,19 +327,19 @@
start_date.expect_active!
end
- it 'does not show a banner with or without manual scheduling' do
- expect(page).not_to have_test_selector('op-modal-banner-warning')
- expect(page).not_to have_test_selector('op-modal-banner-info')
+ it "does not show a banner with or without manual scheduling" do
+ expect(page).not_to have_test_selector("op-modal-banner-warning")
+ expect(page).not_to have_test_selector("op-modal-banner-info")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
- expect(page).not_to have_test_selector('op-modal-banner-warning')
- expect(page).not_to have_test_selector('op-modal-banner-info')
+ expect(page).not_to have_test_selector("op-modal-banner-warning")
+ expect(page).not_to have_test_selector("op-modal-banner-info")
end
end
- context 'with the work package being the last in the hierarchy' do
+ context "with the work package being the last in the hierarchy" do
let!(:parent) { create(:work_package, project:, schedule_manually:, start_date: 1.day.ago, due_date: 5.days.from_now) }
let!(:work_package) { create(:work_package, project:, schedule_manually:, parent:) }
@@ -348,12 +348,12 @@
start_date.expect_active!
end
- context 'when work package is manually scheduled' do
+ context "when work package is manually scheduled" do
let(:schedule_manually) { true }
- it 'shows a banner that the relations are ignored' do
+ it "shows a banner that the relations are ignored" do
expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.',
+ text: "Manual scheduling enabled, all relations ignored.",
wait: 5)
# When toggling manually scheduled
@@ -362,9 +362,9 @@
# Expect new banner info
expect(page)
.to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Changing these dates will affect dates of related work packages.')
+ text: "Changing these dates will affect dates of related work packages.")
- new_window = window_opened_by { click_on 'Show relations' }
+ new_window = window_opened_by { click_on "Show relations" }
switch_to_window new_window
wp_table.expect_work_package_listed parent
@@ -375,25 +375,25 @@
end
end
- context 'when work package is not manually scheduled' do
+ context "when work package is not manually scheduled" do
let(:schedule_manually) { false }
- it 'shows a banner that the start date is limited' do
+ it "shows a banner that the start date is limited" do
expect(page)
.to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Changing these dates will affect dates of related work packages.',
+ text: "Changing these dates will affect dates of related work packages.",
wait: 5)
# When toggling manually scheduled
start_date.toggle_scheduling_mode
expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ text: "Manual scheduling enabled, all relations ignored.")
end
end
end
- context 'with the work package being a parent' do
+ context "with the work package being a parent" do
let!(:child) { create(:work_package, project:, start_date: 1.day.ago, due_date: 5.days.from_now) }
let!(:work_package) do
wp = create(:work_package, project:, schedule_manually:)
@@ -406,21 +406,21 @@
start_date.expect_active!
end
- context 'when parent is manually scheduled' do
+ context "when parent is manually scheduled" do
let(:schedule_manually) { true }
- it 'shows a banner that the relations are ignored' do
+ it "shows a banner that the relations are ignored" do
expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ text: "Manual scheduling enabled, all relations ignored.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
# Expect banner to switch
expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
- text: 'Automatically scheduled. Dates are derived from relations.')
+ text: "Automatically scheduled. Dates are derived from relations.")
- new_window = window_opened_by { click_on 'Show relations' }
+ new_window = window_opened_by { click_on "Show relations" }
switch_to_window new_window
wp_table.expect_work_package_listed child
@@ -429,39 +429,39 @@
end
end
- context 'when parent is not manually scheduled' do
+ context "when parent is not manually scheduled" do
let(:schedule_manually) { false }
- it 'shows a banner that the dates are not editable' do
+ it "shows a banner that the dates are not editable" do
expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
- text: 'Automatically scheduled. Dates are derived from relations.')
+ text: "Automatically scheduled. Dates are derived from relations.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ text: "Manual scheduling enabled, all relations ignored.")
- new_window = window_opened_by { click_on 'Show relations' }
+ new_window = window_opened_by { click_on "Show relations" }
switch_to_window new_window
wp_table.expect_work_package_listed child
wp_timeline.expect_timeline!
end
- context 'when parent is not manually scheduled, child has workdays only set' do
+ context "when parent is not manually scheduled, child has workdays only set" do
let(:schedule_manually) { false }
let!(:child) do
create(:work_package,
project:,
ignore_non_working_days: false,
- start_date: Date.parse('2022-09-27'),
- due_date: Date.parse('2022-09-29'))
+ start_date: Date.parse("2022-09-27"),
+ due_date: Date.parse("2022-09-29"))
end
- it 'allows switching to manual scheduling to set the ignore NWD (Regression #43933)' do
+ it "allows switching to manual scheduling to set the ignore NWD (Regression #43933)" do
expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
- text: 'Automatically scheduled. Dates are derived from relations.')
+ text: "Automatically scheduled. Dates are derived from relations.")
# Expect "Working days only" to be checked
datepicker.expect_ignore_non_working_days_disabled
@@ -474,7 +474,7 @@
datepicker.expect_ignore_non_working_days true
expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ text: "Manual scheduling enabled, all relations ignored.")
# Reset when disabled
start_date.toggle_scheduling_mode
@@ -482,13 +482,13 @@
datepicker.expect_ignore_non_working_days false, disabled: true
expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
- text: 'Automatically scheduled. Dates are derived from relations.')
+ text: "Automatically scheduled. Dates are derived from relations.")
end
end
end
end
- context 'with the work package having a precedes relation' do
+ context "with the work package having a precedes relation" do
let!(:work_package) { create(:work_package, project:, schedule_manually:) }
let!(:preceding) { create(:work_package, project:, start_date: 10.days.ago, due_date: 5.days.ago) }
@@ -504,21 +504,21 @@
start_date.expect_active!
end
- context 'when work package is manually scheduled' do
+ context "when work package is manually scheduled" do
let(:schedule_manually) { true }
- it 'shows a banner that the relations are ignored' do
+ it "shows a banner that the relations are ignored" do
expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ text: "Manual scheduling enabled, all relations ignored.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
# Expect new banner info
expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
- text: 'Available start and finish dates are limited by relations.')
+ text: "Available start and finish dates are limited by relations.")
- new_window = window_opened_by { click_on 'Show relations' }
+ new_window = window_opened_by { click_on "Show relations" }
switch_to_window new_window
wp_table.expect_work_package_listed preceding
@@ -527,23 +527,23 @@
end
end
- context 'when work package is not manually scheduled' do
+ context "when work package is not manually scheduled" do
let(:schedule_manually) { false }
- it 'shows a banner that the start date is limited' do
+ it "shows a banner that the start date is limited" do
expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
- text: 'Available start and finish dates are limited by relations.')
+ text: "Available start and finish dates are limited by relations.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ text: "Manual scheduling enabled, all relations ignored.")
end
end
end
- context 'with the work package having a follows relation' do
+ context "with the work package having a follows relation" do
let!(:work_package) { create(:work_package, project:, schedule_manually:) }
let!(:following) { create(:work_package, project:, start_date: 5.days.from_now, due_date: 10.days.from_now) }
@@ -559,21 +559,21 @@
start_date.expect_active!
end
- context 'when work package is manually scheduled' do
+ context "when work package is manually scheduled" do
let(:schedule_manually) { true }
- it 'shows a banner that the relations are ignored' do
+ it "shows a banner that the relations are ignored" do
expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ text: "Manual scheduling enabled, all relations ignored.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
expect(page)
.to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Changing these dates will affect dates of related work packages.')
+ text: "Changing these dates will affect dates of related work packages.")
- new_window = window_opened_by { click_on 'Show relations' }
+ new_window = window_opened_by { click_on "Show relations" }
switch_to_window new_window
wp_table.expect_work_package_listed following
@@ -582,41 +582,41 @@
end
end
- context 'when work package is not manually scheduled' do
+ context "when work package is not manually scheduled" do
let(:schedule_manually) { false }
- it 'shows a banner that the start date is limited' do
+ it "shows a banner that the start date is limited" do
expect(page)
.to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Changing these dates will affect dates of related work packages.')
+ text: "Changing these dates will affect dates of related work packages.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ text: "Manual scheduling enabled, all relations ignored.")
end
end
end
- context 'with a negative time zone', driver: :chrome_new_york_time_zone do
- it 'can normally select the dates via datepicker (regression #43562)' do
+ context "with a negative time zone", driver: :chrome_new_york_time_zone do
+ it "can normally select the dates via datepicker (regression #43562)" do
start_date.activate!
start_date.expect_active!
- start_date.datepicker.expect_year '2016'
- start_date.datepicker.expect_month 'January'
- start_date.datepicker.select_day '25'
+ start_date.datepicker.expect_year "2016"
+ start_date.datepicker.expect_month "January"
+ start_date.datepicker.select_day "25"
sleep 2
- start_date.datepicker.expect_year '2016'
- start_date.datepicker.expect_month 'January'
- start_date.datepicker.expect_day '25'
+ start_date.datepicker.expect_year "2016"
+ start_date.datepicker.expect_month "January"
+ start_date.datepicker.expect_day "25"
start_date.save!
start_date.expect_inactive!
- start_date.expect_state_text '2016-01-02 - 2016-01-25'
+ start_date.expect_state_text "2016-01-02 - 2016-01-25"
end
end
end
diff --git a/spec/features/work_packages/details/details_refreshing_spec.rb b/spec/features/work_packages/details/details_refreshing_spec.rb
index 729316f6ffaf..df950bfbcab9 100644
--- a/spec/features/work_packages/details/details_refreshing_spec.rb
+++ b/spec/features/work_packages/details/details_refreshing_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'Work package table refreshing due to split view', :js, :with_cuprite do
+RSpec.describe "Work package table refreshing due to split view", :js, :with_cuprite do
let(:project) { create(:project_with_types) }
let!(:work_package) { create(:work_package, project:) }
let(:wp_split) { Pages::SplitWorkPackage.new work_package }
@@ -41,13 +41,13 @@
wp_split.visit!
end
- it 'toggles the watch state' do
+ it "toggles the watch state" do
wp_split.ensure_page_loaded
wp_split.edit_field(:subject).expect_text work_package.subject
wp_table.expect_work_package_listed work_package
page.within wp_table.row(work_package) do
- expect(page).to have_css('.wp-table--drag-and-drop-handle.icon-drag-handle', visible: :all)
+ expect(page).to have_css(".wp-table--drag-and-drop-handle.icon-drag-handle", visible: :all)
end
end
end
diff --git a/spec/features/work_packages/details/details_toolbar_spec.rb b/spec/features/work_packages/details/details_toolbar_spec.rb
index 48b9ed001fa9..0c88255ccb2b 100644
--- a/spec/features/work_packages/details/details_toolbar_spec.rb
+++ b/spec/features/work_packages/details/details_toolbar_spec.rb
@@ -26,15 +26,15 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'Work package details toolbar', :js, :selenium do
+RSpec.describe "Work package details toolbar", :js, :selenium do
let(:project) { create(:project_with_types, public: true) }
let!(:work_package) { create(:work_package, project:) }
let(:work_packages_page) { WorkPackagesPage.new(project) }
- describe 'toggle watch state' do
+ describe "toggle watch state" do
let(:user) { create(:admin) }
before do
@@ -42,17 +42,17 @@
work_packages_page.visit_index(work_package)
end
- it 'toggles the watch state' do
+ it "toggles the watch state" do
expect(work_package.watcher_users).not_to include(user)
- expect(page).to have_css('.work-packages--details-toolbar button', text: 'Watch')
- within '.work-packages--details-toolbar' do
- click_button 'Watch'
+ expect(page).to have_css(".work-packages--details-toolbar button", text: "Watch")
+ within ".work-packages--details-toolbar" do
+ click_button "Watch"
end
- expect(page).to have_css('.work-packages--details-toolbar button', text: 'Unwatch')
+ expect(page).to have_css(".work-packages--details-toolbar button", text: "Unwatch")
expect(work_package.reload.watcher_users).to include(user)
- expect(page).to have_css('.work-packages--details-toolbar button', text: 'Unwatch')
+ expect(page).to have_css(".work-packages--details-toolbar button", text: "Unwatch")
end
end
end
diff --git a/spec/features/work_packages/details/inplace_editor/shared_examples.rb b/spec/features/work_packages/details/inplace_editor/shared_examples.rb
index 1b7c1a9e7ade..510bbf5e22d9 100644
--- a/spec/features/work_packages/details/inplace_editor/shared_examples.rb
+++ b/spec/features/work_packages/details/inplace_editor/shared_examples.rb
@@ -1,12 +1,12 @@
-RSpec.shared_examples 'as an accessible inplace editor' do
- it 'triggers edit mode on click' do
+RSpec.shared_examples "as an accessible inplace editor" do
+ it "triggers edit mode on click" do
scroll_to_element(field.display_element)
field.activate_edition
expect(field).to be_editing
field.cancel_by_escape
end
- it 'triggers edit mode on RETURN key' do
+ it "triggers edit mode on RETURN key" do
scroll_to_element(field.display_element)
field.display_element.native.send_keys(:return)
@@ -14,43 +14,43 @@
field.cancel_by_escape
end
- it 'is focusable' do
+ it "is focusable" do
scroll_to_element(field.display_element)
- tab_index = field.display_element['tabindex']
+ tab_index = field.display_element["tabindex"]
expect(tab_index).not_to be_nil
- expect(tab_index).not_to eq('-1')
+ expect(tab_index).not_to eq("-1")
end
end
-RSpec.shared_examples 'as an auth aware field' do
- context 'when is editable' do
- it_behaves_like 'as an accessible inplace editor'
+RSpec.shared_examples "as an auth aware field" do
+ context "when is editable" do
+ it_behaves_like "as an accessible inplace editor"
end
- context 'when user is authorized' do
- it 'is editable' do
+ context "when user is authorized" do
+ it "is editable" do
expect(field).to be_editable
end
end
- context 'when user is not authorized' do
+ context "when user is not authorized" do
let(:user) do
create(:user, member_with_permissions: { project => %i(view_work_packages) })
end
- it 'is not editable' do
+ it "is not editable" do
expect(field).not_to be_editable
end
end
end
-RSpec.shared_context 'as a single validation point' do
+RSpec.shared_context "as a single validation point" do
let(:other_field) { EditField.new page, :type }
before do
other_field.activate_edition
field.activate_edition
- field.input_element.set ''
+ field.input_element.set ""
field.submit_by_enter
end
@@ -60,10 +60,10 @@
end
end
-RSpec.shared_context 'as a required field' do
+RSpec.shared_context "as a required field" do
before do
field.activate_edition
- field.input_element.set ''
+ field.input_element.set ""
field.submit_by_enter
end
@@ -72,69 +72,69 @@
end
end
-RSpec.shared_examples 'a cancellable field' do
- shared_examples 'cancelling properly' do
- it 'reverts to read state and keeps its focus' do
+RSpec.shared_examples "a cancellable field" do
+ shared_examples "cancelling properly" do
+ it "reverts to read state and keeps its focus" do
expect(field).not_to be_editing
field.expect_state_text(work_package.send(property_name))
- active_class_name = page.evaluate_script('document.activeElement.className')
+ active_class_name = page.evaluate_script("document.activeElement.className")
expect(active_class_name).to include(field.display_selector[1..])
end
end
- context 'for escape' do
+ context "for escape" do
before do
field.activate!
sleep 1
field.cancel_by_escape
end
- it_behaves_like 'cancelling properly'
+ it_behaves_like "cancelling properly"
end
end
-RSpec.shared_examples 'a workpackage autocomplete field' do
- let!(:wp2) { create(:work_package, project:, subject: 'AutoFoo') }
+RSpec.shared_examples "a workpackage autocomplete field" do
+ let!(:wp2) { create(:work_package, project:, subject: "AutoFoo") }
- it 'autocompletes the other work package' do
+ it "autocompletes the other work package" do
field.activate!
field.clear
field.type(" ##{wp2.id}")
- expect(page).to have_css('.mention-list-item', text: wp2.to_s.strip)
+ expect(page).to have_css(".mention-list-item", text: wp2.to_s.strip)
end
end
-RSpec.shared_examples 'a principal autocomplete field' do
+RSpec.shared_examples "a principal autocomplete field" do
let(:role) { create(:project_role, permissions: %i[view_work_packages edit_work_packages]) }
let!(:user) do
create(:user,
member_with_roles: { project => role },
- firstname: 'John')
+ firstname: "John")
end
let!(:mentioned_user) do
create(:user,
member_with_roles: { project => role },
- firstname: 'Laura',
- lastname: 'Foobar')
+ firstname: "Laura",
+ lastname: "Foobar")
end
let!(:mentioned_group) do
- create(:group, lastname: 'Laudators', member_with_roles: { project => role })
+ create(:group, lastname: "Laudators", member_with_roles: { project => role })
end
- shared_examples 'principal autocomplete on field' do
+ shared_examples "principal autocomplete on field" do
before do
wp_page.visit!
wp_page.ensure_page_loaded
end
- it 'autocompletes links to user profiles' do
+ it "autocompletes links to user profiles" do
field.activate!
field.clear with_backspace: true
field.input_element.send_keys(" @lau")
- expect(page).to have_css('.mention-list-item', text: mentioned_user.name)
- expect(page).to have_css('.mention-list-item', text: mentioned_group.name)
- expect(page).to have_no_css('.mention-list-item', text: user.name)
+ expect(page).to have_css(".mention-list-item", text: mentioned_user.name)
+ expect(page).to have_css(".mention-list-item", text: mentioned_group.name)
+ expect(page).to have_no_css(".mention-list-item", text: user.name)
# Close the autocompleter
field.input_element.send_keys :escape
@@ -142,67 +142,67 @@
sleep 2
- field.ckeditor.type_slowly '@Laura'
- expect(page).to have_css('.mention-list-item', text: mentioned_user.name)
- expect(page).to have_no_css('.mention-list-item', text: mentioned_group.name)
- expect(page).to have_no_css('.mention-list-item', text: user.name)
+ field.ckeditor.type_slowly "@Laura"
+ expect(page).to have_css(".mention-list-item", text: mentioned_user.name)
+ expect(page).to have_no_css(".mention-list-item", text: mentioned_group.name)
+ expect(page).to have_no_css(".mention-list-item", text: user.name)
end
end
- context 'with the project page' do
+ context "with the project page" do
let(:wp_page) { Pages::SplitWorkPackage.new(work_package, project) }
- it_behaves_like 'principal autocomplete on field'
+ it_behaves_like "principal autocomplete on field"
end
- context 'without the project page' do
+ context "without the project page" do
let(:wp_page) { Pages::SplitWorkPackage.new(work_package) }
- it_behaves_like 'principal autocomplete on field'
+ it_behaves_like "principal autocomplete on field"
end
end
-RSpec.shared_examples 'not a principal autocomplete field' do
+RSpec.shared_examples "not a principal autocomplete field" do
let(:role) { create(:project_role, permissions: %i[view_work_packages edit_work_packages]) }
let!(:user) do
create(:user,
member_with_roles: { project => role },
- firstname: 'John')
+ firstname: "John")
end
let!(:mentioned_user) do
create(:user,
member_with_roles: { project => role },
- firstname: 'Laura',
- lastname: 'Foobar')
+ firstname: "Laura",
+ lastname: "Foobar")
end
let!(:mentioned_group) do
- create(:group, lastname: 'Laudators', member_with_roles: { project => role })
+ create(:group, lastname: "Laudators", member_with_roles: { project => role })
end
- shared_examples 'not principal autocomplete on field' do
+ shared_examples "not principal autocomplete on field" do
before do
wp_page.visit!
wp_page.ensure_page_loaded
end
- it 'does not autocompletes links to user profiles' do
+ it "does not autocompletes links to user profiles" do
field.activate!
field.clear with_backspace: true
field.input_element.send_keys(" @lau")
sleep 2
- expect(page).to have_no_css('.mention-list-item')
+ expect(page).to have_no_css(".mention-list-item")
end
end
- context 'with the project page' do
+ context "with the project page" do
let(:wp_page) { Pages::SplitWorkPackage.new(work_package, project) }
- it_behaves_like 'not principal autocomplete on field'
+ it_behaves_like "not principal autocomplete on field"
end
- context 'without the project page' do
+ context "without the project page" do
let(:wp_page) { Pages::SplitWorkPackage.new(work_package) }
- it_behaves_like 'not principal autocomplete on field'
+ it_behaves_like "not principal autocomplete on field"
end
end
diff --git a/spec/features/work_packages/details/inplace_editor/subject_editor_spec.rb b/spec/features/work_packages/details/inplace_editor/subject_editor_spec.rb
index 32788c9d7d27..e3cb1a6d0741 100644
--- a/spec/features/work_packages/details/inplace_editor/subject_editor_spec.rb
+++ b/spec/features/work_packages/details/inplace_editor/subject_editor_spec.rb
@@ -1,14 +1,14 @@
-require 'spec_helper'
-require 'features/page_objects/notification'
-require 'features/work_packages/details/inplace_editor/shared_examples'
-require 'features/work_packages/shared_contexts'
-require 'support/edit_fields/edit_field'
-require 'features/work_packages/work_packages_page'
-
-RSpec.describe 'subject inplace editor', :js, :selenium do
+require "spec_helper"
+require "features/page_objects/notification"
+require "features/work_packages/details/inplace_editor/shared_examples"
+require "features/work_packages/shared_contexts"
+require "support/edit_fields/edit_field"
+require "features/work_packages/work_packages_page"
+
+RSpec.describe "subject inplace editor", :js, :selenium do
let(:project) { create(:project_with_types, public: true) }
let(:property_name) { :subject }
- let(:property_title) { 'Subject' }
+ let(:property_title) { "Subject" }
let(:work_package) { create(:work_package, project:) }
let(:user) { create(:admin) }
let(:work_packages_page) { Pages::SplitWorkPackage.new(work_package, project) }
@@ -22,33 +22,33 @@
work_packages_page.ensure_page_loaded
end
- context 'as a read state' do
- it 'has correct content' do
+ context "as a read state" do
+ it "has correct content" do
field.expect_state_text(work_package.send(property_name))
end
end
- it_behaves_like 'as an auth aware field'
- it_behaves_like 'a cancellable field'
- it_behaves_like 'as a single validation point'
- it_behaves_like 'as a required field'
+ it_behaves_like "as an auth aware field"
+ it_behaves_like "a cancellable field"
+ it_behaves_like "as a single validation point"
+ it_behaves_like "as a required field"
- context 'as an edit state' do
+ context "as an edit state" do
before do
field.activate_edition
end
- it 'renders a text input' do
+ it "renders a text input" do
expect(field.input_element).to be_visible
- expect(field.input_element['type']).to eq 'text'
+ expect(field.input_element["type"]).to eq "text"
end
- it 'has a correct value for the input' do
+ it "has a correct value for the input" do
expect(field.input_element[:value]).to eq work_package.subject
end
- it 'displays an error when too long' do
- too_long = '*' * 256
+ it "displays an error when too long" do
+ too_long = "*" * 256
field.set_value too_long
field.submit_by_enter
@@ -56,34 +56,34 @@
field.expect_active!
expect(field.input_element.value).to eq(too_long)
- notification.expect_error('Subject is too long (maximum is 255 characters)')
+ notification.expect_error("Subject is too long (maximum is 255 characters)")
end
- context 'when save' do
+ context "when save" do
before do
- field.input_element.set 'Aloha'
+ field.input_element.set "Aloha"
end
# safeguard
- include_context 'ensure wp details pane update done' do
+ include_context "ensure wp details pane update done" do
let(:update_user) { user }
end
- it 'saves the value on ENTER' do
+ it "saves the value on ENTER" do
field.submit_by_enter
- field.expect_state_text('Aloha')
+ field.expect_state_text("Aloha")
end
end
end
- context 'with conflicting modification' do
- it 'shows a conflict when modified elsewhere' do
- work_package.subject = 'Some other subject!'
+ context "with conflicting modification" do
+ it "shows a conflict when modified elsewhere" do
+ work_package.subject = "Some other subject!"
work_package.save!
field.display_element.click
- notification.expect_error(I18n.t('api_v3.errors.code_409'))
+ notification.expect_error(I18n.t("api_v3.errors.code_409"))
end
end
end
diff --git a/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb b/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb
index 120d461958fa..1d3fac2cd741 100644
--- a/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb
+++ b/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb
@@ -1,39 +1,39 @@
-require 'spec_helper'
-require 'features/work_packages/details/inplace_editor/shared_examples'
-require 'features/work_packages/shared_contexts'
-require 'support/edit_fields/edit_field'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/work_packages/details/inplace_editor/shared_examples"
+require "features/work_packages/shared_contexts"
+require "support/edit_fields/edit_field"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'subject inplace editor', :js, :selenium do
- let(:project) { create(:project_with_types, name: 'Root', public: true) }
- let(:subproject1) { create(:project_with_types, name: 'Child', parent: project) }
- let(:subproject2) { create(:project_with_types, name: 'Aunt', parent: project) }
+RSpec.describe "subject inplace editor", :js, :selenium do
+ let(:project) { create(:project_with_types, name: "Root", public: true) }
+ let(:subproject1) { create(:project_with_types, name: "Child", parent: project) }
+ let(:subproject2) { create(:project_with_types, name: "Aunt", parent: project) }
let!(:version) do
create(:version,
- name: '1. First version',
- status: 'open',
- sharing: 'tree',
- start_date: '2019-02-02',
- effective_date: '2019-02-03',
+ name: "1. First version",
+ status: "open",
+ sharing: "tree",
+ start_date: "2019-02-02",
+ effective_date: "2019-02-03",
project:)
end
let!(:version2) do
create(:version,
- status: 'open',
- sharing: 'tree',
- name: '2. Second version',
- start_date: '2020-02-02',
- effective_date: '2020-02-03',
+ status: "open",
+ sharing: "tree",
+ name: "2. Second version",
+ start_date: "2020-02-02",
+ effective_date: "2020-02-03",
project: subproject1)
end
let!(:version3) do
create(:version,
- status: 'open',
- sharing: 'tree',
+ status: "open",
+ sharing: "tree",
start_date: nil,
effective_date: nil,
- name: '3. Third version',
+ name: "3. Third version",
project: subproject2)
end
@@ -50,60 +50,60 @@
let(:permissions) { %i[view_work_packages edit_work_packages assign_versions] }
let(:work_package_page) { Pages::FullWorkPackage.new(work_package) }
- context 'with manage permissions' do
+ context "with manage permissions" do
before do
login_as(user)
end
- it 'renders hierarchical versions' do
+ it "renders hierarchical versions" do
work_package_page.visit!
work_package_page.ensure_page_loaded
field = work_package_page.work_package_field(:version)
field.activate!
- expect(page).to have_css('.ng-option-label', text: '-')
- expect(page).to have_css('.ng-option-label', text: version3.name)
- expect(page).to have_css('.ng-option-label', text: version2.name)
- expect(page).to have_css('.ng-option-label', text: version.name)
+ expect(page).to have_css(".ng-option-label", text: "-")
+ expect(page).to have_css(".ng-option-label", text: version3.name)
+ expect(page).to have_css(".ng-option-label", text: version2.name)
+ expect(page).to have_css(".ng-option-label", text: version.name)
# Expect the order to be descending by version date
- labels = page.all('.ng-option-label').map { |el| el.text.strip }
- expect(labels).to eq ['-', version.name, version2.name, version3.name]
+ labels = page.all(".ng-option-label").map { |el| el.text.strip }
+ expect(labels).to eq ["-", version.name, version2.name, version3.name]
- page.find('.ng-option-label', text: version3.name).select_option
+ page.find(".ng-option-label", text: version3.name).select_option
field.expect_state_text(version3.name)
end
- it 'allows creating versions from within the WP view' do
+ it "allows creating versions from within the WP view" do
work_package_page.visit!
work_package_page.ensure_page_loaded
field = work_package_page.work_package_field(:version)
field.activate!
- field.set_new_value 'Super cool new release'
- field.expect_state_text 'Super cool new release'
+ field.set_new_value "Super cool new release"
+ field.expect_state_text "Super cool new release"
visit project_settings_versions_path(project)
- expect(page).to have_content 'Super cool new release'
+ expect(page).to have_content "Super cool new release"
end
end
- context 'without the permission to manage versions' do
+ context "without the permission to manage versions" do
before do
login_as(second_user)
end
- it 'does not allow creating versions from within the WP view' do
+ it "does not allow creating versions from within the WP view" do
work_package_page.visit!
work_package_page.ensure_page_loaded
field = work_package_page.work_package_field(:version)
field.activate!
- field.input_element.find('input').set 'Version that does not exist'
- expect(page).to have_no_css('.ng-option', text: 'Create: Version that does not exist')
+ field.input_element.find("input").set "Version that does not exist"
+ expect(page).to have_no_css(".ng-option", text: "Create: Version that does not exist")
end
end
end
diff --git a/spec/features/work_packages/details/markdown/activity_comments_spec.rb b/spec/features/work_packages/details/markdown/activity_comments_spec.rb
index 64a72b3c82ab..06ba11d9d6ec 100644
--- a/spec/features/work_packages/details/markdown/activity_comments_spec.rb
+++ b/spec/features/work_packages/details/markdown/activity_comments_spec.rb
@@ -1,9 +1,9 @@
-require 'spec_helper'
+require "spec_helper"
-require 'features/work_packages/shared_contexts'
-require 'features/work_packages/details/inplace_editor/shared_examples'
+require "features/work_packages/shared_contexts"
+require "features/work_packages/details/inplace_editor/shared_examples"
-RSpec.describe 'activity comments', :js do
+RSpec.describe "activity comments", :js do
let(:project) { create(:project, public: true) }
let!(:work_package) do
create(:work_package,
@@ -11,20 +11,20 @@
journal_notes: initial_comment)
end
let(:wp_page) { Pages::SplitWorkPackage.new(work_package, project) }
- let(:selector) { '.work-packages--activity--add-comment' }
+ let(:selector) { ".work-packages--activity--add-comment" }
let(:comment_field) do
TextEditorField.new wp_page,
- 'comment',
+ "comment",
selector:
end
- let(:initial_comment) { 'the first comment in this WP' }
+ let(:initial_comment) { "the first comment in this WP" }
before do
login_as(current_user)
allow(current_user.pref).to receive(:warn_on_leaving_unsaved?).and_return(false)
end
- context 'with permission' do
+ context "with permission" do
let(:current_user) { create(:admin) }
before do
@@ -32,169 +32,169 @@
wp_page.ensure_page_loaded
end
- context 'in edit state' do
+ context "in edit state" do
before do
comment_field.activate!
end
- describe 'submitting comment' do
- it 'does not submit with enter' do
- comment_field.click_and_type_slowly 'this is a comment'
+ describe "submitting comment" do
+ it "does not submit with enter" do
+ comment_field.click_and_type_slowly "this is a comment"
comment_field.submit_by_enter
- expect(page).to have_no_css('.user-comment .message', text: 'this is a comment')
+ expect(page).to have_no_css(".user-comment .message", text: "this is a comment")
end
- it 'submits with click' do
- comment_field.click_and_type_slowly 'this is a comment!1'
+ it "submits with click" do
+ comment_field.click_and_type_slowly "this is a comment!1"
comment_field.submit_by_click
- wp_page.expect_comment text: 'this is a comment!1'
+ wp_page.expect_comment text: "this is a comment!1"
end
- it 'submits comments repeatedly' do
- comment_field.click_and_type_slowly 'this is my first comment!1'
+ it "submits comments repeatedly" do
+ comment_field.click_and_type_slowly "this is my first comment!1"
comment_field.submit_by_click
- expect(page).to have_css('.user-comment > .message', count: 2)
- wp_page.expect_comment text: 'this is my first comment!1'
+ expect(page).to have_css(".user-comment > .message", count: 2)
+ wp_page.expect_comment text: "this is my first comment!1"
expect(comment_field.editing?).to be false
comment_field.activate!
expect(comment_field.editing?).to be true
- comment_field.click_and_type_slowly 'this is my second comment!1'
+ comment_field.click_and_type_slowly "this is my second comment!1"
comment_field.submit_by_click
- expect(page).to have_css('.user-comment > .message', count: 3)
- wp_page.expect_comment text: 'this is my second comment!1'
+ expect(page).to have_css(".user-comment > .message", count: 3)
+ wp_page.expect_comment text: "this is my second comment!1"
expect(comment_field.editing?).to be false
comment_field.activate!
expect(comment_field.editing?).to be true
- comment_field.click_and_type_slowly 'this is my third comment!1'
+ comment_field.click_and_type_slowly "this is my third comment!1"
comment_field.submit_by_click
# Only shows three most recent
- expect(page).to have_css('.user-comment > .message', count: 3)
- wp_page.expect_comment text: 'this is my third comment!1'
+ expect(page).to have_css(".user-comment > .message", count: 3)
+ wp_page.expect_comment text: "this is my third comment!1"
- wp_page.switch_to_tab tab: 'Activity'
+ wp_page.switch_to_tab tab: "Activity"
# Now showing all comments
- expect(page).to have_css('.user-comment > .message', count: 4, wait: 10)
+ expect(page).to have_css(".user-comment > .message", count: 4, wait: 10)
expect(comment_field.editing?).to be false
comment_field.activate!
expect(comment_field.editing?).to be true
- comment_field.click_and_type_slowly 'this is my fifth comment!1'
+ comment_field.click_and_type_slowly "this is my fifth comment!1"
comment_field.submit_by_click
- expect(page).to have_css('.user-comment > .message', count: 4)
- wp_page.expect_comment text: 'this is my fifth comment!1'
+ expect(page).to have_css(".user-comment > .message", count: 4)
+ wp_page.expect_comment text: "this is my fifth comment!1"
# Expect no activity details
- expect(page).to have_no_css('.work-package-details-activities-messages li')
+ expect(page).to have_no_css(".work-package-details-activities-messages li")
end
end
- describe 'cancel comment' do
+ describe "cancel comment" do
it do
expect(comment_field.editing?).to be true
- comment_field.input_element.set 'this is a comment'
+ comment_field.input_element.set "this is a comment"
# Escape should NOT cancel the editing
comment_field.cancel_by_escape
expect(comment_field.editing?).to be true
- expect(page).to have_no_css('.user-comment .message', text: 'this is a comment')
+ expect(page).to have_no_css(".user-comment .message", text: "this is a comment")
# Click should cancel the editing
comment_field.cancel_by_click
expect(comment_field.editing?).to be false
- expect(page).to have_no_css('.user-comment .message', text: 'this is a comment')
+ expect(page).to have_no_css(".user-comment .message", text: "this is a comment")
end
end
- describe 'autocomplete' do
- describe 'work packages' do
- let!(:wp2) { create(:work_package, project:, subject: 'AutoFoo') }
+ describe "autocomplete" do
+ describe "work packages" do
+ let!(:wp2) { create(:work_package, project:, subject: "AutoFoo") }
- it 'can move to the work package by click (Regression #30928)' do
+ it "can move to the work package by click (Regression #30928)" do
comment_field.input_element.send_keys("##{wp2.id}")
- expect(page).to have_css('.mention-list-item', text: wp2.to_s.strip)
+ expect(page).to have_css(".mention-list-item", text: wp2.to_s.strip)
comment_field.submit_by_click
- page.find('#activity-2 a.issue', text: wp2.id).click
+ page.find("#activity-2 a.issue", text: wp2.id).click
other_wp_page = Pages::FullWorkPackage.new wp2
other_wp_page.ensure_page_loaded
- other_wp_page.edit_field(:subject).expect_text 'AutoFoo'
+ other_wp_page.edit_field(:subject).expect_text "AutoFoo"
end
end
- describe 'users' do
- it_behaves_like 'a principal autocomplete field' do
+ describe "users" do
+ it_behaves_like "a principal autocomplete field" do
let(:field) { comment_field }
end
end
end
- describe 'with an existing comment' do
- it 'allows to edit an existing comment' do
+ describe "with an existing comment" do
+ it "allows to edit an existing comment" do
# Insert new text, need to do this separately.''
- ['Comment with', ' ', '*', '*', 'bold text', '*', '*', ' ', 'in it'].each do |key|
+ ["Comment with", " ", "*", "*", "bold text", "*", "*", " ", "in it"].each do |key|
comment_field.input_element.send_keys key
end
comment_field.submit_by_click
- wp_page.expect_comment text: 'Comment with bold text in it'
- wp_page.expect_comment text: 'bold text', subselector: 'strong'
+ wp_page.expect_comment text: "Comment with bold text in it"
+ wp_page.expect_comment text: "bold text", subselector: "strong"
# Hover the new activity
- activity = page.find_by_id('activity-2')
+ activity = page.find_by_id("activity-2")
page.driver.browser.action.move_to(activity.native).perform
# Check the edit textarea
- edit_button = activity.find('.icon-edit')
+ edit_button = activity.find(".icon-edit")
scroll_to_element(edit_button)
edit_button.click
edit = TextEditorField.new wp_page,
- 'comment',
- selector: '.user-comment--form'
+ "comment",
+ selector: ".user-comment--form"
# Insert new text, need to do this separately.
edit.input_element.click
- [:enter, 'Comment with', ' ', '_', 'italic text', '_', ' ', 'in it'].each do |key|
+ [:enter, "Comment with", " ", "_", "italic text", "_", " ", "in it"].each do |key|
edit.input_element.send_keys key
end
edit.submit_by_click
- wp_page.expect_comment text: 'Comment with italic text in it'
- wp_page.expect_comment text: 'italic text', subselector: 'em'
+ wp_page.expect_comment text: "Comment with italic text in it"
+ wp_page.expect_comment text: "italic text", subselector: "em"
end
end
end
- describe 'quoting' do
- it 'can quote a previous comment' do
- expect(page).to have_css('.user-comment .message',
+ describe "quoting" do
+ it "can quote a previous comment" do
+ expect(page).to have_css(".user-comment .message",
text: initial_comment)
# Hover comment
- quoted = page.find('.user-comment > .message')
+ quoted = page.find(".user-comment > .message")
scroll_to_element(quoted)
quoted.hover
# Quote this comment
- page.find('.comments-icons .icon-quote').click
+ page.find(".comments-icons .icon-quote").click
expect(comment_field.editing?).to be true
# Add our comment
- expect(comment_field.input_element).to have_css('blockquote')
+ expect(comment_field.input_element).to have_css("blockquote")
quote = comment_field.input_element[:innerHTML]
expect(quote).to eq '
Anonymous wrote:
the first comment in this WP
'
@@ -204,32 +204,32 @@
comment_field.ckeditor.click_and_type_slowly :enter
# Insert new text, need to do this separately.
- comment_field.ckeditor.click_and_type_slowly :return, 'this is ', '*', '*', 'a bold', '*', '*', ' remark'
+ comment_field.ckeditor.click_and_type_slowly :return, "this is ", "*", "*", "a bold", "*", "*", " remark"
comment_field.submit_by_click
# Scroll to the activity
- scroll_to_element(page.find_by_id('activity-2'))
+ scroll_to_element(page.find_by_id("activity-2"))
- wp_page.expect_comment text: 'this is a bold remark'
+ wp_page.expect_comment text: "this is a bold remark"
wp_page.expect_comment count: 2
- wp_page.expect_comment subselector: 'blockquote'
- wp_page.expect_comment subselector: 'strong', text: 'a bold'
+ wp_page.expect_comment subselector: "blockquote"
+ wp_page.expect_comment subselector: "strong", text: "a bold"
end
end
- describe 'referencing another work package' do
+ describe "referencing another work package" do
let!(:work_package2) { create(:work_package, project:, type: create(:type)) }
- it 'can reference another work package with all methods' do
+ it "can reference another work package with all methods" do
comment_field.activate!
# Insert a new reference using the autocompleter
comment_field.input_element.send_keys "Single ##{work_package2.id}"
expect(page)
- .to have_css('.mention-list-item', text: "#{work_package2.type.name} ##{work_package2.id}:")
+ .to have_css(".mention-list-item", text: "#{work_package2.type.name} ##{work_package2.id}:")
- find('.mention-list-item', text: "#{work_package2.type.name} ##{work_package2.id}:").click
+ find(".mention-list-item", text: "#{work_package2.type.name} ##{work_package2.id}:").click
# Insert new text, need to do this separately.
# No autocompleter used this time.
@@ -246,17 +246,17 @@
comment_field.submit_by_click
wp_page.expect_comment text: "Single ##{work_package2.id}"
- expect(page).to have_css('.user-comment opce-macro-wp-quickinfo', count: 2)
- expect(page).to have_css('.user-comment .work-package--quickinfo.preview-trigger', count: 2)
+ expect(page).to have_css(".user-comment opce-macro-wp-quickinfo", count: 2)
+ expect(page).to have_css(".user-comment .work-package--quickinfo.preview-trigger", count: 2)
end
end
- it 'can move away to another tab, keeping the draft comment' do
+ it "can move away to another tab, keeping the draft comment" do
comment_field.activate!
comment_field.input_element.send_keys "I'm typing an important message here ..."
wp_page.switch_to_tab tab: :files
- expect(page).to have_test_selector('op-tab-content--tab-section')
+ expect(page).to have_test_selector("op-tab-content--tab-section")
wp_page.switch_to_tab tab: :activity
@@ -273,7 +273,7 @@
# Has removed the draft now
wp_page.switch_to_tab tab: :files
- expect(page).to have_test_selector('op-tab-content--tab-section')
+ expect(page).to have_test_selector("op-tab-content--tab-section")
wp_page.switch_to_tab tab: :activity
comment_field.expect_inactive!
@@ -283,7 +283,7 @@
end
end
- context 'with no permission' do
+ context "with no permission" do
let(:role) { create(:project_role, permissions: %i(view_work_packages)) }
let(:current_user) { create(:user, member_with_roles: { project => role }) }
@@ -292,7 +292,7 @@
wp_page.ensure_page_loaded
end
- it 'does not show the field' do
+ it "does not show the field" do
expect(page).to have_no_selector(selector, visible: true)
end
end
diff --git a/spec/features/work_packages/details/markdown/description_editor_spec.rb b/spec/features/work_packages/details/markdown/description_editor_spec.rb
index b05ba27261ad..087ad71411c6 100644
--- a/spec/features/work_packages/details/markdown/description_editor_spec.rb
+++ b/spec/features/work_packages/details/markdown/description_editor_spec.rb
@@ -26,17 +26,17 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/work_packages/details/inplace_editor/shared_examples'
-require 'features/work_packages/shared_contexts'
-require 'support/edit_fields/edit_field'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/work_packages/details/inplace_editor/shared_examples"
+require "features/work_packages/shared_contexts"
+require "support/edit_fields/edit_field"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'description inplace editor', :js, :selenium do
+RSpec.describe "description inplace editor", :js, :selenium do
let(:project) { create(:project_with_types, public: true) }
let(:property_name) { :description }
- let(:property_title) { 'Description' }
- let(:description_text) { 'Ima description' }
+ let(:property_title) { "Description" }
+ let(:description_text) { "Ima description" }
let!(:work_package) do
create(
:work_package,
@@ -45,7 +45,7 @@
)
end
let(:user) { create(:admin) }
- let(:field) { TextEditorField.new wp_page, 'description' }
+ let(:field) { TextEditorField.new wp_page, "description" }
let(:wp_page) { Pages::SplitWorkPackage.new(work_package, project) }
before do
@@ -55,8 +55,8 @@
wp_page.ensure_page_loaded
end
- context 'with permission' do
- it 'allows editing description field' do
+ context "with permission" do
+ it "allows editing description field" do
field.expect_state_text(description_text)
# Regression test #24033
@@ -90,49 +90,49 @@
field.set_value "Edit to be saved by keyboard"
field.submit_by_enter
- wp_page.expect_toast message: I18n.t('js.notice_successful_update')
- field.expect_state_text 'Edit to be saved by keyboard'
+ wp_page.expect_toast message: I18n.t("js.notice_successful_update")
+ field.expect_state_text "Edit to be saved by keyboard"
end
end
- context 'when is empty' do
- let(:description_text) { '' }
+ context "when is empty" do
+ let(:description_text) { "" }
- it 'renders a placeholder' do
- field.expect_state_text 'Description: Click to edit...'
+ it "renders a placeholder" do
+ field.expect_state_text "Description: Click to edit..."
field.activate!
# An empty description is also allowed
field.expect_save_button(enabled: true)
- field.set_value 'A new hope ...'
+ field.set_value "A new hope ..."
field.expect_save_button(enabled: true)
field.submit_by_click
- wp_page.expect_toast message: I18n.t('js.notice_successful_update')
- field.expect_state_text 'A new hope ...'
+ wp_page.expect_toast message: I18n.t("js.notice_successful_update")
+ field.expect_state_text "A new hope ..."
end
end
- context 'with no permission' do
+ context "with no permission" do
let(:role) { create(:project_role, permissions: %i(view_work_packages)) }
let(:user) { create(:user, member_with_roles: { project => role }) }
- it 'does not show the field' do
- expect(page).to have_no_css('.inline-edit--display-field.description.-editable')
+ it "does not show the field" do
+ expect(page).to have_no_css(".inline-edit--display-field.description.-editable")
field.display_element.click
field.expect_inactive!
end
- context 'when is empty' do
- let(:description_text) { '' }
+ context "when is empty" do
+ let(:description_text) { "" }
- it 'renders a placeholder' do
- field.expect_state_text ''
+ it "renders a placeholder" do
+ field.expect_state_text ""
end
end
end
- it_behaves_like 'a workpackage autocomplete field'
- it_behaves_like 'a principal autocomplete field'
+ it_behaves_like "a workpackage autocomplete field"
+ it_behaves_like "a principal autocomplete field"
end
diff --git a/spec/features/work_packages/details/milestones_spec.rb b/spec/features/work_packages/details/milestones_spec.rb
index 4439aa6cd57e..c50de5a0a4ea 100644
--- a/spec/features/work_packages/details/milestones_spec.rb
+++ b/spec/features/work_packages/details/milestones_spec.rb
@@ -1,24 +1,24 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Milestones full screen v iew', :js do
+RSpec.describe "Milestones full screen v iew", :js do
let(:type) { create(:type, is_milestone: true) }
let(:project) { create(:project, types: [type]) }
let!(:work_package) do
create(:work_package,
project:,
type:,
- subject: 'Foobar')
+ subject: "Foobar")
end
let(:wp_page) { Pages::FullWorkPackage.new(work_package, project) }
- let(:button) { find('.add-work-package', wait: 5) }
+ let(:button) { find(".add-work-package", wait: 5) }
before do
login_as(user)
wp_page.visit!
end
- context 'user has :add_work_packages permission' do
+ context "user has :add_work_packages permission" do
let(:user) do
create(:user, member_with_roles: { project => role })
end
@@ -27,15 +27,15 @@
%i[view_work_packages add_work_packages]
end
- it 'shows the button as enabled' do
+ it "shows the button as enabled" do
expect(button).not_to be_disabled
button.click
- expect(page).to have_css('.menu-item', text: type.name.upcase)
+ expect(page).to have_css(".menu-item", text: type.name.upcase)
end
end
- context 'user has :view_work_packages permission only' do
+ context "user has :view_work_packages permission only" do
let(:user) do
create(:user, member_with_roles: { project => role })
end
@@ -44,8 +44,8 @@
%i[view_work_packages]
end
- it 'shows the button as correctly disabled' do
- expect(button['disabled']).to be_truthy
+ it "shows the button as correctly disabled" do
+ expect(button["disabled"]).to be_truthy
end
end
end
diff --git a/spec/features/work_packages/details/query_groups/relation_query_group_spec.rb b/spec/features/work_packages/details/query_groups/relation_query_group_spec.rb
index 92d4ec3046ed..b41c7c052f28 100644
--- a/spec/features/work_packages/details/query_groups/relation_query_group_spec.rb
+++ b/spec/features/work_packages/details/query_groups/relation_query_group_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package with relation query group', :js, :selenium do
- include_context 'ng-select-autocomplete helpers'
+RSpec.describe "Work package with relation query group", :js, :selenium do
+ include_context "ng-select-autocomplete helpers"
let(:user) { create(:admin) }
let(:project) { create(:project, types: [type]) }
@@ -60,8 +60,8 @@
let(:full_wp) { Pages::FullWorkPackage.new(work_package) }
let(:relations) { Components::WorkPackages::Relations.new(work_package) }
let(:tabs) { Components::WorkPackages::Tabs.new(work_package) }
- let(:relations_tab) { find('.op-tab-row--link', text: 'RELATIONS') }
- let(:embedded_table) { Pages::EmbeddedWorkPackagesTable.new(first('wp-single-view .work-packages-embedded-view--container')) }
+ let(:relations_tab) { find(".op-tab-row--link", text: "RELATIONS") }
+ let(:embedded_table) { Pages::EmbeddedWorkPackagesTable.new(first("wp-single-view .work-packages-embedded-view--container")) }
let(:visit) { true }
@@ -80,14 +80,14 @@
end
end
- context 'children table' do
- it 'creates and removes across all tables' do
+ context "children table" do
+ it "creates and removes across all tables" do
embedded_table.expect_work_package_count 1
relations_tab.click
relations.expect_child(related_work_package)
# Create new work package within embedded table
- embedded_table.table_container.find("button", text: I18n.t('js.relation_buttons.add_new_child')).click
+ embedded_table.table_container.find("button", text: I18n.t("js.relation_buttons.add_new_child")).click
subject_field = embedded_table.edit_field(nil, :subject)
subject_field.expect_active!
subject_field.set_value("Fresh WP\n")
@@ -107,7 +107,7 @@
end
end
- describe 'follower table with project filters' do
+ describe "follower table with project filters" do
let(:visit) { false }
let!(:project2) { create(:project, types: [type]) }
let!(:project3) { create(:project, types: [type]) }
@@ -123,17 +123,17 @@
let(:type) do
create(:type_with_relation_query_group, relation_filter: relation_type)
end
- let(:query_text) { 'Embedded Table for follows'.upcase }
+ let(:query_text) { "Embedded Table for follows".upcase }
before do
query = type.attribute_groups.last.query
- query.add_filter('project_id', '=', [project2.id, project3.id])
+ query.add_filter("project_id", "=", [project2.id, project3.id])
# User has no permission to save, avoid creating another user to allow it
query.save!(validate: false)
type.save!
end
- context 'with a user who has permission in one project' do
+ context "with a user who has permission in one project" do
let(:role) { create(:project_role, permissions:) }
let(:permissions) { %i[view_work_packages add_work_packages edit_work_packages manage_work_package_relations] }
let(:user) do
@@ -146,24 +146,24 @@
member.save!
end
- it 'can load the query and inline create' do
+ it "can load the query and inline create" do
full_wp.visit!
full_wp.ensure_page_loaded
- expect(page).to have_css('.attributes-group--header-text', text: query_text, wait: 20)
+ expect(page).to have_css(".attributes-group--header-text", text: query_text, wait: 20)
embedded_table.expect_work_package_listed related_work_package
embedded_table.click_inline_create
subject_field = embedded_table.edit_field(nil, :subject)
subject_field.expect_active!
- subject_field.set_value 'Another subject'
+ subject_field.set_value "Another subject"
subject_field.save!
- embedded_table.expect_work_package_subject 'Another subject'
+ embedded_table.expect_work_package_subject "Another subject"
end
end
- context 'with a user who has no permission in any project' do
+ context "with a user who has no permission in any project" do
let(:role) { create(:project_role, permissions:) }
let(:permissions) { [:view_work_packages] }
let(:user) do
@@ -171,18 +171,18 @@
member_with_roles: { project => role })
end
- it 'hides that group automatically without showing an error' do
+ it "hides that group automatically without showing an error" do
full_wp.visit!
full_wp.ensure_page_loaded
# Will first try to load the query, and then hide it.
- expect(page).to have_no_css('.attributes-group--header-text', text: query_text, wait: 20)
- expect(page).to have_no_css('.work-packages-embedded-view--container .op-toast.-error')
+ expect(page).to have_no_css(".attributes-group--header-text", text: query_text, wait: 20)
+ expect(page).to have_no_css(".work-packages-embedded-view--container .op-toast.-error")
end
end
end
- context 'follower table' do
+ context "follower table" do
let(:relation_type) { :follows }
let(:relation_target) { work_package }
let!(:independent_work_package) do
@@ -196,23 +196,23 @@
relations.expect_relation(related_work_package)
end
- it 'creates and removes across all tables' do
- embedded_table.table_container.find('button', text: I18n.t('js.relation_buttons.create_new')).click
+ it "creates and removes across all tables" do
+ embedded_table.table_container.find("button", text: I18n.t("js.relation_buttons.create_new")).click
subject_field = embedded_table.edit_field(nil, :subject)
subject_field.expect_active!
subject_field.set_value("Fresh WP\n")
- expect(embedded_table.table_container).to have_text('Fresh WP', wait: 10)
- relations.expect_relation_by_text('Fresh WP')
+ expect(embedded_table.table_container).to have_text("Fresh WP", wait: 10)
+ relations.expect_relation_by_text("Fresh WP")
end
- it 'add existing, remove it, add it from relations tab, remove from relations tab' do
- embedded_table.table_container.find('button', text: I18n.t('js.relation_buttons.add_existing')).click
- embedded_table.table_container.find('.wp-relations-create--form', wait: 10)
+ it "add existing, remove it, add it from relations tab, remove from relations tab" do
+ embedded_table.table_container.find("button", text: I18n.t("js.relation_buttons.add_existing")).click
+ embedded_table.table_container.find(".wp-relations-create--form", wait: 10)
autocomplete = page.find_test_selector("wp-relations-autocomplete")
select_autocomplete autocomplete,
- results_selector: '.ng-dropdown-panel-items',
+ results_selector: ".ng-dropdown-panel-items",
query: independent_work_package.subject,
select_text: independent_work_package.subject
@@ -239,9 +239,9 @@
# Check that deletion of relations still work after a page reload
full_wp.visit!
- relations_tab = find('.op-tab-row--link', text: 'RELATIONS')
+ relations_tab = find(".op-tab-row--link", text: "RELATIONS")
relations = Components::WorkPackages::Relations.new(work_package)
- embedded_table = Pages::EmbeddedWorkPackagesTable.new(first('wp-single-view .work-packages-embedded-view--container'))
+ embedded_table = Pages::EmbeddedWorkPackagesTable.new(first("wp-single-view .work-packages-embedded-view--container"))
embedded_table.table_container.find(".wp-row-#{independent_work_package.id}-table").hover
embedded_table.table_container.find("#{row} .wp-table-action--unlink").click
diff --git a/spec/features/work_packages/details/relations/hierarchy_custom_fields_spec.rb b/spec/features/work_packages/details/relations/hierarchy_custom_fields_spec.rb
index cae9d3d05c8d..025152922fa7 100644
--- a/spec/features/work_packages/details/relations/hierarchy_custom_fields_spec.rb
+++ b/spec/features/work_packages/details/relations/hierarchy_custom_fields_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'creating a child directly after the wp itself was created', :js do
+RSpec.describe "creating a child directly after the wp itself was created", :js do
let(:user) { create(:admin) }
let(:project) { create(:project, types: [type]) }
let(:wp_page) { Pages::FullWorkPackageCreate.new }
@@ -38,10 +38,10 @@
let(:type) { create(:type, custom_fields: [custom_field]) }
let(:custom_field) do
create(:work_package_custom_field,
- field_format: 'int',
+ field_format: "int",
is_for_all: true)
end
- let(:relations_tab) { find('.op-tab-row--link', text: 'RELATIONS') }
+ let(:relations_tab) { find(".op-tab-row--link", text: "RELATIONS") }
before do
login_as user
@@ -50,28 +50,28 @@
loading_indicator_saveguard
end
- it 'keeps its custom field values (regression #29511, #29446)' do
+ it "keeps its custom field values (regression #29511, #29446)" do
# Set subject
subject = wp_page.edit_field :subject
- subject.set_value 'My subject'
+ subject.set_value "My subject"
# Set CF
cf = wp_page.edit_field custom_field.attribute_name(:camel_case)
- cf.set_value '42'
+ cf.set_value "42"
# Save WP
wp_page.save!
- wp_page.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_page.expect_and_dismiss_toaster(message: "Successful creation.")
# Add child
scroll_to_and_click relations_tab
- find_test_selector('op-wp-inline-create').click
- fill_in 'wp-new-inline-edit--field-subject', with: 'A child WP'
- find_by_id('wp-new-inline-edit--field-subject').native.send_keys(:return)
+ find_test_selector("op-wp-inline-create").click
+ fill_in "wp-new-inline-edit--field-subject", with: "A child WP"
+ find_by_id("wp-new-inline-edit--field-subject").native.send_keys(:return)
# Expect CF value to be still visible
- wp_page.expect_and_dismiss_toaster(message: 'Successful creation.')
- expect(wp_page).to have_test_selector('tab-count', text: "(1)")
- wp_page.expect_attributes "customField#{custom_field.id}": '42'
+ wp_page.expect_and_dismiss_toaster(message: "Successful creation.")
+ expect(wp_page).to have_test_selector("tab-count", text: "(1)")
+ wp_page.expect_attributes "customField#{custom_field.id}": "42"
end
end
diff --git a/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb b/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb
index 325771c868b5..952c7c371ec9 100644
--- a/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb
+++ b/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'work package hierarchies for milestones', :js, :selenium do
+RSpec.describe "work package hierarchies for milestones", :js, :selenium do
let(:user) { create(:admin) }
let(:type) { create(:type, is_milestone: true) }
let(:project) { create(:project, types: [type]) }
@@ -37,22 +37,22 @@
let(:tabs) { Components::WorkPackages::Tabs.new(work_package) }
let(:wp_page) { Pages::FullWorkPackage.new(work_package) }
- let(:relations_tab) { find('.op-tab-row--link_selected', text: 'RELATIONS') }
+ let(:relations_tab) { find(".op-tab-row--link_selected", text: "RELATIONS") }
let(:visit) { true }
before do
login_as user
- wp_page.visit_tab!('relations')
+ wp_page.visit_tab!("relations")
expect_angular_frontend_initialized
wp_page.expect_subject
loading_indicator_saveguard
end
- it 'does not provide links to add children or existing children (Regression #28745)' do
- within('.wp-relations--children') do
- expect(page).to have_no_text('Add existing child')
- expect(page).to have_no_text('Create new child')
- expect(page).to have_no_css('wp-inline-create--add-link')
+ it "does not provide links to add children or existing children (Regression #28745)" do
+ within(".wp-relations--children") do
+ expect(page).to have_no_text("Add existing child")
+ expect(page).to have_no_text("Create new child")
+ expect(page).to have_no_css("wp-inline-create--add-link")
end
end
end
diff --git a/spec/features/work_packages/details/relations/hierarchy_spec.rb b/spec/features/work_packages/details/relations/hierarchy_spec.rb
index b4f0ccf80405..d22a198d1875 100644
--- a/spec/features/work_packages/details/relations/hierarchy_spec.rb
+++ b/spec/features/work_packages/details/relations/hierarchy_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.shared_examples 'work package relations tab', :js, :selenium do
- include_context 'ng-select-autocomplete helpers'
+RSpec.shared_examples "work package relations tab", :js, :selenium do
+ include_context "ng-select-autocomplete helpers"
let(:user) { create(:admin) }
@@ -38,7 +38,7 @@
let(:relations) { Components::WorkPackages::Relations.new(work_package) }
let(:tabs) { Components::WorkPackages::Tabs.new(work_package) }
- let(:relations_tab) { find('.op-tab-row--link_selected', text: 'RELATIONS') }
+ let(:relations_tab) { find(".op-tab-row--link_selected", text: "RELATIONS") }
let(:visit) { true }
@@ -51,18 +51,18 @@
end
def visit_relations
- wp_page.visit_tab!('relations')
+ wp_page.visit_tab!("relations")
expect_angular_frontend_initialized
wp_page.expect_subject
loading_indicator_saveguard
end
- describe 'as admin' do
- let!(:parent) { create(:work_package, project:, subject: 'Parent WP') }
- let!(:child) { create(:work_package, project:, subject: 'Child WP') }
- let!(:child2) { create(:work_package, project:, subject: 'Another child WP') }
+ describe "as admin" do
+ let!(:parent) { create(:work_package, project:, subject: "Parent WP") }
+ let!(:child) { create(:work_package, project:, subject: "Child WP") }
+ let!(:child2) { create(:work_package, project:, subject: "Another child WP") }
- it 'allows to manage hierarchy' do
+ it "allows to manage hierarchy" do
# Add parent
relations.add_parent(parent.id, parent)
relations.expect_parent(parent)
@@ -85,11 +85,11 @@ def visit_relations
tabs.expect_counter(relations_tab, 2)
end
- context 'when switching to custom field with required CF' do
+ context "when switching to custom field with required CF" do
let(:custom_field) do
create(
:work_package_custom_field,
- field_format: 'string',
+ field_format: "string",
default_value: nil,
is_required: true,
is_for_all: true
@@ -106,36 +106,36 @@ def visit_relations
custom_field
end
- it 'shows the required field when switching' do
- relations.inline_create_child 'my new child'
+ it "shows the required field when switching" do
+ relations.inline_create_child "my new child"
table = relations.children_table
- table.expect_work_package_subject 'my new child'
- wp = WorkPackage.find_by!(subject: 'my new child')
+ table.expect_work_package_subject "my new child"
+ wp = WorkPackage.find_by!(subject: "my new child")
type_field = table.edit_field(wp, :type)
type_field.activate!
type_field.set_value type2.name
wp_page.expect_toast message: "#{custom_field.name} can't be blank.",
- type: 'error'
+ type: "error"
cf_field = wp_page.edit_field(custom_field.attribute_name(:camel_case))
cf_field.expect_active!
- cf_field.expect_value('')
+ cf_field.expect_value("")
- cf_field.set_value 'my value'
+ cf_field.set_value "my value"
cf_field.save!
wp_page.expect_toast message: "Successful update.",
- type: 'success'
+ type: "success"
wp.reload
- expect(wp.custom_value_for(custom_field).value).to eq 'my value'
+ expect(wp.custom_value_for(custom_field).value).to eq "my value"
end
end
- describe 'inline create' do
+ describe "inline create" do
let!(:status) { create(:status, is_default: true) }
let!(:priority) { create(:priority, is_default: true) }
let(:type_bug) { create(:type_bug) }
@@ -143,11 +143,11 @@ def visit_relations
create(:project, types: [type_bug])
end
- it 'can inline-create children' do
- relations.inline_create_child 'my new child'
+ it "can inline-create children" do
+ relations.inline_create_child "my new child"
table = relations.children_table
- table.expect_work_package_subject 'my new child'
+ table.expect_work_package_subject "my new child"
work_package.reload
expect(work_package.children.count).to eq(1)
@@ -157,7 +157,7 @@ def visit_relations
end
end
- describe 'relation group-by toggler' do
+ describe "relation group-by toggler" do
let(:project) { create(:project, types: [type1, type2]) }
let(:type1) { create(:type) }
let(:type2) { create(:type) }
@@ -178,18 +178,18 @@ def visit_relations
relation_type: Relation::TYPE_RELATES)
end
- let(:toggle_btn_selector) { '#wp-relation-group-by-toggle' }
+ let(:toggle_btn_selector) { "#wp-relation-group-by-toggle" }
let(:visit) { false }
before do
visit_relations
- wp_page.visit_tab!('relations')
+ wp_page.visit_tab!("relations")
wp_page.expect_subject
loading_indicator_saveguard
end
- describe 'with limited permissions' do
+ describe "with limited permissions" do
let(:permissions) { %i(view_work_packages) }
let(:user_role) do
create(:project_role, permissions:)
@@ -200,41 +200,41 @@ def visit_relations
member_with_roles: { project => user_role })
end
- context 'as view-only user, with parent set' do
- let!(:parent) { create(:work_package, project:, subject: 'Parent WP') }
- let!(:work_package) { create(:work_package, parent:, project:, subject: 'Child WP') }
+ context "as view-only user, with parent set" do
+ let!(:parent) { create(:work_package, project:, subject: "Parent WP") }
+ let!(:work_package) { create(:work_package, parent:, project:, subject: "Child WP") }
- it 'shows no links to create relations' do
+ it "shows no links to create relations" do
# No create buttons should exist
- expect(page).to have_no_css('.wp-relations-create-button')
+ expect(page).to have_no_css(".wp-relations-create-button")
# Test for add relation
- expect(page).to have_no_css('#relation--add-relation')
+ expect(page).to have_no_css("#relation--add-relation")
# Test for add parent
- expect(page).to have_no_css('.wp-relation--parent-change')
+ expect(page).to have_no_css(".wp-relation--parent-change")
# Test for add children
- expect(page).to have_no_css('#hierarchy--add-existing-child')
- expect(page).to have_no_css('#hierarchy--add-new-child')
+ expect(page).to have_no_css("#hierarchy--add-existing-child")
+ expect(page).to have_no_css("#hierarchy--add-new-child")
# But it should show the linked parent
- expect(page).to have_test_selector('op-wp-breadcrumb-parent', text: parent.subject)
+ expect(page).to have_test_selector("op-wp-breadcrumb-parent", text: parent.subject)
# And it should count the two relations
tabs.expect_counter(relations_tab, 2)
end
end
- context 'with manage_subtasks permissions' do
+ context "with manage_subtasks permissions" do
let(:permissions) { %i(view_work_packages manage_subtasks) }
- let!(:parent) { create(:work_package, project:, subject: 'Parent WP') }
- let!(:child) { create(:work_package, project:, subject: 'Child WP') }
+ let!(:parent) { create(:work_package, project:, subject: "Parent WP") }
+ let!(:child) { create(:work_package, project:, subject: "Child WP") }
- it 'is able to link parent and children' do
+ it "is able to link parent and children" do
# Add parent
relations.add_parent(parent.id, parent)
- wp_page.expect_and_dismiss_toaster(message: 'Successful update.')
+ wp_page.expect_and_dismiss_toaster(message: "Successful update.")
relations.expect_parent(parent)
##
@@ -242,7 +242,7 @@ def visit_relations
relations.open_children_autocompleter
relations.add_existing_child(child)
- wp_page.expect_and_dismiss_toaster(message: 'Successful update.')
+ wp_page.expect_and_dismiss_toaster(message: "Successful update.")
relations.expect_child(child)
# Expect counter to add up child to the existing relations
@@ -250,7 +250,7 @@ def visit_relations
# Remove parent
relations.remove_parent
- wp_page.expect_and_dismiss_toaster(message: 'Successful update.')
+ wp_page.expect_and_dismiss_toaster(message: "Successful update.")
relations.expect_no_parent
# Remove child
@@ -266,14 +266,14 @@ def visit_relations
end
end
-RSpec.context 'Split screen' do
+RSpec.context "Split screen" do
let(:wp_page) { Pages::SplitWorkPackage.new(work_package) }
- it_behaves_like 'work package relations tab'
+ it_behaves_like "work package relations tab"
end
-RSpec.context 'Full screen' do
+RSpec.context "Full screen" do
let(:wp_page) { Pages::FullWorkPackage.new(work_package) }
- it_behaves_like 'work package relations tab'
+ it_behaves_like "work package relations tab"
end
diff --git a/spec/features/work_packages/details/relations/relations_spec.rb b/spec/features/work_packages/details/relations/relations_spec.rb
index 74e8ec108171..18456037b309 100644
--- a/spec/features/work_packages/details/relations/relations_spec.rb
+++ b/spec/features/work_packages/details/relations/relations_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package relations tab', :js, :selenium do
- include_context 'ng-select-autocomplete helpers'
+RSpec.describe "Work package relations tab", :js, :selenium do
+ include_context "ng-select-autocomplete helpers"
let(:user) { create(:admin) }
@@ -40,7 +40,7 @@
let(:relations) { Components::WorkPackages::Relations.new(work_package) }
let(:tabs) { Components::WorkPackages::Tabs.new(work_package) }
- let(:relations_tab) { find('.op-tab-row--link_selected', text: 'RELATIONS') }
+ let(:relations_tab) { find(".op-tab-row--link_selected", text: "RELATIONS") }
let(:visit) { true }
@@ -53,13 +53,13 @@
end
def visit_relations
- work_packages_page.visit_tab!('relations')
+ work_packages_page.visit_tab!("relations")
expect_angular_frontend_initialized
work_packages_page.expect_subject
loading_indicator_saveguard
end
- describe 'relation group-by toggler' do
+ describe "relation group-by toggler" do
let(:project) { create(:project, types: [type1, type2]) }
let(:type1) { create(:type) }
let(:type2) { create(:type) }
@@ -80,73 +80,73 @@ def visit_relations
relation_type: Relation::TYPE_RELATES)
end
- let(:toggle_btn_selector) { '#wp-relation-group-by-toggle' }
+ let(:toggle_btn_selector) { "#wp-relation-group-by-toggle" }
let(:visit) { false }
before do
visit_relations
- work_packages_page.visit_tab!('relations')
+ work_packages_page.visit_tab!("relations")
work_packages_page.expect_subject
loading_indicator_saveguard
- scroll_to_element find('.detail-panel--relations')
+ scroll_to_element find(".detail-panel--relations")
end
- it 'allows to toggle how relations are grouped' do
+ it "allows to toggle how relations are grouped" do
# Expect to be grouped by relation type by default
expect(page).to have_selector(toggle_btn_selector,
- text: 'Group by work package type', wait: 20)
+ text: "Group by work package type", wait: 20)
- expect(page).to have_css('.relation-group--header', text: 'FOLLOWS')
- expect(page).to have_css('.relation-group--header', text: 'RELATED TO')
+ expect(page).to have_css(".relation-group--header", text: "FOLLOWS")
+ expect(page).to have_css(".relation-group--header", text: "RELATED TO")
- expect(page).to have_css('.relation-row--type', text: type1.name.upcase)
- expect(page).to have_css('.relation-row--type', text: type2.name.upcase)
+ expect(page).to have_css(".relation-row--type", text: type1.name.upcase)
+ expect(page).to have_css(".relation-row--type", text: type2.name.upcase)
find(toggle_btn_selector).click
- expect(page).to have_selector(toggle_btn_selector, text: 'Group by relation type', wait: 10)
+ expect(page).to have_selector(toggle_btn_selector, text: "Group by relation type", wait: 10)
- expect(page).to have_css('.relation-group--header', text: type1.name.upcase)
- expect(page).to have_css('.relation-group--header', text: type2.name.upcase)
+ expect(page).to have_css(".relation-group--header", text: type1.name.upcase)
+ expect(page).to have_css(".relation-group--header", text: type2.name.upcase)
- expect(page).to have_css('.relation-row--type', text: 'Follows')
- expect(page).to have_css('.relation-row--type', text: 'Related To')
+ expect(page).to have_css(".relation-row--type", text: "Follows")
+ expect(page).to have_css(".relation-row--type", text: "Related To")
end
- it 'allows to edit relation types when toggled' do
+ it "allows to edit relation types when toggled" do
find(toggle_btn_selector).click
- expect(page).to have_selector(toggle_btn_selector, text: 'Group by relation type', wait: 20)
+ expect(page).to have_selector(toggle_btn_selector, text: "Group by relation type", wait: 20)
# Expect current to be follows and other one related
- expect(page).to have_css('.relation-row--type', text: 'Follows')
- expect(page).to have_css('.relation-row--type', text: 'Related To')
+ expect(page).to have_css(".relation-row--type", text: "Follows")
+ expect(page).to have_css(".relation-row--type", text: "Related To")
# edit to blocks
- relations.edit_relation_type(to1, to_type: 'Blocks')
+ relations.edit_relation_type(to1, to_type: "Blocks")
# the other one should not be altered
- expect(page).to have_css('.relation-row--type', text: 'Blocks')
- expect(page).to have_css('.relation-row--type', text: 'Related To')
+ expect(page).to have_css(".relation-row--type", text: "Blocks")
+ expect(page).to have_css(".relation-row--type", text: "Related To")
updated_relation = Relation.find(relation1.id)
- expect(updated_relation.relation_type).to eq('blocks')
+ expect(updated_relation.relation_type).to eq("blocks")
expect(updated_relation.from_id).to eq(work_package.id)
expect(updated_relation.to_id).to eq(to1.id)
- relations.edit_relation_type(to1, to_type: 'Blocked by')
+ relations.edit_relation_type(to1, to_type: "Blocked by")
- expect(page).to have_css('.relation-row--type', text: 'Blocked by')
- expect(page).to have_css('.relation-row--type', text: 'Related To')
+ expect(page).to have_css(".relation-row--type", text: "Blocked by")
+ expect(page).to have_css(".relation-row--type", text: "Related To")
updated_relation = Relation.find(relation1.id)
- expect(updated_relation.relation_type).to eq('blocks')
+ expect(updated_relation.relation_type).to eq("blocks")
expect(updated_relation.from_id).to eq(to1.id)
expect(updated_relation.to_id).to eq(work_package.id)
end
end
- describe 'with limited permissions' do
+ describe "with limited permissions" do
let(:permissions) { %i(view_work_packages) }
let(:user_role) do
create(:project_role, permissions:)
@@ -157,33 +157,33 @@ def visit_relations
member_with_roles: { project => user_role })
end
- context 'as view-only user, with parent set' do
+ context "as view-only user, with parent set" do
let(:work_package) { create(:work_package, project:) }
- it 'shows no links to create relations' do
+ it "shows no links to create relations" do
# No create buttons should exist
- expect(page).to have_no_css('.wp-relations-create-button')
+ expect(page).to have_no_css(".wp-relations-create-button")
# Test for add relation
- expect(page).to have_no_css('#relation--add-relation')
+ expect(page).to have_no_css("#relation--add-relation")
end
end
- context 'with relations permissions' do
+ context "with relations permissions" do
let(:permissions) do
%i(view_work_packages add_work_packages manage_subtasks manage_work_package_relations)
end
let!(:relatable) { create(:work_package, project:) }
- it 'allows to manage relations' do
- relations.add_relation(type: 'follows', to: relatable)
+ it "allows to manage relations" do
+ relations.add_relation(type: "follows", to: relatable)
# Relations counter badge should increase number of relations
tabs.expect_counter(relations_tab, 1)
relations.remove_relation(relatable)
- expect(page).to have_no_css('.relation-group--header', text: 'FOLLOWS')
+ expect(page).to have_no_css(".relation-group--header", text: "FOLLOWS")
# If there are no relations, the counter badge should not be displayed
tabs.expect_no_counter(relations_tab)
@@ -192,30 +192,30 @@ def visit_relations
expect(work_package.relations).to be_empty
end
- it 'allows to move between split and full view (Regression #24194)' do
- relations.add_relation(type: 'follows', to: relatable)
+ it "allows to move between split and full view (Regression #24194)" do
+ relations.add_relation(type: "follows", to: relatable)
# Relations counter should increase
tabs.expect_counter(relations_tab, 1)
# Switch to full view
- find('.work-packages--details-fullscreen-icon').click
+ find(".work-packages--details-fullscreen-icon").click
# Expect to have row
relations.hover_action(relatable, :delete)
- expect(page).to have_no_css('.relation-group--header', text: 'FOLLOWS')
- expect(page).to have_no_css('.wp-relations--subject-field', text: relatable.subject)
+ expect(page).to have_no_css(".relation-group--header", text: "FOLLOWS")
+ expect(page).to have_no_css(".wp-relations--subject-field", text: relatable.subject)
# Back to split view
- page.execute_script('window.history.back()')
+ page.execute_script("window.history.back()")
work_packages_page.expect_subject
- expect(page).to have_no_css('.relation-group--header', text: 'FOLLOWS')
- expect(page).to have_no_css('.wp-relations--subject-field', text: relatable.subject)
+ expect(page).to have_no_css(".relation-group--header", text: "FOLLOWS")
+ expect(page).to have_no_css(".wp-relations--subject-field", text: relatable.subject)
end
- it 'follows the relation links (Regression #26794)' do
- relations.add_relation(type: 'follows', to: relatable)
+ it "follows the relation links (Regression #26794)" do
+ relations.add_relation(type: "follows", to: relatable)
relations.click_relation(relatable)
subject = full_wp.edit_field(:subject)
@@ -226,54 +226,54 @@ def visit_relations
subject.expect_state_text work_package.subject
end
- it 'allows to change relation descriptions' do
- relations.add_relation(type: 'follows', to: relatable)
+ it "allows to change relation descriptions" do
+ relations.add_relation(type: "follows", to: relatable)
## Toggle description
relations.hover_action(relatable, :info)
# Open textarea
created_row = relations.find_row(relatable)
- created_row.find('.wp-relation--description-read-value.-placeholder',
- text: I18n.t('js.placeholders.relation_description')).click
+ created_row.find(".wp-relation--description-read-value.-placeholder",
+ text: I18n.t("js.placeholders.relation_description")).click
- expect(page).to have_focus_on('.wp-relation--description-textarea')
- textarea = created_row.find('.wp-relation--description-textarea')
- textarea.set 'my description!'
+ expect(page).to have_focus_on(".wp-relation--description-textarea")
+ textarea = created_row.find(".wp-relation--description-textarea")
+ textarea.set "my description!"
# Save description
- created_row.find('.inplace-edit--control--save').click
+ created_row.find(".inplace-edit--control--save").click
loading_indicator_saveguard
# Wait for the relations table to be present
sleep 2
- expect(page).to have_test_selector('op-relation--row-subject')
+ expect(page).to have_test_selector("op-relation--row-subject")
- scroll_to_element find('.detail-panel--relations')
+ scroll_to_element find(".detail-panel--relations")
## Toggle description again
retry_block do
relations.hover_action(relatable, :info)
created_row = relations.find_row(relatable)
- find '.wp-relation--description-read-value'
+ find ".wp-relation--description-read-value"
end
- created_row.find('.wp-relation--description-read-value',
- text: 'my description!').click
+ created_row.find(".wp-relation--description-read-value",
+ text: "my description!").click
# Cancel edition
- created_row.find('.inplace-edit--control--cancel').click
- created_row.find('.wp-relation--description-read-value',
- text: 'my description!').click
+ created_row.find(".inplace-edit--control--cancel").click
+ created_row.find(".wp-relation--description-read-value",
+ text: "my description!").click
relation = work_package.relations.first
- expect(relation.description).to eq('my description!')
+ expect(relation.description).to eq("my description!")
# Toggle to close
relations.hover_action(relatable, :info)
- expect(created_row).to have_no_css('.wp-relation--description-read-value')
+ expect(created_row).to have_no_css(".wp-relation--description-read-value")
end
end
end
diff --git a/spec/features/work_packages/details/workdays_spec.rb b/spec/features/work_packages/details/workdays_spec.rb
index c736a72345ec..e6f30bce626b 100644
--- a/spec/features/work_packages/details/workdays_spec.rb
+++ b/spec/features/work_packages/details/workdays_spec.rb
@@ -26,16 +26,16 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/page_objects/notification'
-require 'features/work_packages/details/inplace_editor/shared_examples'
-require 'features/work_packages/shared_contexts'
-require 'support/edit_fields/edit_field'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/page_objects/notification"
+require "features/work_packages/details/inplace_editor/shared_examples"
+require "features/work_packages/shared_contexts"
+require "support/edit_fields/edit_field"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'Work packages datepicker workdays', :js, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe "Work packages datepicker workdays", :js, with_settings: { date_format: "%Y-%m-%d" } do
shared_let(:project) { create(:project_with_types, public: true) }
- shared_let(:work_package) { create(:work_package, project:, start_date: Date.parse('2022-01-01')) }
+ shared_let(:work_package) { create(:work_package, project:, start_date: Date.parse("2022-01-01")) }
shared_let(:user) { create(:admin) }
shared_let(:work_packages_page) { Pages::FullWorkPackage.new(work_package, project) }
@@ -51,21 +51,21 @@
combined_date.expect_active!
end
- context 'with default work days' do
+ context "with default work days" do
shared_let(:working_days) { week_with_saturday_and_sunday_as_weekend }
- it 'shows them as disabled' do
- expect(page).to have_css('.dayContainer', count: 2)
+ it "shows them as disabled" do
+ expect(page).to have_css(".dayContainer", count: 2)
weekend_days = %w[1 2 8 9 15 16 22 23 29 30].map(&:to_i)
weekend_days.each do |weekend_day|
- expect(page).to have_css('.dayContainer:first-of-type .flatpickr-day.flatpickr-non-working-day',
+ expect(page).to have_css(".dayContainer:first-of-type .flatpickr-day.flatpickr-non-working-day",
text: weekend_day,
exact_text: true)
end
((1..31).to_a - weekend_days).each do |workday|
- expect(page).to have_css('.dayContainer:first-of-type .flatpickr-day:not(.flatpickr-non-working-day)',
+ expect(page).to have_css(".dayContainer:first-of-type .flatpickr-day:not(.flatpickr-non-working-day)",
text: workday,
exact_text: true)
end
diff --git a/spec/features/work_packages/display_fields/date_field_display_spec.rb b/spec/features/work_packages/display_fields/date_field_display_spec.rb
index 3cbcae25ee2b..5d08592694f1 100644
--- a/spec/features/work_packages/display_fields/date_field_display_spec.rb
+++ b/spec/features/work_packages/display_fields/date_field_display_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Show the date of a Work Package', :js do
+RSpec.describe "Show the date of a Work Package", :js do
let(:project) { create(:project) }
let(:admin) { create(:admin) }
let(:work_package) do
@@ -52,22 +52,22 @@
new_status: closed_status)
end
- context 'with an overdue date' do
+ context "with an overdue date" do
before do
login_as(admin)
wp_page.visit!
end
- it 'is highlighted only if the WP status is open (#33457)' do
+ it "is highlighted only if the WP status is open (#33457)" do
# Highlighted with an open status
- expect(page).to have_css('.inline-edit--display-field.combinedDate .__hl_date_overdue')
+ expect(page).to have_css(".inline-edit--display-field.combinedDate .__hl_date_overdue")
# Change status to closed
status_field = WorkPackageStatusField.new(page)
status_field.update(closed_status.name)
# Not highlighted with a closed status
- expect(page).to have_no_css('.inline-edit--display-field.combinedDate .__hl_date_overdue')
+ expect(page).to have_no_css(".inline-edit--display-field.combinedDate .__hl_date_overdue")
end
end
end
diff --git a/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb b/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb
index c67d9a50703f..3b571e999586 100644
--- a/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb
+++ b/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Estimated hours display', :js do
+RSpec.describe "Estimated hours display", :js do
shared_let(:project) { create(:project) }
shared_let(:user) { create(:admin) }
shared_let(:wiki_page) { create(:wiki_page, wiki: project.wiki) }
@@ -58,8 +58,8 @@
login_as(user)
end
- shared_examples 'estimated time display' do |expected_text:|
- it 'work package index' do
+ shared_examples "estimated time display" do |expected_text:|
+ it "work package index" do
wp_table.visit_query query
wp_table.expect_work_package_listed child
@@ -68,19 +68,19 @@
)
end
- it 'work package details' do
+ it "work package details" do
visit work_package_path(parent.id)
expect(page).to have_content("Work\n#{expected_text}")
end
- it 'wiki page workPackageValue:id:estimatedTime macro' do
+ it "wiki page workPackageValue:id:estimatedTime macro" do
visit edit_project_wiki_path(project, wiki_page.id)
editor.set_markdown("workPackageValue:#{parent.id}:estimatedTime")
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.wiki-content', text: expected_text)
+ expect(page).to have_css(".wiki-content", text: expected_text)
end
end
@@ -91,7 +91,7 @@
child | 3h |
TABLE
- include_examples 'estimated time display', expected_text: '1 h·Σ 4 h'
+ include_examples "estimated time display", expected_text: "1 h·Σ 4 h"
end
context "with just work" do
@@ -101,7 +101,7 @@
child | 0h |
TABLE
- include_examples 'estimated time display', expected_text: '1 h'
+ include_examples "estimated time display", expected_text: "1 h"
end
context "with just derived work with (parent work 0 h)" do
@@ -111,7 +111,7 @@
child | 3h |
TABLE
- include_examples 'estimated time display', expected_text: '0 h·Σ 3 h'
+ include_examples "estimated time display", expected_text: "0 h·Σ 3 h"
end
context "with just derived work (parent work unset)" do
@@ -121,7 +121,7 @@
child | 3h |
TABLE
- include_examples 'estimated time display', expected_text: '-·Σ 3 h'
+ include_examples "estimated time display", expected_text: "-·Σ 3 h"
end
context "with neither work nor derived work (both 0 h)" do
@@ -131,7 +131,7 @@
child | 0h |
TABLE
- include_examples 'estimated time display', expected_text: '0 h'
+ include_examples "estimated time display", expected_text: "0 h"
end
context "with neither work nor derived work (both unset)" do
@@ -141,10 +141,10 @@
child | |
TABLE
- include_examples 'estimated time display', expected_text: '-'
+ include_examples "estimated time display", expected_text: "-"
end
- describe 'link to detailed view' do
+ describe "link to detailed view" do
let_work_packages(<<~TABLE)
hierarchy | work |
parent | 5h |
@@ -158,7 +158,7 @@
# Run UpdateAncestorsService on the grand child to update the whole hierarchy derived values
let(:initiator_work_package) { grand_child21 }
- it 'displays a link to a detailed view explaining work calculation' do
+ it "displays a link to a detailed view explaining work calculation" do
wp_table.visit_query query
# parent
@@ -169,29 +169,29 @@
expect(page).to have_link("Σ 15 h")
end
- context 'when clicking the link of a top parent' do
+ context "when clicking the link of a top parent" do
before do
visit work_package_path(parent)
end
- it 'shows a work package table with a parent filter to list the direct children' do
+ it "shows a work package table with a parent filter to list the direct children" do
click_on("Σ 20 h")
wp_table.expect_work_package_count(4)
wp_table.expect_work_package_listed(parent, child1, child2, child3)
within(:table) do
- expect(page).to have_columnheader('Work')
- expect(page).to have_columnheader('Remaining work')
+ expect(page).to have_columnheader("Work")
+ expect(page).to have_columnheader("Remaining work")
end
end
end
- context 'when clicking the link of an intermediate parent' do
+ context "when clicking the link of an intermediate parent" do
before do
visit work_package_path(child2)
end
- it 'shows also all ancestors in the work package table' do
+ it "shows also all ancestors in the work package table" do
expect(page).to have_content("Work\n3 h·Σ 15 h")
click_on("Σ 15 h")
diff --git a/spec/features/work_packages/display_fields/spent_time_display_spec.rb b/spec/features/work_packages/display_fields/spent_time_display_spec.rb
index 06aa0c026b49..ed7da8592b33 100644
--- a/spec/features/work_packages/display_fields/spent_time_display_spec.rb
+++ b/spec/features/work_packages/display_fields/spent_time_display_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Logging time within the work package view', :js do
+RSpec.describe "Logging time within the work package view", :js do
shared_let(:project) { create(:project) }
shared_let(:admin) { create(:admin) }
shared_let(:work_package) { create(:work_package, project:) }
@@ -36,7 +36,7 @@
let(:user) { admin }
- let(:spent_time_field) { SpentTimeEditField.new(page, 'spentTime') }
+ let(:spent_time_field) { SpentTimeEditField.new(page, "spentTime") }
let(:wp_page) { Pages::FullWorkPackage.new(work_package, project) }
@@ -46,12 +46,12 @@ def log_time_via_modal(user_field_visible: true, log_for_user: nil, date: Time.z
time_logging_modal.is_visible true
# the fields are visible
- time_logging_modal.has_field_with_value 'spent_on', Time.zone.today.strftime("%Y-%m-%d")
- time_logging_modal.shows_field 'work_package', false
- time_logging_modal.shows_field 'user', user_field_visible
+ time_logging_modal.has_field_with_value "spent_on", Time.zone.today.strftime("%Y-%m-%d")
+ time_logging_modal.shows_field "work_package", false
+ time_logging_modal.shows_field "user", user_field_visible
# Update the fields
- time_logging_modal.update_field 'activity', activity.name
+ time_logging_modal.update_field "activity", activity.name
Components::BasicDatepicker.update_field(
"##{time_logging_modal.field_identifier('spent_on')}",
@@ -59,17 +59,17 @@ def log_time_via_modal(user_field_visible: true, log_for_user: nil, date: Time.z
)
if log_for_user
- time_logging_modal.update_field 'user', log_for_user.name
+ time_logging_modal.update_field "user", log_for_user.name
elsif user_field_visible
- expect(page).to have_css('.ng-value-label', text: user.name)
+ expect(page).to have_css(".ng-value-label", text: user.name)
end
# a click on save creates a time entry
time_logging_modal.perform_action I18n.t(:button_save)
- wp_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_create')
+ wp_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_create")
end
- context 'as an admin' do
+ context "as an admin" do
before do
login_as(user)
wp_page.visit!
@@ -77,7 +77,7 @@ def log_time_via_modal(user_field_visible: true, log_for_user: nil, date: Time.z
spent_time_field.time_log_icon_visible true
end
- it 'shows a logging button within the display field and can log time via a modal' do
+ it "shows a logging button within the display field and can log time via a modal" do
# click on button opens modal
spent_time_field.open_time_log_modal
expect do
@@ -85,7 +85,7 @@ def log_time_via_modal(user_field_visible: true, log_for_user: nil, date: Time.z
end.to change(TimeEntry, :count).by(1)
# the value is updated automatically
- spent_time_field.expect_display_value '1 h'
+ spent_time_field.expect_display_value "1 h"
TimeEntry.last.tap do |te|
expect(te.work_package).to eq(work_package)
@@ -97,22 +97,22 @@ def log_time_via_modal(user_field_visible: true, log_for_user: nil, date: Time.z
end
end
- context 'with another user in the project' do
+ context "with another user in the project" do
let!(:other_user) do
create(:user,
- firstname: 'Loggable',
- lastname: 'User',
+ firstname: "Loggable",
+ lastname: "User",
member_with_permissions: { project => %i[view_work_packages edit_work_packages work_package_assigned] })
end
- it 'can log time for that user' do
+ it "can log time for that user" do
# click on button opens modal
spent_time_field.open_time_log_modal
log_time_via_modal log_for_user: other_user
# the value is updated automatically
- spent_time_field.expect_display_value '1 h'
+ spent_time_field.expect_display_value "1 h"
time_entry = TimeEntry.last
expect(time_entry.user).to eq other_user
@@ -120,37 +120,37 @@ def log_time_via_modal(user_field_visible: true, log_for_user: nil, date: Time.z
end
end
- it 'the context menu entry to log time leads to the modal' do
+ it "the context menu entry to log time leads to the modal" do
# click on context menu opens the modal
- find('#action-show-more-dropdown-menu .button').click
- find('.menu-item', text: 'Log time').click
+ find("#action-show-more-dropdown-menu .button").click
+ find(".menu-item", text: "Log time").click
log_time_via_modal
# the value is updated automatically
- spent_time_field.expect_display_value '1 h'
+ spent_time_field.expect_display_value "1 h"
end
- context 'with a user with non-one unit numbers', with_settings: { available_languages: %w[en ja] } do
- let(:user) { create(:admin, language: 'ja') }
+ context "with a user with non-one unit numbers", with_settings: { available_languages: %w[en ja] } do
+ let(:user) { create(:admin, language: "ja") }
before do
- I18n.locale = 'ja'
+ I18n.locale = "ja"
end
- it 'shows the correct number (Regression #36269)' do
+ it "shows the correct number (Regression #36269)" do
# click on button opens modal
spent_time_field.open_time_log_modal
log_time_via_modal
# the value is updated automatically
- spent_time_field.expect_display_value '1 h'
+ spent_time_field.expect_display_value "1 h"
end
end
end
- context 'as a user who cannot log time' do
+ context "as a user who cannot log time" do
let(:user) do
create(:user,
member_with_permissions: { project => %i[view_time_entries view_work_packages edit_work_packages] })
@@ -162,13 +162,13 @@ def log_time_via_modal(user_field_visible: true, log_for_user: nil, date: Time.z
loading_indicator_saveguard
end
- it 'shows no logging button within the display field' do
+ it "shows no logging button within the display field" do
spent_time_field.time_log_icon_visible false
- spent_time_field.expect_display_value '0 h'
+ spent_time_field.expect_display_value "0 h"
end
end
- context 'as a user who can only log own time' do
+ context "as a user who can only log own time" do
let(:user) do
create(:user,
member_with_permissions: { project => %i[view_time_entries view_work_packages log_own_time] })
@@ -180,7 +180,7 @@ def log_time_via_modal(user_field_visible: true, log_for_user: nil, date: Time.z
loading_indicator_saveguard
end
- it 'can log its own time' do
+ it "can log its own time" do
spent_time_field.time_log_icon_visible true
# click on button opens modal
spent_time_field.open_time_log_modal
@@ -188,14 +188,14 @@ def log_time_via_modal(user_field_visible: true, log_for_user: nil, date: Time.z
log_time_via_modal user_field_visible: false
# the value is updated automatically
- spent_time_field.expect_display_value '1 h'
+ spent_time_field.expect_display_value "1 h"
end
end
- context 'when in the table' do
+ context "when in the table" do
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:second_work_package) { create(:work_package, project:) }
- let(:query) { create(:public_query, project:, column_names: ['subject', 'spent_hours']) }
+ let(:query) { create(:public_query, project:, column_names: ["subject", "spent_hours"]) }
before do
work_package
@@ -206,15 +206,15 @@ def log_time_via_modal(user_field_visible: true, log_for_user: nil, date: Time.z
loading_indicator_saveguard
end
- it 'shows no logging button within the display field' do
+ it "shows no logging button within the display field" do
wp_table.expect_work_package_listed work_package, second_work_package
- find('tr:nth-of-type(1) .wp-table--cell-td.spentTime .icon-time').click
+ find("tr:nth-of-type(1) .wp-table--cell-td.spentTime .icon-time").click
log_time_via_modal
- expect(page).to have_css('tr:nth-of-type(1) .wp-table--cell-td.spentTime', text: '1 h')
- expect(page).to have_css('tr:nth-of-type(2) .wp-table--cell-td.spentTime', text: '0 h')
+ expect(page).to have_css("tr:nth-of-type(1) .wp-table--cell-td.spentTime", text: "1 h")
+ expect(page).to have_css("tr:nth-of-type(2) .wp-table--cell-td.spentTime", text: "0 h")
end
end
end
diff --git a/spec/features/work_packages/display_representations/switch_display_representations_on_mobile_spec.rb b/spec/features/work_packages/display_representations/switch_display_representations_on_mobile_spec.rb
index 12c5fd59a2fb..caf09abd1c88 100644
--- a/spec/features/work_packages/display_representations/switch_display_representations_on_mobile_spec.rb
+++ b/spec/features/work_packages/display_representations/switch_display_representations_on_mobile_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Switching work package view on mobile', :js do
+RSpec.describe "Switching work package view on mobile", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -53,21 +53,21 @@
wp_table.expect_work_package_listed wp_1, wp_2
end
- context 'switching to mobile card view' do
- include_context 'with mobile screen size'
+ context "switching to mobile card view" do
+ include_context "with mobile screen size"
- it 'can switch the representation automatically on mobile after a refresh' do
+ it "can switch the representation automatically on mobile after a refresh" do
# It shows the elements as cards
cards.expect_work_package_listed wp_1, wp_2
# A single click leads to the full view
cards.select_work_package(wp_1)
- expect(page).to have_css('.work-packages--details--subject',
+ expect(page).to have_css(".work-packages--details--subject",
text: wp_1.subject)
- page.find('.work-packages-back-button').click
+ page.find(".work-packages-back-button").click
# The query is however unchanged
- expect(page).to have_no_css('.editable-toolbar-title--save')
+ expect(page).to have_no_css(".editable-toolbar-title--save")
url = URI.parse(page.current_url).query
expect(url).not_to match(/query_props=.+/)
diff --git a/spec/features/work_packages/edit_on_assign_version_permission_spec.rb b/spec/features/work_packages/edit_on_assign_version_permission_spec.rb
index a4937cd633dd..b02566b81d2b 100644
--- a/spec/features/work_packages/edit_on_assign_version_permission_spec.rb
+++ b/spec/features/work_packages/edit_on_assign_version_permission_spec.rb
@@ -1,17 +1,17 @@
-require 'spec_helper'
-require 'features/page_objects/notification'
+require "spec_helper"
+require "features/page_objects/notification"
-RSpec.describe 'edit work package', :js do
+RSpec.describe "edit work package", :js do
let(:current_user) do
create(:user,
- firstname: 'Dev',
- lastname: 'Guy',
+ firstname: "Dev",
+ lastname: "Guy",
member_with_permissions: { project => permissions })
end
let(:permissions) { %i[view_work_packages assign_versions] }
let(:cf_all) do
- create(:work_package_custom_field, is_for_all: true, field_format: 'text')
+ create(:work_package_custom_field, is_for_all: true, field_format: "text")
end
let(:type) { create(:type, custom_fields: [cf_all]) }
@@ -39,23 +39,23 @@ def visit!
visit!
end
- context 'as a user having only the assign_versions permission' do
- it 'can only change the version' do
+ context "as a user having only the assign_versions permission" do
+ it "can only change the version" do
wp_page.update_attributes version: version.name
- wp_page.expect_toast(message: 'Successful update')
+ wp_page.expect_toast(message: "Successful update")
wp_page.expect_attributes version: version.name
- subject_field = wp_page.work_package_field('subject')
+ subject_field = wp_page.work_package_field("subject")
subject_field.expect_read_only
end
end
- context 'as a user having only the edit_work_packages permission' do
+ context "as a user having only the edit_work_packages permission" do
let(:permissions) { %i[view_work_packages edit_work_packages] }
- it 'can not change the version' do
- version_field = wp_page.work_package_field('version')
+ it "can not change the version" do
+ version_field = wp_page.work_package_field("version")
version_field.expect_read_only
end
end
diff --git a/spec/features/work_packages/edit_on_change_work_package_status_permission_spec.rb b/spec/features/work_packages/edit_on_change_work_package_status_permission_spec.rb
index 194f8c9e6b04..cd0b86a91857 100644
--- a/spec/features/work_packages/edit_on_change_work_package_status_permission_spec.rb
+++ b/spec/features/work_packages/edit_on_change_work_package_status_permission_spec.rb
@@ -26,14 +26,14 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/page_objects/notification'
+require "spec_helper"
+require "features/page_objects/notification"
-RSpec.describe 'edit work package', :js do
+RSpec.describe "edit work package", :js do
let(:current_user) do
create(:user,
- firstname: 'Dev',
- lastname: 'Guy',
+ firstname: "Dev",
+ lastname: "Guy",
member_with_roles: { project => role })
end
let(:permissions) { %i[view_work_packages change_work_package_status] }
@@ -41,8 +41,8 @@
let(:type) { create(:type) }
let(:project) { create(:project, types: [type]) }
- let(:status_new) { create(:status, name: 'New') }
- let(:status_done) { create(:status, name: 'Done') }
+ let(:status_new) { create(:status, name: "New") }
+ let(:status_done) { create(:status, name: "Done") }
let(:workflow) do
create(:workflow,
type_id: type.id,
@@ -69,29 +69,29 @@
wp_page.ensure_page_loaded
end
- context 'as a user having only the change_work_package_status permission' do
- it 'can only change the status' do
+ context "as a user having only the change_work_package_status permission" do
+ it "can only change the status" do
status_field = wp_page.edit_field :status
status_field.expect_state_text status_new.name
status_field.update status_done.name
- wp_page.expect_toast(message: 'Successful update')
+ wp_page.expect_toast(message: "Successful update")
status_field.expect_state_text status_done.name
- subject_field = wp_page.work_package_field('subject')
+ subject_field = wp_page.work_package_field("subject")
subject_field.expect_read_only
end
end
- context 'as a user having only the edit_work_packages permission' do
+ context "as a user having only the edit_work_packages permission" do
let(:permissions) { %i[view_work_packages edit_work_packages] }
- it 'can change the status' do
+ it "can change the status" do
status_field = wp_page.edit_field :status
status_field.expect_state_text status_new.name
status_field.update status_done.name
- wp_page.expect_toast(message: 'Successful update')
+ wp_page.expect_toast(message: "Successful update")
status_field.expect_state_text status_done.name
end
end
diff --git a/spec/features/work_packages/edit_work_package_spec.rb b/spec/features/work_packages/edit_work_package_spec.rb
index c8201d945a82..16b6d8fc2176 100644
--- a/spec/features/work_packages/edit_work_package_spec.rb
+++ b/spec/features/work_packages/edit_work_package_spec.rb
@@ -1,7 +1,7 @@
-require 'spec_helper'
-require 'features/page_objects/notification'
+require "spec_helper"
+require "features/page_objects/notification"
-RSpec.describe 'edit work package', :js do
+RSpec.describe "edit work package", :js do
let(:dev_role) do
create(:project_role,
permissions: %i[view_work_packages
@@ -9,8 +9,8 @@
end
let(:dev) do
create(:user,
- firstname: 'Dev',
- lastname: 'Guy',
+ firstname: "Dev",
+ lastname: "Guy",
member_with_roles: { project => dev_role })
end
let(:manager_role) do
@@ -21,8 +21,8 @@
end
let(:manager) do
create(:admin,
- firstname: 'Manager',
- lastname: 'Guy',
+ firstname: "Manager",
+ lastname: "Guy",
member_with_roles: { project => manager_role })
end
let(:placeholder_user) do
@@ -31,15 +31,15 @@
end
let(:cf_all) do
- create(:work_package_custom_field, is_for_all: true, field_format: 'text')
+ create(:work_package_custom_field, is_for_all: true, field_format: "text")
end
let(:cf_tp1) do
- create(:work_package_custom_field, is_for_all: true, field_format: 'text')
+ create(:work_package_custom_field, is_for_all: true, field_format: "text")
end
let(:cf_tp2) do
- create(:work_package_custom_field, is_for_all: true, field_format: 'text')
+ create(:work_package_custom_field, is_for_all: true, field_format: "text")
end
let(:type) { create(:type, custom_fields: [cf_all, cf_tp1]) }
@@ -55,7 +55,7 @@
end
let(:status) { work_package.status }
- let(:new_subject) { 'Some other subject' }
+ let(:new_subject) { "Some other subject" }
let(:wp_page) { Pages::FullWorkPackage.new(work_package) }
let(:priority2) { create(:priority) }
let(:status2) { create(:status) }
@@ -90,12 +90,12 @@ def visit!
end
end
- context 'as an admin without roles' do
+ context "as an admin without roles" do
let(:visit_before) { false }
let(:work_package) { create(:work_package, project:, type: type2) }
let(:admin) { create(:admin) }
- it 'can still use the manager role' do
+ it "can still use the manager role" do
# A role must still exist
workflow
login_as admin
@@ -108,7 +108,7 @@ def visit!
end
end
- context 'with progress' do
+ context "with progress" do
let(:visit_before) { false }
before do
@@ -116,36 +116,36 @@ def visit!
visit!
end
- it 'does not hide empty % Complete while it is being edited' do
+ it "does not hide empty % Complete while it is being edited" do
field = wp_page.work_package_field(:percentageDone)
- field.update('0', save: false, expect_failure: true)
+ field.update("0", save: false, expect_failure: true)
expect(page).to have_text("% Complete")
end
end
- it 'allows updating and seeing the results' do
- wp_page.update_attributes subject: 'a new subject',
+ it "allows updating and seeing the results" do
+ wp_page.update_attributes subject: "a new subject",
type: type2.name,
- combinedDate: ['2013-03-04', '2013-03-20'],
+ combinedDate: ["2013-03-04", "2013-03-20"],
responsible: manager.name,
assignee: manager.name,
- estimatedTime: '5',
+ estimatedTime: "5",
priority: priority2.name,
version: version.name,
category: category.name,
- percentageDone: '30',
+ percentageDone: "30",
status: status2.name,
- description: 'a new description'
+ description: "a new description"
wp_page.expect_attributes type: type2.name.upcase,
responsible: manager.name,
assignee: manager.name,
- combinedDate: '03/04/2013 - 03/20/2013',
- estimatedTime: '5',
- percentageDone: '30%',
- subject: 'a new subject',
- description: 'a new description',
+ combinedDate: "03/04/2013 - 03/20/2013",
+ estimatedTime: "5",
+ percentageDone: "30%",
+ subject: "a new subject",
+ description: "a new description",
priority: priority2.name,
status: status2.name,
version: version.name,
@@ -154,7 +154,7 @@ def visit!
wp_page.expect_activity_message("Status changed from #{status.name} to #{status2.name}")
end
- it 'correctly assigns and un-assigns users' do
+ it "correctly assigns and un-assigns users" do
wp_page.update_attributes assignee: manager.name
wp_page.expect_attributes assignee: manager.name
wp_page.expect_activity_message("Assignee set to #{manager.name}")
@@ -162,23 +162,23 @@ def visit!
field = wp_page.edit_field :assignee
field.unset_value
- wp_page.expect_attributes assignee: '-'
+ wp_page.expect_attributes assignee: "-"
wp_page.visit!
# Another (empty) journal should exist now
- expect(page).to have_css('.op-user-activity--user-name',
+ expect(page).to have_css(".op-user-activity--user-name",
text: work_package.journals.last.user.name,
wait: 10,
count: 2)
- wp_page.expect_attributes assignee: '-'
+ wp_page.expect_attributes assignee: "-"
work_package.reload
expect(work_package.assigned_to).to be_nil
end
- it 'allows selecting placeholder users for assignee and responsible' do
+ it "allows selecting placeholder users for assignee and responsible" do
wp_page.update_attributes assignee: placeholder_user.name,
responsible: placeholder_user.name
@@ -189,11 +189,11 @@ def visit!
wp_page.expect_activity_message("Accountable set to #{placeholder_user.name}")
end
- context 'switching to custom field with required CF' do
+ context "switching to custom field with required CF" do
let(:custom_field) do
create(
:work_package_custom_field,
- field_format: 'string',
+ field_format: "string",
default_value: nil,
is_required: true,
is_for_all: true
@@ -201,81 +201,81 @@ def visit!
end
let!(:type2) { create(:type, custom_fields: [custom_field]) }
- it 'shows the required field when switching' do
+ it "shows the required field when switching" do
type_field = wp_page.edit_field(:type)
type_field.activate!
type_field.set_value type2.name
wp_page.expect_toast message: "#{custom_field.name} can't be blank.",
- type: 'error'
+ type: "error"
cf_field = wp_page.edit_field(custom_field.attribute_name(:camel_case))
cf_field.expect_active!
- cf_field.expect_value('')
+ cf_field.expect_value("")
end
end
- it 'allows the user to add a comment to a work package' do
+ it "allows the user to add a comment to a work package" do
wp_page.ensure_page_loaded
wp_page.trigger_edit_comment
- wp_page.update_comment 'hallo welt'
+ wp_page.update_comment "hallo welt"
wp_page.save_comment
- wp_page.expect_toast(message: 'The comment was successfully added.')
- wp_page.expect_comment text: 'hallo welt'
+ wp_page.expect_toast(message: "The comment was successfully added.")
+ wp_page.expect_comment text: "hallo welt"
end
- it 'updates the presented custom fields based on the selected type' do
+ it "updates the presented custom fields based on the selected type" do
wp_page.ensure_page_loaded
- wp_page.expect_attributes "customField#{cf_all.id}" => '',
- "customField#{cf_tp1.id}" => ''
+ wp_page.expect_attributes "customField#{cf_all.id}" => "",
+ "customField#{cf_tp1.id}" => ""
wp_page.expect_attribute_hidden "customField#{cf_tp2.id}"
- wp_page.update_attributes "customField#{cf_all.id}" => 'bird is the word',
- 'type' => type2.name
+ wp_page.update_attributes "customField#{cf_all.id}" => "bird is the word",
+ "type" => type2.name
- wp_page.expect_attributes "customField#{cf_all.id}" => 'bird is the word',
- "customField#{cf_tp2.id}" => ''
+ wp_page.expect_attributes "customField#{cf_all.id}" => "bird is the word",
+ "customField#{cf_tp2.id}" => ""
wp_page.expect_attribute_hidden "customField#{cf_tp1.id}"
end
- it 'shows an error if a subject is entered which is too long' do
- too_long = ('Too long. Can you feel it? ' * 10).strip
+ it "shows an error if a subject is entered which is too long" do
+ too_long = ("Too long. Can you feel it? " * 10).strip
wp_page.ensure_page_loaded
field = wp_page.work_package_field(:subject)
field.update(too_long, expect_failure: true)
- wp_page.expect_toast message: 'Subject is too long (maximum is 255 characters)',
- type: 'error'
+ wp_page.expect_toast message: "Subject is too long (maximum is 255 characters)",
+ type: "error"
end
- context 'submitting' do
+ context "submitting" do
let(:subject_field) { wp_page.edit_field(:subject) }
before do
subject_field.activate!
- subject_field.set_value 'My new subject!'
+ subject_field.set_value "My new subject!"
end
- it 'submits the edit mode when pressing enter' do
+ it "submits the edit mode when pressing enter" do
subject_field.input_element.send_keys(:return)
- wp_page.expect_toast(message: 'Successful update')
+ wp_page.expect_toast(message: "Successful update")
subject_field.expect_inactive!
- subject_field.expect_state_text 'My new subject!'
+ subject_field.expect_state_text "My new subject!"
end
- it 'submits the edit mode when changing the focus' do
+ it "submits the edit mode when changing the focus" do
page.find("body").click
- wp_page.expect_toast(message: 'Successful update')
+ wp_page.expect_toast(message: "Successful update")
subject_field.expect_inactive!
- subject_field.expect_state_text 'My new subject!'
+ subject_field.expect_state_text "My new subject!"
end
end
end
diff --git a/spec/features/work_packages/export_spec.rb b/spec/features/work_packages/export_spec.rb
index 4bf509cebc78..4644baf1ff5b 100644
--- a/spec/features/work_packages/export_spec.rb
+++ b/spec/features/work_packages/export_spec.rb
@@ -26,12 +26,12 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'work package export' do
+RSpec.describe "work package export" do
let(:project) { create(:project_with_types, types: [type_a, type_b]) }
- let(:export_type) { 'CSV' }
+ let(:export_type) { "CSV" }
let(:current_user) { create(:admin) }
let(:type_a) { create(:type, name: "Type A") }
@@ -65,15 +65,15 @@
def export!(expect_success = true)
work_packages_page.ensure_loaded
- settings_menu.open_and_choose 'Export'
+ settings_menu.open_and_choose "Export"
click_on export_type
# Expect to get a response regarding queuing
- expect(page).to have_content I18n.t('js.job_status.generic_messages.in_queue'),
+ expect(page).to have_content I18n.t("js.job_status.generic_messages.in_queue"),
wait: 10
# Expect title
- expect(page).to have_test_selector 'job-status--header', text: I18n.t('export.your_work_packages_export')
+ expect(page).to have_test_selector "job-status--header", text: I18n.t("export.your_work_packages_export")
begin
perform_enqueued_jobs
@@ -90,15 +90,15 @@ def export!(expect_success = true)
DownloadList.clear
end
- context 'CSV export' do
- context 'with default filter' do
+ context "CSV export" do
+ context "with default filter" do
before do
work_packages_page.visit_index
filters.expect_filter_count 1
filters.open
end
- it 'shows all work packages with the default filters', :js do
+ it "shows all work packages with the default filters", :js do
export!
expect(subject).to have_text(wp1.description)
@@ -110,8 +110,8 @@ def export!(expect_success = true)
expect(subject.scan(/Type (A|B)/).flatten).to eq %w(A A B A)
end
- it 'shows all work packages grouped by', :js do
- group_by.enable_via_menu 'Type'
+ it "shows all work packages grouped by", :js do
+ group_by.enable_via_menu "Type"
wp_table.expect_work_package_listed(wp1)
wp_table.expect_work_package_listed(wp2)
@@ -129,8 +129,8 @@ def export!(expect_success = true)
expect(subject.scan(/Type (A|B)/).flatten).to eq %w(A A A B)
end
- it 'shows only the work package with the right progress if filtered this way', :js do
- filters.add_filter_by '% Complete', 'is', ['25'], 'percentageDone'
+ it "shows only the work package with the right progress if filtered this way", :js do
+ filters.add_filter_by "% Complete", "is", ["25"], "percentageDone"
sleep 1
loading_indicator_saveguard
@@ -145,8 +145,8 @@ def export!(expect_success = true)
expect(subject).to have_no_text(wp3.description)
end
- it 'shows only work packages of the filtered type', :js do
- filters.add_filter_by 'Type', 'is (OR)', wp3.type.name
+ it "shows only work packages of the filtered type", :js do
+ filters.add_filter_by "Type", "is (OR)", wp3.type.name
expect(page).to have_no_content(wp2.description) # safeguard
@@ -159,17 +159,17 @@ def export!(expect_success = true)
expect(subject).to have_text(wp3.description)
end
- it 'exports selected columns', :js do
- columns.add '% Complete'
+ it "exports selected columns", :js do
+ columns.add "% Complete"
export!
- expect(subject).to have_text('% Complete')
- expect(subject).to have_text('25')
+ expect(subject).to have_text("% Complete")
+ expect(subject).to have_text("25")
end
end
- describe 'with a manually sorted query', :js do
+ describe "with a manually sorted query", :js do
let(:query) do
create(:query,
user: current_user,
@@ -182,20 +182,20 @@ def export!(expect_success = true)
OrderedWorkPackage.create(query:, work_package: wp2, position: 2)
OrderedWorkPackage.create(query:, work_package: wp3, position: 3)
- query.add_filter('manual_sort', 'ow', [])
- query.sort_criteria = [[:manual_sorting, 'asc']]
+ query.add_filter("manual_sort", "ow", [])
+ query.sort_criteria = [[:manual_sorting, "asc"]]
query.save!
end
- it 'returns the correct number of work packages' do
+ it "returns the correct number of work packages" do
wp_table.visit_query query
wp_table.expect_work_package_listed(wp1, wp2, wp3, wp4)
wp_table.expect_work_package_order(wp4, wp1, wp2, wp3)
export!
- expect(page).to have_css('.job-status--modal .icon-checkmark', wait: 10)
- expect(page).to have_content('The export has completed successfully.')
+ expect(page).to have_css(".job-status--modal .icon-checkmark", wait: 10)
+ expect(page).to have_content("The export has completed successfully.")
expect(subject).to have_text(wp1.description)
expect(subject).to have_text(wp2.description)
@@ -208,17 +208,17 @@ def export!(expect_success = true)
end
end
- context 'PDF export', :js do
- let(:export_type) { I18n.t('export.format.pdf_overview_table') }
+ context "PDF export", :js do
+ let(:export_type) { I18n.t("export.format.pdf_overview_table") }
let(:query) do
create(:query,
user: current_user,
project:)
end
- context 'with many columns' do
+ context "with many columns" do
before do
- query.column_names = query.displayable_columns.map { |c| c.name.to_s } - ['bcf_thumbnail']
+ query.column_names = query.displayable_columns.map { |c| c.name.to_s } - ["bcf_thumbnail"]
query.save!
# Despite attempts to provoke the error by having a lot of columns, the pdf
@@ -228,7 +228,7 @@ def export!(expect_success = true)
.and_raise(I18n.t(:error_pdf_export_too_many_columns))
end
- it 'returns the error' do
+ it "returns the error" do
wp_table.visit_query query
export!(false)
@@ -241,18 +241,18 @@ def export!(expect_success = true)
# Atom exports are not downloaded. In fact, it is not even a download but rather
# a feed one can follow.
- context 'Atom export', :js do
- let(:export_type) { 'Atom' }
+ context "Atom export", :js do
+ let(:export_type) { "Atom" }
- context 'with default filter' do
+ context "with default filter" do
before do
work_packages_page.visit_index
filters.expect_filter_count 1
filters.open
end
- it 'shows an xml with work packages' do
- settings_menu.open_and_choose 'Export'
+ it "shows an xml with work packages" do
+ settings_menu.open_and_choose "Export"
# The feed is opened in a new tab
new_window = window_opened_by { click_on export_type }
diff --git a/spec/features/work_packages/highlighting_spec.rb b/spec/features/work_packages/highlighting_spec.rb
index 52702c1a539e..67c9af0644df 100644
--- a/spec/features/work_packages/highlighting_spec.rb
+++ b/spec/features/work_packages/highlighting_spec.rb
@@ -1,16 +1,16 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package highlighting fields', :js,
+RSpec.describe "Work Package highlighting fields", :js,
with_ee: %i[conditional_highlighting] do
let(:user) { create(:admin) }
let(:project) { create(:project) }
- let(:status1) { create(:status, color: create(:color, hexcode: '#FF0000')) } # rgba(255, 0, 0, 1)
- let(:status2) { create(:status, color: create(:color, hexcode: '#F0F0F0')) } # rgba(240, 240, 240, 1)
+ let(:status1) { create(:status, color: create(:color, hexcode: "#FF0000")) } # rgba(255, 0, 0, 1)
+ let(:status2) { create(:status, color: create(:color, hexcode: "#F0F0F0")) } # rgba(240, 240, 240, 1)
let(:priority1) do
- create(:issue_priority, color: create(:color, hexcode: '#123456'))
+ create(:issue_priority, color: create(:color, hexcode: "#123456"))
end
let(:priority_no_color) { create(:issue_priority, color: nil) }
@@ -18,7 +18,7 @@
create(:work_package,
project:,
status: status1,
- subject: 'B',
+ subject: "B",
due_date: (Date.today - 1.day),
priority: priority1)
end
@@ -27,7 +27,7 @@
create(:work_package,
project:,
status: status2,
- subject: 'A',
+ subject: "A",
due_date: Date.today,
priority: priority_no_color)
end
@@ -57,7 +57,7 @@
wp_table.expect_work_package_listed wp_1, wp_2
end
- it 'provides highlighting through css classes' do
+ it "provides highlighting through css classes" do
# Default inline highlight
wp1_row = wp_table.row(wp_1)
wp2_row = wp_table.row(wp_2)
@@ -65,26 +65,26 @@
## Status
expect(SelectorHelpers.get_pseudo_class_property(page,
wp1_row.find('[class^="__hl_inline_status_"]'),
- ':before',
- "background-color")).to eq('rgb(255, 0, 0)')
+ ":before",
+ "background-color")).to eq("rgb(255, 0, 0)")
expect(SelectorHelpers.get_pseudo_class_property(page,
wp2_row.find('[class^="__hl_inline_status_"]'),
- ':before',
- "background-color")).to eq('rgb(240, 240, 240)')
+ ":before",
+ "background-color")).to eq("rgb(240, 240, 240)")
## Priority
expect(SelectorHelpers.get_pseudo_class_property(page,
wp1_row.find('[class^="__hl_inline_priority_"]'),
- ':before',
- "background-color")).to eq('rgb(18, 52, 86)')
+ ":before",
+ "background-color")).to eq("rgb(18, 52, 86)")
expect(SelectorHelpers.get_pseudo_class_property(page,
wp2_row.find('[class^="__hl_inline_priority_"]'),
- ':before',
- "background-color")).to eq('rgba(0, 0, 0, 0)')
+ ":before",
+ "background-color")).to eq("rgba(0, 0, 0, 0)")
## Overdue
- expect(wp1_row).to have_css('.__hl_date_overdue')
- expect(wp2_row).to have_css('.__hl_date_due_today')
+ expect(wp1_row).to have_css(".__hl_date_overdue")
+ expect(wp2_row).to have_css(".__hl_date_due_today")
# Highlight only one attribute
highlighting.switch_inline_attribute_highlight "Priority"
@@ -95,12 +95,12 @@
## Priority should have a dot
expect(SelectorHelpers.get_pseudo_class_property(page,
wp1_row.find('[class^="__hl_inline_priority_"]'),
- ':before',
- "background-color")).to eq('rgb(18, 52, 86)')
+ ":before",
+ "background-color")).to eq("rgb(18, 52, 86)")
expect(SelectorHelpers.get_pseudo_class_property(page,
wp2_row.find('[class^="__hl_inline_priority_"]'),
- ':before',
- "background-color")).to eq('rgba(0, 0, 0, 0)')
+ ":before",
+ "background-color")).to eq("rgba(0, 0, 0, 0)")
## Status should not have a dot
expect(wp1_row).to have_no_css('.status [class^="__hl_inline_"]')
@@ -110,29 +110,29 @@
wp1_row = wp_table.row(wp_1)
expect(SelectorHelpers.get_pseudo_class_property(page,
wp1_row.find('[class^="__hl_inline_priority_"]'),
- ':before',
- "background-color")).to eq('rgb(18, 52, 86)')
+ ":before",
+ "background-color")).to eq("rgb(18, 52, 86)")
expect(SelectorHelpers.get_pseudo_class_property(page,
wp1_row.find('[class^="__hl_inline_status_"]'),
- ':before',
- "background-color")).to eq('rgb(255, 0, 0)')
+ ":before",
+ "background-color")).to eq("rgb(255, 0, 0)")
# Highlight entire row by status
- highlighting.switch_entire_row_highlight 'Status'
+ highlighting.switch_entire_row_highlight "Status"
expect(page).to have_css("#{wp_table.row_selector(wp_1)}.__hl_background_status_#{status1.id}")
expect(page).to have_css("#{wp_table.row_selector(wp_2)}.__hl_background_status_#{status2.id}")
# Unselect all rows to ensure we get the correct background
- find('body').send_keys [:control, 'd']
+ find("body").send_keys [:control, "d"]
wp1_row = wp_table.row(wp_1)
wp2_row = wp_table.row(wp_2)
- expect(wp1_row.native.css_value('background-color')).to eq('rgba(255, 0, 0, 1)')
- expect(wp2_row.native.css_value('background-color')).to eq('rgba(240, 240, 240, 1)')
+ expect(wp1_row.native.css_value("background-color")).to eq("rgba(255, 0, 0, 1)")
+ expect(wp2_row.native.css_value("background-color")).to eq("rgba(240, 240, 240, 1)")
# Save query
wp_table.save
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
query.reload
expect(query.highlighting_mode).to eq(:status)
@@ -142,17 +142,17 @@
expect(page).to have_no_css('[class*="__hl_date"]')
# Highlight entire row by priority
- highlighting.switch_entire_row_highlight 'Priority'
+ highlighting.switch_entire_row_highlight "Priority"
expect(page).to have_css("#{wp_table.row_selector(wp_1)}.__hl_background_priority_#{priority1.id}")
expect(page).to have_css("#{wp_table.row_selector(wp_2)}.__hl_background_priority_#{priority_no_color.id}")
# Remove selection from table row
- find('body').send_keys [:control, 'd']
+ find("body").send_keys [:control, "d"]
wp1_row = wp_table.row(wp_1)
wp2_row = wp_table.row(wp_2)
- expect(wp1_row.native.css_value('background-color')).to eq('rgba(18, 52, 86, 1)')
- expect(wp2_row.native.css_value('background-color')).to eq('rgba(0, 0, 0, 0)')
+ expect(wp1_row.native.css_value("background-color")).to eq("rgba(18, 52, 86, 1)")
+ expect(wp2_row.native.css_value("background-color")).to eq("rgba(0, 0, 0, 0)")
# Highlighting is kept even after a hard reload (Regression #30217)
page.driver.refresh
@@ -164,7 +164,7 @@
# Save query
wp_table.save
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
query.reload
expect(query.highlighting_mode).to eq(:priority)
@@ -174,7 +174,7 @@
expect(page).to have_no_css('[class*="__hl_date"]')
# No highlighting
- highlighting.switch_highlighting_mode 'No highlighting'
+ highlighting.switch_highlighting_mode "No highlighting"
expect(page).to have_no_css('[class*="__hl_background"]')
expect(page).to have_no_css('[class*="__hl_background_status"]')
expect(page).to have_no_css('[class*="__hl_background_priority"]')
@@ -182,7 +182,7 @@
# Save query
wp_table.save
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
query.reload
expect(query.highlighting_mode).to eq(:none)
@@ -194,25 +194,25 @@
expect(page).to have_css(".__hl_inline_priority_#{priority1.id}")
end
- it 'correctly parses custom selected inline attributes', :with_cuprite do
+ it "correctly parses custom selected inline attributes", :with_cuprite do
# Highlight only one attribute
highlighting.switch_inline_attribute_highlight "Priority"
# Regression test, resort table
- sort_by.sort_via_header 'Subject'
+ sort_by.sort_via_header "Subject"
wp_table.expect_work_package_order wp_2, wp_1
# Regression test, resort table
- sort_by.sort_via_header 'Subject', descending: true
+ sort_by.sort_via_header "Subject", descending: true
wp_table.expect_work_package_order wp_1, wp_2
end
- it 'does not set query_props when switching in view (Regression #32118)' do
+ it "does not set query_props when switching in view (Regression #32118)" do
prio_wp1 = wp_table.edit_field(wp_1, :priority)
prio_wp1.update priority_no_color.name
prio_wp1.expect_state_text priority_no_color.name
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
wp_1.reload
expect(wp_1.priority).to eq priority_no_color
diff --git a/spec/features/work_packages/index_sums_spec.rb b/spec/features/work_packages/index_sums_spec.rb
index ee9097e4027b..5c894d85da34 100644
--- a/spec/features/work_packages/index_sums_spec.rb
+++ b/spec/features/work_packages/index_sums_spec.rb
@@ -26,13 +26,13 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package index sums', :js do
+RSpec.describe "Work package index sums", :js do
shared_let(:type_bug) { create(:type_bug) }
shared_let(:type_task) { create(:type_task) }
- shared_let(:status_new) { create(:status, name: 'New') }
- shared_let(:status_in_progress) { create(:status, name: 'In progress') }
+ shared_let(:status_new) { create(:status, name: "New") }
+ shared_let(:status_in_progress) { create(:status, name: "In progress") }
shared_let(:project) { create(:project, types: [type_bug, type_task]) }
let(:user) do
@@ -96,7 +96,7 @@
end
# unit costs
let(:cost_type) do
- type = create(:cost_type, name: 'Translations')
+ type = create(:cost_type, name: "Translations")
create(:cost_rate,
cost_type: type,
rate: 3.00)
@@ -119,24 +119,24 @@
current_user { user }
- it 'calculates sums correctly' do
+ it "calculates sums correctly" do
visit project_work_packages_path(project)
wp_table.expect_work_package_listed work_package1, work_package2
# Add work column
- columns.add 'Work'
+ columns.add "Work"
# Add remaining work column
- columns.add 'Remaining work'
+ columns.add "Remaining work"
# Add int cf column
columns.add int_cf.name
# Add float cf column
columns.add float_cf.name
# Add labor costs column
- columns.add 'Labor costs'
+ columns.add "Labor costs"
# Add unit costs column
- columns.add 'Unit costs'
+ columns.add "Unit costs"
# Add overall costs column
- columns.add 'Overall costs'
+ columns.add "Overall costs"
# Trigger action from action menu dropdown
modal.set_display_sums enable: true
@@ -145,79 +145,79 @@
# Expect the total sums row
within(:row, "Total sum") do |row|
- expect(row).to have_css('.estimatedTime', text: '25 h')
- expect(row).to have_css('.remainingTime', text: '12.5 h')
- expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: '12')
- expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: '13.2')
- expect(row).to have_css('.laborCosts', text: '15.00 EUR')
- expect(row).to have_css('.materialCosts', text: '7.50 EUR') # Unit costs
- expect(row).to have_css('.overallCosts', text: '22.50 EUR')
+ expect(row).to have_css(".estimatedTime", text: "25 h")
+ expect(row).to have_css(".remainingTime", text: "12.5 h")
+ expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "12")
+ expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "13.2")
+ expect(row).to have_css(".laborCosts", text: "15.00 EUR")
+ expect(row).to have_css(".materialCosts", text: "7.50 EUR") # Unit costs
+ expect(row).to have_css(".overallCosts", text: "22.50 EUR")
end
# Update the sum
wp_table.edit_field(work_package1, :estimatedTime)
- .update '20'
+ .update "20"
wp_table.edit_field(work_package1, :remainingTime)
- .update '12'
+ .update "12"
within(:row, "Total sum") do |row|
- expect(row).to have_css('.estimatedTime', text: '35 h')
- expect(row).to have_css('.remainingTime', text: '19.5 h')
- expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: '12')
- expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: '13.2')
- expect(row).to have_css('.laborCosts', text: '15.00 EUR')
- expect(row).to have_css('.materialCosts', text: '7.50 EUR') # Unit costs
- expect(row).to have_css('.overallCosts', text: '22.50 EUR')
+ expect(row).to have_css(".estimatedTime", text: "35 h")
+ expect(row).to have_css(".remainingTime", text: "19.5 h")
+ expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "12")
+ expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "13.2")
+ expect(row).to have_css(".laborCosts", text: "15.00 EUR")
+ expect(row).to have_css(".materialCosts", text: "7.50 EUR") # Unit costs
+ expect(row).to have_css(".overallCosts", text: "22.50 EUR")
end
# Enable groups
- group_by.enable_via_menu 'Status'
+ group_by.enable_via_menu "Status"
# Expect to have three sums rows now
- expect(page).to have_row('Sum', count: 2)
- expect(page).to have_row('Total sum', count: 1)
+ expect(page).to have_row("Sum", count: 2)
+ expect(page).to have_row("Total sum", count: 1)
- first_sum_row, second_sum_row = *find_all(:row, 'Sum')
+ first_sum_row, second_sum_row = *find_all(:row, "Sum")
# First status row
- expect(first_sum_row).to have_css('.estimatedTime', text: '20 h')
- expect(first_sum_row).to have_css('.remainingTime', text: '12 h')
- expect(first_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: '5')
- expect(first_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: '5.5')
- expect(first_sum_row).to have_css('.laborCosts', text: '15.00 EUR')
- expect(first_sum_row).to have_css('.materialCosts', text: '7.50 EUR') # Unit costs
- expect(first_sum_row).to have_css('.overallCosts', text: '22.50 EUR')
+ expect(first_sum_row).to have_css(".estimatedTime", text: "20 h")
+ expect(first_sum_row).to have_css(".remainingTime", text: "12 h")
+ expect(first_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "5")
+ expect(first_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "5.5")
+ expect(first_sum_row).to have_css(".laborCosts", text: "15.00 EUR")
+ expect(first_sum_row).to have_css(".materialCosts", text: "7.50 EUR") # Unit costs
+ expect(first_sum_row).to have_css(".overallCosts", text: "22.50 EUR")
# Second status row
- expect(second_sum_row).to have_css('.estimatedTime', text: '15 h')
- expect(second_sum_row).to have_css('.remainingTime', text: '7.5 h')
- expect(second_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: '7')
- expect(second_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: '7.7')
- expect(second_sum_row).to have_css('.laborCosts', text: '', exact_text: true)
- expect(second_sum_row).to have_css('.materialCosts', text: '', exact_text: true) # Unit costs
- expect(second_sum_row).to have_css('.overallCosts', text: '', exact_text: true)
+ expect(second_sum_row).to have_css(".estimatedTime", text: "15 h")
+ expect(second_sum_row).to have_css(".remainingTime", text: "7.5 h")
+ expect(second_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "7")
+ expect(second_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "7.7")
+ expect(second_sum_row).to have_css(".laborCosts", text: "", exact_text: true)
+ expect(second_sum_row).to have_css(".materialCosts", text: "", exact_text: true) # Unit costs
+ expect(second_sum_row).to have_css(".overallCosts", text: "", exact_text: true)
# Total sums row is unchanged
within(:row, "Total sum") do |row|
- expect(row).to have_css('.estimatedTime', text: '35 h')
- expect(row).to have_css('.remainingTime', text: '19.5 h')
- expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: '12')
- expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: '13.2')
- expect(row).to have_css('.laborCosts', text: '15.00 EUR')
- expect(row).to have_css('.materialCosts', text: '7.50 EUR') # Unit costs
- expect(row).to have_css('.overallCosts', text: '22.50 EUR')
+ expect(row).to have_css(".estimatedTime", text: "35 h")
+ expect(row).to have_css(".remainingTime", text: "19.5 h")
+ expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "12")
+ expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "13.2")
+ expect(row).to have_css(".laborCosts", text: "15.00 EUR")
+ expect(row).to have_css(".materialCosts", text: "7.50 EUR") # Unit costs
+ expect(row).to have_css(".overallCosts", text: "22.50 EUR")
end
# Collapsing groups will also hide the sums row
- page.find('.expander.icon-minus2', match: :first).click
+ page.find(".expander.icon-minus2", match: :first).click
sleep 1
- page.find('.expander.icon-minus2', match: :first).click
+ page.find(".expander.icon-minus2", match: :first).click
# Expect to have only the final sums
- expect(page).not_to have_row('Sum')
- expect(page).to have_row('Total sum')
+ expect(page).not_to have_row("Sum")
+ expect(page).to have_row("Total sum")
end
- context 'when filtering' do
+ context "when filtering" do
let!(:work_package3) do
create(:work_package,
project:,
@@ -258,7 +258,7 @@
user:)
end
- it 'calculates sums correctly' do
+ it "calculates sums correctly" do
query = create(:query,
project:,
user:,
@@ -271,74 +271,74 @@
# Expect the total sums row without filtering
within(:row, "Total sum") do |row|
- expect(row).to have_css('.estimatedTime', text: '50 h')
- expect(row).to have_css('.remainingTime', text: '25 h')
- expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: '24')
- expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: '26.4')
- expect(row).to have_css('.laborCosts', text: '40.00 EUR')
- expect(row).to have_css('.materialCosts', text: '18.00 EUR') # Unit costs
- expect(row).to have_css('.overallCosts', text: '58.00 EUR')
+ expect(row).to have_css(".estimatedTime", text: "50 h")
+ expect(row).to have_css(".remainingTime", text: "25 h")
+ expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "24")
+ expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "26.4")
+ expect(row).to have_css(".laborCosts", text: "40.00 EUR")
+ expect(row).to have_css(".materialCosts", text: "18.00 EUR") # Unit costs
+ expect(row).to have_css(".overallCosts", text: "58.00 EUR")
end
# Filter
filters.open
- filters.add_filter_by('Type', 'is (OR)', type_task.name)
+ filters.add_filter_by("Type", "is (OR)", type_task.name)
puts Capybara::Screenshot.screenshot_and_save_page
# Expect 2 work packages shown
- expect(page).to have_row('WorkPackage', count: 2) # works because the subject name includes "WorkPackage"
+ expect(page).to have_row("WorkPackage", count: 2) # works because the subject name includes "WorkPackage"
# Expect the total sums row to have changed
within(:row, "Total sum") do |row|
- expect(row).to have_css('.estimatedTime', text: '30 h')
- expect(row).to have_css('.remainingTime', text: '15 h')
- expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: '14')
- expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: '15.4')
- expect(row).to have_css('.laborCosts', text: '', exact_text: true)
- expect(row).to have_css('.materialCosts', text: '', exact_text: true) # Unit costs
- expect(row).to have_css('.overallCosts', text: '', exact_text: true)
+ expect(row).to have_css(".estimatedTime", text: "30 h")
+ expect(row).to have_css(".remainingTime", text: "15 h")
+ expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "14")
+ expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "15.4")
+ expect(row).to have_css(".laborCosts", text: "", exact_text: true)
+ expect(row).to have_css(".materialCosts", text: "", exact_text: true) # Unit costs
+ expect(row).to have_css(".overallCosts", text: "", exact_text: true)
end
# Filter by status open
- filters.remove_filter('type')
- filters.remove_filter('status')
- filters.add_filter_by('Status', 'is (OR)', status_new.name)
+ filters.remove_filter("type")
+ filters.remove_filter("status")
+ filters.add_filter_by("Status", "is (OR)", status_new.name)
# Enable groups by type
- group_by.enable_via_menu 'Type'
+ group_by.enable_via_menu "Type"
# Expect to have three sums rows now
- expect(page).to have_row('Sum', count: 2)
- expect(page).to have_row('Total sum', count: 1)
+ expect(page).to have_row("Sum", count: 2)
+ expect(page).to have_row("Total sum", count: 1)
- first_sum_row, second_sum_row = *find_all(:row, 'Sum')
+ first_sum_row, second_sum_row = *find_all(:row, "Sum")
# First status row
- expect(first_sum_row).to have_css('.estimatedTime', text: '10 h')
- expect(first_sum_row).to have_css('.remainingTime', text: '5 h')
- expect(first_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: '5')
- expect(first_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: '5.5')
- expect(first_sum_row).to have_css('.laborCosts', text: '15.00 EUR')
- expect(first_sum_row).to have_css('.materialCosts', text: '7.50 EUR') # Unit costs
- expect(first_sum_row).to have_css('.overallCosts', text: '22.50 EUR')
+ expect(first_sum_row).to have_css(".estimatedTime", text: "10 h")
+ expect(first_sum_row).to have_css(".remainingTime", text: "5 h")
+ expect(first_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "5")
+ expect(first_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "5.5")
+ expect(first_sum_row).to have_css(".laborCosts", text: "15.00 EUR")
+ expect(first_sum_row).to have_css(".materialCosts", text: "7.50 EUR") # Unit costs
+ expect(first_sum_row).to have_css(".overallCosts", text: "22.50 EUR")
# Second status row
- expect(second_sum_row).to have_css('.estimatedTime', text: '15 h')
- expect(second_sum_row).to have_css('.remainingTime', text: '7.5 h')
- expect(second_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: '7')
- expect(second_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: '7.7')
- expect(second_sum_row).to have_css('.laborCosts', text: '', exact_text: true)
- expect(second_sum_row).to have_css('.materialCosts', text: '', exact_text: true) # Unit costs
- expect(second_sum_row).to have_css('.overallCosts', text: '', exact_text: true)
+ expect(second_sum_row).to have_css(".estimatedTime", text: "15 h")
+ expect(second_sum_row).to have_css(".remainingTime", text: "7.5 h")
+ expect(second_sum_row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "7")
+ expect(second_sum_row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "7.7")
+ expect(second_sum_row).to have_css(".laborCosts", text: "", exact_text: true)
+ expect(second_sum_row).to have_css(".materialCosts", text: "", exact_text: true) # Unit costs
+ expect(second_sum_row).to have_css(".overallCosts", text: "", exact_text: true)
# Total sum
within(:row, "Total sum") do |row|
- expect(row).to have_css('.estimatedTime', text: '25 h')
- expect(row).to have_css('.remainingTime', text: '12.5 h')
- expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: '12')
- expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: '13.2')
- expect(row).to have_css('.laborCosts', text: '15.00 EUR')
- expect(row).to have_css('.materialCosts', text: '7.50 EUR') # Unit costs
- expect(row).to have_css('.overallCosts', text: '22.50 EUR')
+ expect(row).to have_css(".estimatedTime", text: "25 h")
+ expect(row).to have_css(".remainingTime", text: "12.5 h")
+ expect(row).to have_css(".#{int_cf.attribute_name(:camel_case)}", text: "12")
+ expect(row).to have_css(".#{float_cf.attribute_name(:camel_case)}", text: "13.2")
+ expect(row).to have_css(".laborCosts", text: "15.00 EUR")
+ expect(row).to have_css(".materialCosts", text: "7.50 EUR") # Unit costs
+ expect(row).to have_css(".overallCosts", text: "22.50 EUR")
end
end
end
diff --git a/spec/features/work_packages/navigation_spec.rb b/spec/features/work_packages/navigation_spec.rb
index a5d04cc97547..059d7e3cae51 100644
--- a/spec/features/work_packages/navigation_spec.rb
+++ b/spec/features/work_packages/navigation_spec.rb
@@ -26,11 +26,11 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package navigation', :js, :selenium do
+RSpec.describe "Work package navigation", :js, :selenium do
let(:user) { create(:admin) }
- let(:project) { create(:project, name: 'Some project', enabled_module_names: [:work_package_tracking]) }
+ let(:project) { create(:project, name: "Some project", enabled_module_names: [:work_package_tracking]) }
let(:work_package) { build(:work_package, project:) }
let(:global_html_title) { Components::HtmlTitle.new }
let(:project_html_title) { Components::HtmlTitle.new project }
@@ -54,7 +54,7 @@
login_as(user)
end
- it 'all different angular based work package views' do
+ it "all different angular based work package views" do
work_package.save!
# deep link global work package index
@@ -62,7 +62,7 @@
global_work_packages.visit!
global_work_packages.expect_work_package_listed(work_package)
- global_html_title.expect_first_segment 'All open'
+ global_html_title.expect_first_segment "All open"
# open details pane for work package
@@ -97,17 +97,17 @@
project_work_packages.visit!
project_work_packages.expect_work_package_listed(work_package)
- project_html_title.expect_first_segment 'All open'
+ project_html_title.expect_first_segment "All open"
# Visit query with project wp
project_work_packages.visit_query query
project_work_packages.expect_work_package_listed(work_package)
- project_html_title.expect_first_segment 'My fancy query'
+ project_html_title.expect_first_segment "My fancy query"
# Go back to work packages without query
- page.execute_script('window.history.back()')
+ page.execute_script("window.history.back()")
project_work_packages.expect_work_package_listed(work_package)
- project_html_title.expect_first_segment 'All open'
+ project_html_title.expect_first_segment "All open"
# open project work package details pane
@@ -121,12 +121,12 @@
full_work_package = split_project_work_package.switch_to_fullscreen
full_work_package.expect_subject
- expect(page).to have_current_path project_work_package_path(project, work_package, 'activity')
+ expect(page).to have_current_path project_work_package_path(project, work_package, "activity")
project_html_title.expect_first_segment wp_title_segment
# Switch tabs
full_work_package.switch_to_tab tab: :relations
- expect(page).to have_current_path project_work_package_path(project, work_package, 'relations')
+ expect(page).to have_current_path project_work_package_path(project, work_package, "relations")
project_html_title.expect_first_segment wp_title_segment
# Back to split screen using the button
@@ -145,66 +145,66 @@
full_work_package.ensure_page_loaded
end
- it 'loading an unknown work package ID' do
- visit '/work_packages/999999999'
+ it "loading an unknown work package ID" do
+ visit "/work_packages/999999999"
page404 = Pages::Page.new
page404.expect_toast type: :error, message: I18n.t(:notice_file_not_found)
visit "/projects/#{project.identifier}/work_packages/999999999"
- page404.expect_and_dismiss_toaster type: :error, message: I18n.t('api_v3.errors.not_found.work_package')
+ page404.expect_and_dismiss_toaster type: :error, message: I18n.t("api_v3.errors.not_found.work_package")
end
# Regression #29994
- it 'access the work package views directly from a non-angular view' do
+ it "access the work package views directly from a non-angular view" do
visit project_path(project)
- find('#main-menu-work-packages ~ .toggler').click
- expect(page).to have_css('.op-view-select--search-results')
- find('.op-sidemenu--item-action', text: query.name).click
+ find("#main-menu-work-packages ~ .toggler").click
+ expect(page).to have_css(".op-view-select--search-results")
+ find(".op-sidemenu--item-action", text: query.name).click
- expect(page).to have_no_css('.title-container', text: 'Overview')
- expect(page).to have_field('editable-toolbar-title', with: query.name)
+ expect(page).to have_no_css(".title-container", text: "Overview")
+ expect(page).to have_field("editable-toolbar-title", with: query.name)
end
- it 'double clicking search result row (Regression #30247)' do
- work_package.subject = 'Foobar'
+ it "double clicking search result row (Regression #30247)" do
+ work_package.subject = "Foobar"
work_package.save!
- visit search_path(q: 'Foo', work_packages: 1, scope: :all)
+ visit search_path(q: "Foo", work_packages: 1, scope: :all)
- table = Pages::EmbeddedWorkPackagesTable.new page.find_by_id('content')
+ table = Pages::EmbeddedWorkPackagesTable.new page.find_by_id("content")
table.expect_work_package_listed work_package
full_page = table.open_full_screen_by_doubleclick work_package
full_page.ensure_page_loaded
end
- it 'double clicking my page (Regression #30343)' do
+ it "double clicking my page (Regression #30343)" do
work_package.author = user
- work_package.subject = 'Foobar'
+ work_package.subject = "Foobar"
work_package.save!
visit my_page_path
- page.find('.wp-table--cell-td.id a', text: work_package.id).click
+ page.find(".wp-table--cell-td.id a", text: work_package.id).click
full_page = Pages::FullWorkPackage.new work_package, work_package.project
full_page.ensure_page_loaded
end
- describe 'moving back to filtered list after change' do
- let!(:work_package) { create(:work_package, project:, subject: 'foo') }
+ describe "moving back to filtered list after change" do
+ let!(:work_package) { create(:work_package, project:, subject: "foo") }
let!(:query) do
query = build(:query, user:, project:)
query.column_names = %w(id subject)
query.name = "My fancy query"
- query.add_filter('subject', '~', ['foo'])
+ query.add_filter("subject", "~", ["foo"])
query.save!
query
end
- it 'filters out the work package' do
+ it "filters out the work package" do
wp_table = Pages::WorkPackagesTable.new project
wp_table.visit!
@@ -213,9 +213,9 @@
full_view.ensure_page_loaded
subject = full_view.edit_field :subject
- subject.update 'bar'
+ subject.update "bar"
- full_view.expect_and_dismiss_toaster message: 'Successful update.'
+ full_view.expect_and_dismiss_toaster message: "Successful update."
# Go back to list
full_view.go_back
@@ -224,13 +224,13 @@
end
end
- context 'with work package with an attachment' do
- let!(:attachment) { build(:attachment, filename: 'attachment-first.pdf') }
+ context "with work package with an attachment" do
+ let!(:attachment) { build(:attachment, filename: "attachment-first.pdf") }
let!(:wp_with_attachment) do
- create(:work_package, subject: 'WP attachment A', project:, attachments: [attachment])
+ create(:work_package, subject: "WP attachment A", project:, attachments: [attachment])
end
- it 'shows it when navigating from table to single view' do
+ it "shows it when navigating from table to single view" do
wp_table = Pages::WorkPackagesTable.new project
wp_table.visit!
@@ -238,16 +238,16 @@
full_view = wp_table.open_full_screen_by_link wp_with_attachment
full_view.ensure_page_loaded
- full_view.switch_to_tab(tab: 'FILES')
+ full_view.switch_to_tab(tab: "FILES")
expect(page)
- .to have_test_selector('op-files-tab--file-list-item-title', text: 'attachment-first.pdf', wait: 10)
+ .to have_test_selector("op-files-tab--file-list-item-title", text: "attachment-first.pdf", wait: 10)
end
end
- context 'when visiting a query that will lead to a query validation error' do
+ context "when visiting a query that will lead to a query validation error" do
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
- it 'outputs a correct error message (Regression #39880)' do
+ it "outputs a correct error message (Regression #39880)" do
url_query =
"query_id=%7B%22%7B%22&query_props=%7B%22c%22%3A%5B%22id%22%2C%22subject" \
"%22%2C%22type%22%2C%22status%22%2C%22assignee%22%2C%22updatedAt%22%5D%2C" \
@@ -258,8 +258,8 @@
visit "/projects/#{project.identifier}/work_packages?#{url_query}"
- wp_table.expect_toast message: 'Your view is erroneous and could not be processed.', type: :error
- expect(page).to have_css 'li', text: 'Bad request: id is invalid'
+ wp_table.expect_toast message: "Your view is erroneous and could not be processed.", type: :error
+ expect(page).to have_css "li", text: "Bad request: id is invalid"
end
end
end
diff --git a/spec/features/work_packages/new/attributes_from_filter_spec.rb b/spec/features/work_packages/new/attributes_from_filter_spec.rb
index cb5de138a92a..b4b11875d198 100644
--- a/spec/features/work_packages/new/attributes_from_filter_spec.rb
+++ b/spec/features/work_packages/new/attributes_from_filter_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package create uses attributes from filters', :js, :selenium do
+RSpec.describe "Work package create uses attributes from filters", :js, :selenium do
let(:user) { create(:admin) }
let(:type_bug) { create(:type_bug) }
let(:type_task) { create(:type_task) }
@@ -50,13 +50,13 @@
query.add_filter(*filter)
end
- query.column_names = ['id', 'subject', 'type', 'assigned_to', 'status']
+ query.column_names = ["id", "subject", "type", "assigned_to", "status"]
query.save!
end
end
let(:filters) do
- [['type_id', '=', [type_task.id]]]
+ [["type_id", "=", [type_task.id]]]
end
before do
@@ -65,7 +65,7 @@
wp_table.expect_no_work_package_listed
end
- context 'with a multi-value custom field' do
+ context "with a multi-value custom field" do
let(:type_task) { create(:type_task, custom_fields: [custom_field]) }
let!(:project) do
create(:project,
@@ -86,42 +86,42 @@
end
let(:filters) do
- [['type_id', '=', [type_task.id]],
- [custom_field.column_name, '=', [custom_field.custom_options.detect { |o| o.value == 'A' }.id]]]
+ [["type_id", "=", [type_task.id]],
+ [custom_field.column_name, "=", [custom_field.custom_options.detect { |o| o.value == "A" }.id]]]
end
- it 'allows to save with a single value (Regression test #27833)' do
+ it "allows to save with a single value (Regression test #27833)" do
split_page = wp_table.create_wp_by_button type_task
subject = split_page.edit_field(:subject)
subject.expect_active!
- subject.set_value 'Foobar!'
+ subject.set_value "Foobar!"
split_page.save!
wp_table.expect_and_dismiss_toaster(
- message: 'Successful creation. Click here to open this work package in fullscreen view.'
+ message: "Successful creation. Click here to open this work package in fullscreen view."
)
wp = WorkPackage.last
- expect(wp.subject).to eq 'Foobar!'
+ expect(wp.subject).to eq "Foobar!"
expect(wp.send(custom_field.attribute_getter)).to eq %w(A)
expect(wp.type_id).to eq type_task.id
end
end
- context 'with assignee filter' do
+ context "with assignee filter" do
let!(:assignee) do
create(:user,
- firstname: 'An',
- lastname: 'assignee',
+ firstname: "An",
+ lastname: "assignee",
member_with_roles: { project => role })
end
let(:filters) do
- [['type_id', '=', [type_task.id]],
- ['assigned_to_id', '=', [assignee.id]]]
+ [["type_id", "=", [type_task.id]],
+ ["assigned_to_id", "=", [assignee.id]]]
end
- it 'uses the assignee filter in inline-create and split view' do
+ it "uses the assignee filter in inline-create and split view" do
wp_table.click_inline_create
subject_field = wp_table.edit_field(nil, :subject)
@@ -136,16 +136,16 @@
assignee_field.expect_state_text type_task.name.upcase
# Save the WP
- subject_field.set_value 'Foobar!'
+ subject_field.set_value "Foobar!"
subject_field.submit_by_enter
wp_table.expect_toast(
- message: 'Successful creation. Click here to open this work package in fullscreen view.'
+ message: "Successful creation. Click here to open this work package in fullscreen view."
)
wp_table.dismiss_toaster!
wp = WorkPackage.last
- expect(wp.subject).to eq 'Foobar!'
+ expect(wp.subject).to eq "Foobar!"
expect(wp.assigned_to_id).to eq assignee.id
expect(wp.type_id).to eq type_task.id
@@ -155,7 +155,7 @@
# Subject
subject_field = split_view_create.edit_field :subject
subject_field.expect_active!
- subject_field.set_value 'Split Foobar!'
+ subject_field.set_value "Split Foobar!"
# Type field IS NOT synced
type_field = split_view_create.edit_field :type
@@ -163,28 +163,28 @@
# Assignee is synced
assignee_field = split_view_create.edit_field :assignee
- expect(assignee_field.input_element.find('.ng-value-label').text).to eql('An assignee')
+ expect(assignee_field.input_element.find(".ng-value-label").text).to eql("An assignee")
- within '.work-packages--edit-actions' do
- click_button 'Save'
+ within ".work-packages--edit-actions" do
+ click_button "Save"
end
- wp_table.expect_toast(message: 'Successful creation.')
+ wp_table.expect_toast(message: "Successful creation.")
wp = WorkPackage.last
- expect(wp.subject).to eq 'Split Foobar!'
+ expect(wp.subject).to eq "Split Foobar!"
expect(wp.assigned_to_id).to eq assignee.id
expect(wp.type_id).to eq type_bug.id
end
end
- context 'with status filter' do
+ context "with status filter" do
let(:closed_status) { create(:closed_status, workflow_for_type: type_bug) }
let(:filters) do
- [['status_id', '=', [closed_status.id]]]
+ [["status_id", "=", [closed_status.id]]]
end
- it 'uses the status filter in inline-create and split view' do
+ it "uses the status filter in inline-create and split view" do
# When the chosen type ( type_task ) does not have a workflow for the status (closed_status)
# of the filter, it uses the default status instead (Regression #36719)
wp_table.click_inline_create
@@ -199,16 +199,16 @@
# Save the WP
subject_field = wp_table.edit_field(nil, :subject)
- subject_field.set_value 'Foobar!'
+ subject_field.set_value "Foobar!"
subject_field.submit_by_enter
wp_table.expect_toast(
- message: 'Successful creation. Click here to open this work package in fullscreen view.'
+ message: "Successful creation. Click here to open this work package in fullscreen view."
)
wp_table.dismiss_toaster!
wp = WorkPackage.last
- expect(wp.subject).to eq 'Foobar!'
+ expect(wp.subject).to eq "Foobar!"
expect(wp.type_id).to eq type_task.id
expect(wp.status_id).to eq default_status.id
@@ -220,7 +220,7 @@
subject_field = split_view_create.edit_field :subject
subject_field.expect_active!
- subject_field.set_value 'Split Foobar!'
+ subject_field.set_value "Split Foobar!"
# Type field IS NOT synced
type_field = split_view_create.edit_field :type
@@ -230,14 +230,14 @@
status_field = split_view_create.edit_field :status
status_field.expect_display_value(closed_status.name.humanize)
- within '.work-packages--edit-actions' do
- click_button 'Save'
+ within ".work-packages--edit-actions" do
+ click_button "Save"
end
- wp_table.expect_toast(message: 'Successful creation.')
+ wp_table.expect_toast(message: "Successful creation.")
wp = WorkPackage.last
- expect(wp.subject).to eq 'Split Foobar!'
+ expect(wp.subject).to eq "Split Foobar!"
expect(wp.type_id).to eq type_bug.id
expect(wp.status_id).to eq closed_status.id
@@ -251,7 +251,7 @@
subject_field = split_view_create.edit_field :subject
subject_field.expect_active!
- subject_field.set_value 'Split Foobar!'
+ subject_field.set_value "Split Foobar!"
# Type field IS NOT synced
type_field = split_view_create.edit_field :type
@@ -261,14 +261,14 @@
status_field = split_view_create.edit_field :status
status_field.expect_display_value(default_status.name.humanize)
- within '.work-packages--edit-actions' do
- click_button 'Save'
+ within ".work-packages--edit-actions" do
+ click_button "Save"
end
- wp_table.expect_toast(message: 'Successful creation.')
+ wp_table.expect_toast(message: "Successful creation.")
wp = WorkPackage.last
- expect(wp.subject).to eq 'Split Foobar!'
+ expect(wp.subject).to eq "Split Foobar!"
expect(wp.type_id).to eq type_task.id
expect(wp.status_id).to eq default_status.id
end
diff --git a/spec/features/work_packages/new/new_work_package_datepicker_spec.rb b/spec/features/work_packages/new/new_work_package_datepicker_spec.rb
index 023798ee13da..7cabade98d1f 100644
--- a/spec/features/work_packages/new/new_work_package_datepicker_spec.rb
+++ b/spec/features/work_packages/new/new_work_package_datepicker_spec.rb
@@ -26,15 +26,15 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/page_objects/notification'
-require 'features/work_packages/details/inplace_editor/shared_examples'
-require 'features/work_packages/shared_contexts'
-require 'support/edit_fields/edit_field'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/page_objects/notification"
+require "features/work_packages/details/inplace_editor/shared_examples"
+require "features/work_packages/shared_contexts"
+require "support/edit_fields/edit_field"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'New work package datepicker',
- :js, :with_cuprite, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe "New work package datepicker",
+ :js, :with_cuprite, with_settings: { date_format: "%Y-%m-%d" } do
let(:project) { create(:project_with_types, public: true) }
let(:user) { create(:admin) }
@@ -48,7 +48,7 @@
wait_for_reload
end
- it 'can open and select the datepicker' do
+ it "can open and select the datepicker" do
date_field.input_element.click
date_field.toggle_ignore_non_working_days
diff --git a/spec/features/work_packages/new/new_work_package_spec.rb b/spec/features/work_packages/new/new_work_package_spec.rb
index 2f705a3c2b25..f3cb6eda8511 100644
--- a/spec/features/work_packages/new/new_work_package_spec.rb
+++ b/spec/features/work_packages/new/new_work_package_spec.rb
@@ -1,9 +1,9 @@
-require 'spec_helper'
-require 'support/edit_fields/edit_field'
-require 'features/work_packages/work_packages_page'
-require 'features/page_objects/notification'
+require "spec_helper"
+require "support/edit_fields/edit_field"
+require "features/work_packages/work_packages_page"
+require "features/page_objects/notification"
-RSpec.describe 'new work package', :js, :with_cuprite do
+RSpec.describe "new work package", :js, :with_cuprite do
shared_let(:status) { create(:status, is_default: true) }
shared_let(:priority) { create(:priority, is_default: true) }
shared_let(:type_task) { create(:type_task) }
@@ -21,8 +21,8 @@
let(:work_packages_page) { WorkPackagesPage.new(project) }
- let(:subject) { 'My subject' }
- let(:description) { 'A description of the newly-created work package.' }
+ let(:subject) { "My subject" }
+ let(:description) { "A description of the newly-created work package." }
let(:subject_field) { wp_page.edit_field :subject }
let(:description_field) { wp_page.edit_field :description }
@@ -36,10 +36,10 @@ def disable_leaving_unsaved_warning
end
def save_work_package!(expect_success = true)
- scroll_to_and_click find_by_id('work-packages--edit-actions-save')
+ scroll_to_and_click find_by_id("work-packages--edit-actions-save")
if expect_success
- toaster.expect_success('Successful creation.')
+ toaster.expect_success("Successful creation.")
end
end
@@ -53,7 +53,7 @@ def click_create_work_package_button(type)
def create_work_package(type, *)
click_create_work_package_button(type)
- expect(page).to have_focus_on('#wp-new-inline-edit--field-subject')
+ expect(page).to have_focus_on("#wp-new-inline-edit--field-subject")
wp_page.subject_field.set(subject)
wait_for_network_idle
@@ -81,21 +81,21 @@ def create_work_package_globally(type, project_name)
login_as(user)
end
- shared_examples 'work package creation workflow' do
+ shared_examples "work package creation workflow" do
before do
create_method.call(type_task, project.name)
expect(page).to have_selector(safeguard_selector, wait: 10)
end
- it 'creates a subsequent work package' do
+ it "creates a subsequent work package" do
wp_page.subject_field.set(subject)
save_work_package!
# safeguards
wp_page.dismiss_toaster!
wp_page.expect_no_toaster(
- message: 'Successful creation. Click here to open this work package in fullscreen view.'
+ message: "Successful creation. Click here to open this work package in fullscreen view."
)
subject_field.expect_state_text(subject)
@@ -107,7 +107,7 @@ def create_work_package_globally(type, project_name)
type_field.expect_state_text /#{type_bug.name}/i
end
- it 'saves the work package with enter' do
+ it "saves the work package with enter" do
subject_field = wp_page.subject_field
subject_field.set(subject)
subject_field.send_keys(:enter)
@@ -115,20 +115,20 @@ def create_work_package_globally(type, project_name)
# safeguards
wp_page.dismiss_toaster!
wp_page.expect_no_toaster(
- message: 'Successful creation. Click here to open this work package in fullscreen view.'
+ message: "Successful creation. Click here to open this work package in fullscreen view."
)
wp_page.edit_field(:subject).expect_text(subject)
end
- context 'with missing values' do
- it 'shows an error when subject is missing' do
+ context "with missing values" do
+ it "shows an error when subject is missing" do
description_field.set_value(description)
# Need to send keys to emulate change
subject_field = wp_page.subject_field
- subject_field.set('')
- subject_field.send_keys('a')
+ subject_field.set("")
+ subject_field.send_keys("a")
subject_field.send_keys(:backspace)
save_work_package!(false)
@@ -136,20 +136,20 @@ def create_work_package_globally(type, project_name)
end
end
- context 'with subject set' do
- it 'creates a basic work package' do
+ context "with subject set" do
+ it "creates a basic work package" do
description_field = wp_page.edit_field :description
description_field.set_value description
save_work_package!
- expect(page).to have_css('.op-work-package-tabs')
+ expect(page).to have_css(".op-work-package-tabs")
subject_field.expect_state_text(subject)
description_field = wp_page.edit_field :description
description_field.expect_state_text(description)
end
- it 'can switch types and keep attributes' do
+ it "can switch types and keep attributes" do
wp_page.subject_field.set(subject)
type_field.activate!
type_field.openSelectField
@@ -161,11 +161,11 @@ def create_work_package_globally(type, project_name)
wp_page.expect_attributes type: type_bug.name.upcase
end
- context 'custom fields' do
+ context "custom fields" do
let(:custom_field1) do
create(
:work_package_custom_field,
- field_format: 'string',
+ field_format: "string",
is_required: true,
is_for_all: true
)
@@ -173,7 +173,7 @@ def create_work_package_globally(type, project_name)
let(:custom_field2) do
create(
:work_package_custom_field,
- field_format: 'list',
+ field_format: "list",
possible_values: %w(foo bar xyz),
is_required: false,
is_for_all: true
@@ -197,25 +197,25 @@ def create_work_package_globally(type, project_name)
expect(page).to have_css(".#{custom_fields.last.attribute_name(:camel_case)} ng-select")
cf = wp_page.edit_field custom_fields.last.attribute_name(:camel_case)
- cf.field_type = 'create-autocompleter'
+ cf.field_type = "create-autocompleter"
cf.openSelectField
- cf.set_value 'foo'
+ cf.set_value "foo"
save_work_package!(false)
toaster.expect_error("#{custom_field1.name} can't be blank.")
- cf1.set 'Custom field content'
+ cf1.set "Custom field content"
save_work_package!(true)
- wp_page.expect_attributes "customField#{custom_field1.id}" => 'Custom field content',
- "customField#{custom_field2.id}" => 'foo'
+ wp_page.expect_attributes "customField#{custom_field1.id}" => "Custom field content",
+ "customField#{custom_field2.id}" => "foo"
end
end
end
end
- context 'project split screen' do
- let(:safeguard_selector) { '.work-packages--details-content.-create-mode' }
+ context "project split screen" do
+ let(:safeguard_selector) { ".work-packages--details-content.-create-mode" }
let(:wp_page) { Pages::SplitWorkPackage.new(WorkPackage.new) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -223,38 +223,38 @@ def create_work_package_globally(type, project_name)
wp_table.visit!
end
- it_behaves_like 'work package creation workflow' do
+ it_behaves_like "work package creation workflow" do
let(:create_method) { method(:create_work_package) }
end
- it 'allows to go to the full page through the toaster (Regression #37555)' do
+ it "allows to go to the full page through the toaster (Regression #37555)" do
create_work_package(type_task)
save_work_package!
- wp_page.expect_toast message: 'Successful creation. Click here to open this work package in fullscreen view.'
- page.find('.op-toast--target-link', text: 'Click here to open this work package in fullscreen view.').click
+ wp_page.expect_toast message: "Successful creation. Click here to open this work package in fullscreen view."
+ page.find(".op-toast--target-link", text: "Click here to open this work package in fullscreen view.").click
full_page = Pages::FullWorkPackage.new(WorkPackage.last)
full_page.ensure_page_loaded
full_page.expect_subject
end
- it 'reloads the table and selects the new work package' do
- expect(page).to have_no_css('.wp--row')
+ it "reloads the table and selects the new work package" do
+ expect(page).to have_no_css(".wp--row")
create_work_package(type_task)
expect(page).to have_selector(safeguard_selector, wait: 10)
- wp_page.subject_field.set('new work package')
+ wp_page.subject_field.set("new work package")
save_work_package!
wp_page.dismiss_toaster!
- expect(page).to have_css('.wp--row.-checked')
+ expect(page).to have_css(".wp--row.-checked")
# Editing the subject after creation
# Fix for WP #23879
new_wp = WorkPackage.last
- new_subject = 'new subject'
+ new_subject = "new subject"
table_subject = wp_table.edit_field(new_wp, :subject)
table_subject.activate!
table_subject.set_value new_subject
@@ -262,7 +262,7 @@ def create_work_package_globally(type, project_name)
table_subject.expect_state_text new_subject
wp_page.expect_toast(
- message: 'Successful update. Click here to open this work package in fullscreen view.'
+ message: "Successful update. Click here to open this work package in fullscreen view."
)
new_wp.reload
@@ -274,8 +274,8 @@ def create_work_package_globally(type, project_name)
end
end
- context 'full screen' do
- let(:safeguard_selector) { '.work-package--new-state' }
+ context "full screen" do
+ let(:safeguard_selector) { ".work-package--new-state" }
let(:existing_wp) { create(:work_package, type: type_bug, project:) }
let(:wp_page) { Pages::FullWorkPackage.new(existing_wp) }
@@ -284,12 +284,12 @@ def create_work_package_globally(type, project_name)
wp_page.ensure_page_loaded
end
- it 'displays chosen date attribute for milestone type (#44701)' do
+ it "displays chosen date attribute for milestone type (#44701)" do
click_create_work_package_button(type_milestone)
date_field = wp_page.edit_field(:date)
- date_field.expect_value(I18n.t('js.label_no_date'))
+ date_field.expect_value(I18n.t("js.label_no_date"))
# Set date
date_field.click_to_open_datepicker
@@ -301,13 +301,13 @@ def create_work_package_globally(type, project_name)
date_field.expect_value date
end
- it_behaves_like 'work package creation workflow' do
+ it_behaves_like "work package creation workflow" do
let(:create_method) { method(:create_work_package) }
end
end
- context 'global split screen' do
- let(:safeguard_selector) { '.work-packages--details-content.-create-mode' }
+ context "global split screen" do
+ let(:safeguard_selector) { ".work-packages--details-content.-create-mode" }
let(:wp_page) { Pages::SplitWorkPackage.new(WorkPackage.new) }
let(:wp_table) { Pages::WorkPackagesTable.new(nil) }
@@ -315,38 +315,38 @@ def create_work_package_globally(type, project_name)
wp_table.visit!
end
- it_behaves_like 'work package creation workflow' do
+ it_behaves_like "work package creation workflow" do
let(:create_method) { method(:create_work_package_globally) }
end
- it 'can stop and re-create with correct selection (Regression #30216)' do
+ it "can stop and re-create with correct selection (Regression #30216)" do
create_work_package_globally(type_bug, project.name)
- click_on 'Cancel'
+ click_on "Cancel"
wp_page.click_create_wp_button type_bug
- expect(page).to have_no_css('.ng-value', text: project.name)
+ expect(page).to have_no_css(".ng-value", text: project.name)
project_field.openSelectField
project_field.set_value project.name
- click_on 'Cancel'
+ click_on "Cancel"
end
- it 'sets a default date that is readable (Regression #34291)' do
+ it "sets a default date that is readable (Regression #34291)" do
create_work_package_globally(type_bug, project.name)
date_field = wp_page.edit_field(:combinedDate)
date_field.expect_value("no start date - no finish date")
- click_on 'Cancel'
+ click_on "Cancel"
end
- it 'can save the work package with an assignee (Regression #32887)' do
+ it "can save the work package with an assignee (Regression #32887)" do
create_work_package_globally(type_task, project.name)
expect(page).to have_selector(safeguard_selector, wait: 10)
- wp_page.subject_field.set('new work package')
+ wp_page.subject_field.set("new work package")
save_work_package!
wp_page.dismiss_toaster!
@@ -355,7 +355,7 @@ def create_work_package_globally(type, project_name)
expect(wp.assigned_to).to eq user
end
- it 'resets the dates when opening the datepicker and cancelling (Regression #44152)' do
+ it "resets the dates when opening the datepicker and cancelling (Regression #44152)" do
create_work_package_globally(type_task, project.name)
expect(page).to have_selector(safeguard_selector, wait: 10)
@@ -372,26 +372,26 @@ def create_work_package_globally(type, project_name)
# Cancel
date_field.cancel_by_click
- date_field.expect_value 'no start date - no finish date'
+ date_field.expect_value "no start date - no finish date"
end
- context 'with a project without type_bug' do
+ context "with a project without type_bug" do
let!(:project_without_bug) do
- create(:project, name: 'Unrelated project', types: [type_task])
+ create(:project, name: "Unrelated project", types: [type_task])
end
- it 'does not show that value in the project drop down' do
+ it "does not show that value in the project drop down" do
create_work_package_globally(type_bug, project.name)
project_field.openSelectField
- expect(page).to have_css('.ng-dropdown-panel .ng-option', text: project.name)
- expect(page).to have_no_css('.ng-dropdown-panel .ng-option', text: project_without_bug.name)
+ expect(page).to have_css(".ng-dropdown-panel .ng-option", text: project.name)
+ expect(page).to have_no_css(".ng-dropdown-panel .ng-option", text: project_without_bug.name)
end
end
end
- context 'as a user with no permissions' do
+ context "as a user with no permissions" do
let(:role) { create(:project_role, permissions: %i(view_work_packages)) }
let(:user) { create(:user, member_with_roles: { project => role }) }
let(:wp_page) { Pages::Page.new }
@@ -405,15 +405,15 @@ def create_work_package_globally(type, project_name)
]
end
- it 'shows a 403 error on creation paths' do
+ it "shows a 403 error on creation paths" do
paths.each do |path|
visit path
- wp_page.expect_toast(type: :error, message: I18n.t('api_v3.errors.code_403'))
+ wp_page.expect_toast(type: :error, message: I18n.t("api_v3.errors.code_403"))
end
end
end
- context 'as a user with add_work_packages permission, but not edit_work_packages permission (Regression 28580)' do
+ context "as a user with add_work_packages permission, but not edit_work_packages permission (Regression 28580)" do
let(:role) { create(:project_role, permissions: %i(view_work_packages add_work_packages)) }
let(:user) { create(:user, member_with_roles: { project => role }) }
let(:wp_page) { Pages::FullWorkPackageCreate.new }
@@ -422,15 +422,15 @@ def create_work_package_globally(type, project_name)
visit new_project_work_packages_path(project)
end
- it 'can create the work package, but not update it after saving' do
+ it "can create the work package, but not update it after saving" do
type_field.activate!
type_field.set_value type_bug.name
# wait after the type change
sleep(0.2)
- subject_field.update('new work package', save: true)
+ subject_field.update("new work package", save: true)
wp_page.expect_and_dismiss_toaster(
- message: 'Successful creation.'
+ message: "Successful creation."
)
subject_field.expect_read_only
@@ -439,7 +439,7 @@ def create_work_package_globally(type, project_name)
end
end
- context 'an anonymous user is prompted to login' do
+ context "an anonymous user is prompted to login" do
let(:user) { create(:anonymous) }
let(:wp_page) { Pages::Page.new }
@@ -452,7 +452,7 @@ def create_work_package_globally(type, project_name)
]
end
- it 'shows a 403 error on creation paths' do
+ it "shows a 403 error on creation paths" do
paths.each do |path|
visit path
expect(wp_page.current_url).to match /#{signin_path}\?back_url=/
@@ -460,7 +460,7 @@ def create_work_package_globally(type, project_name)
end
end
- context 'creating child work packages' do
+ context "creating child work packages" do
let!(:parent) do
create(:work_package,
project:,
@@ -474,64 +474,64 @@ def create_work_package_globally(type, project_name)
let(:wp_page) { Pages::FullWorkPackage.new(parent) }
let(:wp_page_create) { Pages::FullWorkPackageCreate.new(project:) }
- it 'from within the table' do
+ it "from within the table" do
work_packages_page.visit_index
context_menu.open_for(parent)
- context_menu.choose('Create new child')
+ context_menu.choose("Create new child")
# The dates are taken over from the parent by default
date_field = split_create_page.edit_field(:combinedDate)
date_field.expect_value("#{parent.start_date} - #{parent.due_date}")
date_field.click_to_open_datepicker
- date_field.update ['', parent.due_date]
+ date_field.update ["", parent.due_date]
subject = split_create_page.edit_field(:subject)
- subject.set_value 'Child'
+ subject.set_value "Child"
split_create_page.save!
- split_create_page.expect_and_dismiss_toaster(message: I18n.t('js.notice_successful_create'))
+ split_create_page.expect_and_dismiss_toaster(message: I18n.t("js.notice_successful_create"))
split_create_page.expect_attributes(combinedDate: "no start date - #{parent.due_date.strftime('%m/%d/%Y')}")
- expect(split_create_page).to have_test_selector('op-wp-breadcrumb', text: "Parent:\n#{parent.subject}")
+ expect(split_create_page).to have_test_selector("op-wp-breadcrumb", text: "Parent:\n#{parent.subject}")
end
- it 'can navigate to the fullscreen page (Regression #49565)' do
+ it "can navigate to the fullscreen page (Regression #49565)" do
work_packages_page.visit_index
context_menu.open_for(parent)
- context_menu.choose('Create new child')
+ context_menu.choose("Create new child")
subject_field = split_create_page.edit_field(:subject)
- subject_field.set_value 'My subtask'
+ subject_field.set_value "My subtask"
- find('.work-packages-show-view-button').click
+ find(".work-packages-show-view-button").click
expect(split_create_page).not_to have_alert_dialog
subject_field = wp_page_create.edit_field(:subject)
- subject_field.expect_value 'My subtask'
+ subject_field.expect_value "My subtask"
end
- it 'from the relations tab' do
- wp_page.visit_tab!('relations')
+ it "from the relations tab" do
+ wp_page.visit_tab!("relations")
- click_button('Create new child')
+ click_button("Create new child")
subject = EditField.new wp_page, :subject
- subject.set_value 'Child'
+ subject.set_value "Child"
subject.submit_by_enter
- wp_page.expect_and_dismiss_toaster(message: I18n.t('js.notice_successful_create'))
+ wp_page.expect_and_dismiss_toaster(message: I18n.t("js.notice_successful_create"))
# Move to the newly created child
wp_page.find("wp-children-query tbody.results-tbody tr").double_click
wp_page.expect_attributes(combinedDate: "#{parent.start_date.strftime('%m/%d/%Y')} - #{parent.due_date.strftime('%m/%d/%Y')}")
- expect(wp_page).to have_test_selector('op-wp-breadcrumb', text: "Parent:\n#{parent.subject}")
+ expect(wp_page).to have_test_selector("op-wp-breadcrumb", text: "Parent:\n#{parent.subject}")
end
end
end
diff --git a/spec/features/work_packages/new/work_package_default_description_spec.rb b/spec/features/work_packages/new/work_package_default_description_spec.rb
index 3d3305b4098b..d905d29feb8f 100644
--- a/spec/features/work_packages/new/work_package_default_description_spec.rb
+++ b/spec/features/work_packages/new/work_package_default_description_spec.rb
@@ -1,9 +1,9 @@
-require 'spec_helper'
-require 'support/edit_fields/edit_field'
-require 'features/work_packages/work_packages_page'
-require 'features/page_objects/notification'
+require "spec_helper"
+require "support/edit_fields/edit_field"
+require "features/work_packages/work_packages_page"
+require "features/page_objects/notification"
-RSpec.describe 'new work package', :js do
+RSpec.describe "new work package", :js do
let(:type_task) { create(:type_task, description: "# New Task template\n\nHello there") }
let(:type_feature) { create(:type_feature, description: "", is_default: true) }
let(:type_bug) { create(:type_bug, description: "# New Bug template\n\nGeneral Kenobi") }
@@ -26,31 +26,31 @@
# Changes in the description shall not be overridden.
def change_type_and_expect_description(set_project: false)
if !set_project
- expect(page).to have_css('.inline-edit--container.type', text: type_feature.name)
+ expect(page).to have_css(".inline-edit--container.type", text: type_feature.name)
end
- expect(page).to have_css('.inline-edit--container.description', text: '')
+ expect(page).to have_css(".inline-edit--container.description", text: "")
type_field.openSelectField
type_field.set_value type_task
- expect(page).to have_css('.inline-edit--container.description h1', text: 'New Task template')
+ expect(page).to have_css(".inline-edit--container.description h1", text: "New Task template")
type_field.openSelectField
type_field.set_value type_bug
- expect(page).to have_css('.inline-edit--container.description h1', text: 'New Bug template')
+ expect(page).to have_css(".inline-edit--container.description h1", text: "New Bug template")
- description_field.set_value 'Something different than the default.'
+ description_field.set_value "Something different than the default."
sleep 0.1
type_field.openSelectField
type_field.set_value type_task
- expect(page).to have_css('.inline-edit--container.description', text: 'Something different than the default.')
+ expect(page).to have_css(".inline-edit--container.description", text: "Something different than the default.")
sleep 0.1
type_field.openSelectField
type_field.set_value type_bug
- expect(page).to have_css('.inline-edit--container.description', text: 'Something different than the default.')
+ expect(page).to have_css(".inline-edit--container.description", text: "Something different than the default.")
if set_project
project_field.openSelectField
@@ -58,38 +58,38 @@ def change_type_and_expect_description(set_project: false)
sleep 1
end
- scroll_to_and_click find_by_id('work-packages--edit-actions-save')
- wp_page.expect_toast message: 'Successful creation.'
+ scroll_to_and_click find_by_id("work-packages--edit-actions-save")
+ wp_page.expect_toast message: "Successful creation."
- expect(page).to have_css('.inline-edit--display-field.description', text: 'Something different than the default.')
+ expect(page).to have_css(".inline-edit--display-field.description", text: "Something different than the default.")
end
before do
login_as(user)
end
- describe 'global work package create' do
- it 'shows the template after selection of project and type' do
- visit '/work_packages/new'
+ describe "global work package create" do
+ it "shows the template after selection of project and type" do
+ visit "/work_packages/new"
wp_page.expect_fully_loaded
- subject_field.set_value 'Foobar!'
+ subject_field.set_value "Foobar!"
change_type_and_expect_description set_project: true
end
end
- describe 'project work package create' do
+ describe "project work package create" do
let(:wp_table) { Pages::WorkPackagesTable.new project }
let(:wp_page) { Pages::SplitWorkPackageCreate.new project: }
- it 'shows the template after selection of project and type' do
+ it "shows the template after selection of project and type" do
wp_table.visit!
wp_table.create_wp_by_button type_feature
wp_page.expect_fully_loaded
- subject_field.set_value 'Foobar!'
+ subject_field.set_value "Foobar!"
type_field.activate!
diff --git a/spec/features/work_packages/pagination_spec.rb b/spec/features/work_packages/pagination_spec.rb
index d326276c4702..3d5babd12b21 100644
--- a/spec/features/work_packages/pagination_spec.rb
+++ b/spec/features/work_packages/pagination_spec.rb
@@ -26,66 +26,66 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package pagination', :js do
+RSpec.describe "Work package pagination", :js do
shared_let(:admin) { create(:admin) }
let(:project) do
- create(:project, name: 'project1', identifier: 'project1')
+ create(:project, name: "project1", identifier: "project1")
end
- shared_examples_for 'paginated work package list' do
+ shared_examples_for "paginated work package list" do
let!(:work_package_1) { create(:work_package, project:) }
let!(:work_package_2) { create(:work_package, project:) }
before do
login_as(admin)
- allow(Setting).to receive(:per_page_options).and_return '1, 50, 100'
+ allow(Setting).to receive(:per_page_options).and_return "1, 50, 100"
visit path
expect(page).to have_current_path(expected_path, ignore_query: true)
end
it do
- expect(page).to have_content('All open')
+ expect(page).to have_content("All open")
- within('.work-packages-partitioned-query-space--container') do
+ within(".work-packages-partitioned-query-space--container") do
expect(page).to have_content(work_package_1.subject)
expect(page).to have_no_content(work_package_2.subject)
end
- within('.op-pagination--pages') do
- find('.op-pagination--item button', text: '2').click
+ within(".op-pagination--pages") do
+ find(".op-pagination--item button", text: "2").click
end
- within('.work-packages-partitioned-query-space--container') do
+ within(".work-packages-partitioned-query-space--container") do
expect(page).to have_content(work_package_2.subject)
expect(page).to have_no_content(work_package_1.subject)
end
- within('.op-pagination--options') do
- find('.op-pagination--item button', text: '50').click
+ within(".op-pagination--options") do
+ find(".op-pagination--item button", text: "50").click
end
- within('.work-packages-partitioned-query-space--container') do
+ within(".work-packages-partitioned-query-space--container") do
expect(page).to have_content(work_package_1.subject)
expect(page).to have_content(work_package_2.subject)
end
end
end
- context 'with project scope' do
- it_behaves_like 'paginated work package list' do
+ context "with project scope" do
+ it_behaves_like "paginated work package list" do
let(:path) { project_work_packages_path(project) }
- let(:expected_path) { '/projects/project1/work_packages' }
+ let(:expected_path) { "/projects/project1/work_packages" }
end
end
- context 'globally' do
- it_behaves_like 'paginated work package list' do
+ context "globally" do
+ it_behaves_like "paginated work package list" do
let(:path) { work_packages_path }
- let(:expected_path) { '/work_packages' }
+ let(:expected_path) { "/work_packages" }
end
end
end
diff --git a/spec/features/work_packages/project_include/project_include_shared_examples.rb b/spec/features/work_packages/project_include/project_include_shared_examples.rb
index 436c8d691759..83086bac17c4 100644
--- a/spec/features/work_packages/project_include/project_include_shared_examples.rb
+++ b/spec/features/work_packages/project_include/project_include_shared_examples.rb
@@ -26,43 +26,43 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.shared_examples 'has a project include dropdown', :js, type: :feature do
+RSpec.shared_examples "has a project include dropdown", :js, type: :feature do
let(:dropdown) { Components::ProjectIncludeComponent.new }
shared_let(:project) do
- create(:project, name: 'Parent', enabled_module_names: enabled_modules)
+ create(:project, name: "Parent", enabled_module_names: enabled_modules)
end
shared_let(:sub_project) do
- create(:project, name: 'Direct Child', parent: project, enabled_module_names: enabled_modules)
+ create(:project, name: "Direct Child", parent: project, enabled_module_names: enabled_modules)
end
# The user will not receive a membership in this project
# which is why it is invisible to the user.
shared_let(:sub_sub_project_invisible) do
- create(:project, name: 'Invisible Grandchild', parent: sub_project, enabled_module_names: enabled_modules)
+ create(:project, name: "Invisible Grandchild", parent: sub_project, enabled_module_names: enabled_modules)
end
shared_let(:sub_sub_sub_project) do
- create(:project, name: 'Direct grand Grandchild', parent: sub_sub_project_invisible, enabled_module_names: enabled_modules)
+ create(:project, name: "Direct grand Grandchild", parent: sub_sub_project_invisible, enabled_module_names: enabled_modules)
end
shared_let(:other_project) do
- create(:project, name: 'Other project', enabled_module_names: enabled_modules)
+ create(:project, name: "Other project", enabled_module_names: enabled_modules)
end
shared_let(:other_sub_project) do
- create(:project, name: 'Other Child', parent: other_project, enabled_module_names: enabled_modules)
+ create(:project, name: "Other Child", parent: other_project, enabled_module_names: enabled_modules)
end
shared_let(:other_sub_sub_project) do
- create(:project, name: 'First other sub sub child', parent: other_sub_project, enabled_module_names: enabled_modules)
+ create(:project, name: "First other sub sub child", parent: other_sub_project, enabled_module_names: enabled_modules)
end
shared_let(:another_sub_sub_project) do
- create(:project, name: 'Second other sub sub child', parent: other_sub_project, enabled_module_names: enabled_modules)
+ create(:project, name: "Second other sub sub child", parent: other_sub_project, enabled_module_names: enabled_modules)
end
shared_let(:user) do
@@ -80,8 +80,8 @@
shared_let(:other_user) do
create(:user,
- firstname: 'Other',
- lastname: 'User',
+ firstname: "Other",
+ lastname: "User",
member_with_permissions: {
project => permissions,
sub_project => permissions,
@@ -136,7 +136,7 @@
assigned_to: other_user,
start_date: Time.zone.today,
due_date: Time.zone.today + 2.days,
- subject: 'A task for the other user')
+ subject: "A task for the other user")
end
shared_let(:other_other_task) do
@@ -146,7 +146,7 @@
assigned_to: other_user,
start_date: Time.zone.today - 2.days,
due_date: Time.zone.today + 4.days,
- subject: 'A task for the other user in other-project')
+ subject: "A task for the other user in other-project")
end
before do
@@ -170,7 +170,7 @@
work_package_view.visit!
end
- it 'can add and remove projects' do
+ it "can add and remove projects" do
dropdown.expect_count 1
dropdown.toggle!
dropdown.expect_open
@@ -214,14 +214,14 @@
dropdown.expect_checkbox(sub_project.id)
dropdown.expect_checkbox(sub_sub_sub_project.id)
- dropdown.click_button 'Apply'
+ dropdown.click_button "Apply"
dropdown.expect_closed
dropdown.expect_count 2
dropdown.toggle!
dropdown.toggle_checkbox(sub_sub_sub_project.id)
- dropdown.click_button 'Apply'
+ dropdown.click_button "Apply"
dropdown.expect_closed
dropdown.expect_count 3
@@ -253,12 +253,12 @@
dropdown.toggle_checkbox(sub_sub_sub_project.id)
- dropdown.click_button 'Apply'
+ dropdown.click_button "Apply"
dropdown.expect_closed
dropdown.expect_count 2
end
- it 'can clear the selection' do
+ it "can clear the selection" do
dropdown.expect_count 1
dropdown.toggle!
dropdown.expect_open
@@ -275,13 +275,13 @@
dropdown.expect_checkbox(sub_project.id, true)
dropdown.expect_checkbox(sub_sub_sub_project.id, true)
- dropdown.click_button 'Apply'
+ dropdown.click_button "Apply"
dropdown.expect_closed
dropdown.expect_count 2
dropdown.toggle!
- dropdown.click_button 'Clear selection'
+ dropdown.click_button "Clear selection"
dropdown.expect_checkbox(other_project.id)
dropdown.expect_checkbox(other_sub_project.id)
@@ -304,13 +304,13 @@
dropdown.expect_checkbox(sub_project.id)
dropdown.expect_checkbox(sub_sub_sub_project.id, true)
- dropdown.click_button 'Apply'
+ dropdown.click_button "Apply"
dropdown.expect_closed
dropdown.expect_count 3
dropdown.toggle!
- dropdown.click_button 'Clear selection'
+ dropdown.click_button "Clear selection"
dropdown.expect_checkbox(other_project.id)
dropdown.expect_checkbox(other_sub_project.id)
@@ -320,12 +320,12 @@
dropdown.expect_checkbox(sub_project.id)
dropdown.expect_checkbox(sub_sub_sub_project.id)
- dropdown.click_button 'Apply'
+ dropdown.click_button "Apply"
dropdown.expect_closed
dropdown.expect_count 1
end
- it 'filter projects in the list' do
+ it "filter projects in the list" do
dropdown.expect_count 1
dropdown.toggle!
dropdown.expect_open
@@ -355,7 +355,7 @@
end
retry_block do
- dropdown.search ''
+ dropdown.search ""
dropdown.expect_checkbox(other_project.id)
dropdown.expect_checkbox(other_sub_project.id)
@@ -428,7 +428,7 @@
end
retry_block do
- dropdown.search ''
+ dropdown.search ""
dropdown.expect_checkbox(other_project.id, true)
dropdown.expect_no_checkbox(other_sub_project.id)
@@ -452,11 +452,11 @@
end
end
- it 'keeps working even when there are no results (regression #42908)' do
+ it "keeps working even when there are no results (regression #42908)" do
dropdown.expect_count 1
dropdown.toggle!
dropdown.expect_open
- dropdown.search 'Nonexistent'
+ dropdown.search "Nonexistent"
expect(page).to have_no_css("[data-test-selector='op-project-include--loading']")
end
end
diff --git a/spec/features/work_packages/remaining_time_spec.rb b/spec/features/work_packages/remaining_time_spec.rb
index 033a030f5ec0..2ba7212cfbce 100644
--- a/spec/features/work_packages/remaining_time_spec.rb
+++ b/spec/features/work_packages/remaining_time_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work packages remaining time', :js, :with_cuprite do
+RSpec.describe "Work packages remaining time", :js, :with_cuprite do
shared_current_user { create(:admin) }
shared_let(:project) do
create(:project,
@@ -40,21 +40,21 @@
author: current_user)
end
- it 'can set and edit the remaining time in hours (Regression #43549)' do
+ it "can set and edit the remaining time in hours (Regression #43549)" do
wp_page = Pages::FullWorkPackage.new(work_package)
wp_page.visit!
wp_page.expect_subject
- wp_page.expect_attributes remainingTime: '-'
+ wp_page.expect_attributes remainingTime: "-"
- wp_page.update_attributes remainingTime: '125' # rubocop:disable Rails/ActiveRecordAliases
- wp_page.expect_attributes remainingTime: '125 h'
+ wp_page.update_attributes remainingTime: "125" # rubocop:disable Rails/ActiveRecordAliases
+ wp_page.expect_attributes remainingTime: "125 h"
work_package.reload
expect(work_package.remaining_hours).to eq 125.0
end
- it 'displays the remaining time sum properly in hours (Regression #43833)' do
+ it "displays the remaining time sum properly in hours (Regression #43833)" do
wp_table_page = Pages::WorkPackagesTable.new(project)
query_props = JSON.dump({
@@ -63,11 +63,11 @@
})
wp_table_page.visit_with_params("query_props=#{query_props}")
- wp_table_page.expect_work_package_with_attributes work_package, remainingTime: '-'
+ wp_table_page.expect_work_package_with_attributes work_package, remainingTime: "-"
- wp_table_page.update_work_package_attributes work_package, remainingTime: '125'
- wp_table_page.expect_work_package_with_attributes work_package, remainingTime: '125 h'
- wp_table_page.expect_sums_row_with_attributes remainingTime: '125 h'
+ wp_table_page.update_work_package_attributes work_package, remainingTime: "125"
+ wp_table_page.expect_work_package_with_attributes work_package, remainingTime: "125 h"
+ wp_table_page.expect_sums_row_with_attributes remainingTime: "125 h"
work_package.reload
expect(work_package.remaining_hours).to eq 125.0
diff --git a/spec/features/work_packages/reports_spec.rb b/spec/features/work_packages/reports_spec.rb
index 86c82b9f3ac7..676f3e7b7b70 100644
--- a/spec/features/work_packages/reports_spec.rb
+++ b/spec/features/work_packages/reports_spec.rb
@@ -26,14 +26,14 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'work package reports', :js do
+RSpec.describe "work package reports", :js do
let(:project) { create(:project_with_types, types: [type_a]) }
let(:user) { create(:user, member_with_permissions: { project => %i(view_work_packages) }) }
let(:type_a) do
- create(:type_with_workflow, name: 'Type A').tap do |t|
+ create(:type_with_workflow, name: "Type A").tap do |t|
t.statuses.last.update_attribute(:is_closed, true)
end
end
@@ -47,73 +47,73 @@
login_as(user)
end
- it 'allows navigating to the reports page and drilling down' do
+ it "allows navigating to the reports page and drilling down" do
wp_table_page.visit!
- within '.main-menu--children' do
- click_on 'Summary'
+ within ".main-menu--children" do
+ click_on "Summary"
end
expect(page)
- .to have_content 'TYPE'
+ .to have_content "TYPE"
expect(page)
- .to have_content 'PRIORITY'
+ .to have_content "PRIORITY"
expect(page)
- .to have_content 'ASSIGNEE'
+ .to have_content "ASSIGNEE"
expect(page)
- .to have_content 'ACCOUNTABLE'
+ .to have_content "ACCOUNTABLE"
expect(page)
- .to have_css 'thead th:nth-of-type(2)', text: type_a.statuses.first.name.upcase
+ .to have_css "thead th:nth-of-type(2)", text: type_a.statuses.first.name.upcase
expect(page)
- .to have_css 'thead th:nth-of-type(3)', text: type_a.statuses.last.name.upcase
+ .to have_css "thead th:nth-of-type(3)", text: type_a.statuses.last.name.upcase
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(1)', text: type_a.name
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(1)", text: type_a.name
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(2)', text: 1
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(2)", text: 1
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(3)', text: 1
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(3)", text: 1
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(4)', text: 1
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(4)", text: 1
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(5)', text: 1
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(5)", text: 1
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(6)', text: 2
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(6)", text: 2
# Clicking on the further analyze link will lead to a page focusing on type
- click_link 'Further analyze: Type'
+ click_link "Further analyze: Type"
expect(page)
- .to have_content 'TYPE'
+ .to have_content "TYPE"
expect(page)
- .to have_no_content 'PRIORITY'
+ .to have_no_content "PRIORITY"
expect(page)
- .to have_no_content 'ASSIGNEE'
+ .to have_no_content "ASSIGNEE"
expect(page)
- .to have_no_content 'ACCOUNTABLE'
+ .to have_no_content "ACCOUNTABLE"
expect(page)
- .to have_css 'thead th:nth-of-type(2)', text: type_a.statuses.first.name.upcase
+ .to have_css "thead th:nth-of-type(2)", text: type_a.statuses.first.name.upcase
expect(page)
- .to have_css 'thead th:nth-of-type(3)', text: type_a.statuses.last.name.upcase
+ .to have_css "thead th:nth-of-type(3)", text: type_a.statuses.last.name.upcase
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(1)', text: type_a.name
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(1)", text: type_a.name
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(2)', text: 1
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(2)", text: 1
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(3)', text: 1
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(3)", text: 1
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(4)', text: 1
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(4)", text: 1
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(5)', text: 1
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(5)", text: 1
expect(page)
- .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(6)', text: 2
+ .to have_css "tbody tr:nth-of-type(1) td:nth-of-type(6)", text: 2
# Clicking on a number in the table will lead to the wp list filtered by the type
- within 'tbody tr:first-of-type td:nth-of-type(2)' do
- click_link '1'
+ within "tbody tr:first-of-type td:nth-of-type(2)" do
+ click_link "1"
end
wp_table_page.expect_work_package_listed(wp1)
diff --git a/spec/features/work_packages/scheduling/scheduling_mode_spec.rb b/spec/features/work_packages/scheduling/scheduling_mode_spec.rb
index e1712597c00c..55365b76792a 100644
--- a/spec/features/work_packages/scheduling/scheduling_mode_spec.rb
+++ b/spec/features/work_packages/scheduling/scheduling_mode_spec.rb
@@ -26,14 +26,14 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/page_objects/notification'
-require 'features/work_packages/details/inplace_editor/shared_examples'
-require 'features/work_packages/shared_contexts'
-require 'support/edit_fields/edit_field'
-require 'features/work_packages/work_packages_page'
-
-RSpec.describe 'scheduling mode', :js do
+require "spec_helper"
+require "features/page_objects/notification"
+require "features/work_packages/details/inplace_editor/shared_examples"
+require "features/work_packages/shared_contexts"
+require "support/edit_fields/edit_field"
+require "features/work_packages/work_packages_page"
+
+RSpec.describe "scheduling mode", :js do
let(:project) { create(:project_with_types, public: true) }
# Constructing a work package graph that looks like this:
#
@@ -52,36 +52,36 @@
let!(:wp) do
create(:work_package,
project:,
- start_date: Date.parse('2016-01-01'),
- due_date: Date.parse('2016-01-05'),
+ start_date: Date.parse("2016-01-01"),
+ due_date: Date.parse("2016-01-05"),
parent: wp_parent)
end
let!(:wp_parent) do
create(:work_package,
project:,
- start_date: Date.parse('2016-01-01'),
- due_date: Date.parse('2016-01-05'))
+ start_date: Date.parse("2016-01-01"),
+ due_date: Date.parse("2016-01-05"))
end
let!(:wp_child) do
create(:work_package,
project:,
- start_date: Date.parse('2016-01-01'),
- due_date: Date.parse('2016-01-05'),
+ start_date: Date.parse("2016-01-01"),
+ due_date: Date.parse("2016-01-05"),
parent: wp)
end
let!(:wp_pre) do
create(:work_package,
project:,
- start_date: Date.parse('2015-12-15'),
- due_date: Date.parse('2015-12-31')).tap do |pre|
+ start_date: Date.parse("2015-12-15"),
+ due_date: Date.parse("2015-12-31")).tap do |pre|
create(:follows_relation, from: wp, to: pre)
end
end
let!(:wp_suc) do
create(:work_package,
project:,
- start_date: Date.parse('2016-01-06'),
- due_date: Date.parse('2016-01-10'),
+ start_date: Date.parse("2016-01-06"),
+ due_date: Date.parse("2016-01-10"),
parent: wp_suc_parent).tap do |suc|
create(:follows_relation, from: suc, to: wp)
end
@@ -89,14 +89,14 @@
let!(:wp_suc_parent) do
create(:work_package,
project:,
- start_date: Date.parse('2016-01-06'),
- due_date: Date.parse('2016-01-10'))
+ start_date: Date.parse("2016-01-06"),
+ due_date: Date.parse("2016-01-10"))
end
let!(:wp_suc_child) do
create(:work_package,
project:,
- start_date: Date.parse('2016-01-06'),
- due_date: Date.parse('2016-01-10'),
+ start_date: Date.parse("2016-01-06"),
+ due_date: Date.parse("2016-01-10"),
parent: wp_suc)
end
let(:work_packages_page) { Pages::SplitWorkPackage.new(wp, project) }
@@ -116,7 +116,7 @@ def expect_dates(work_package, start_date, due_date)
work_packages_page.ensure_page_loaded
end
- it 'can toggle the scheduling mode through the date modal' do
+ it "can toggle the scheduling mode through the date modal" do
expect(wp.schedule_manually).to be_falsey
# Editing the start/due dates of a parent work package is possible if the
@@ -128,29 +128,29 @@ def expect_dates(work_package, start_date, due_date)
combined_field.expect_duration 6
combined_field.save!
- work_packages_page.expect_and_dismiss_toaster message: 'Successful update.'
+ work_packages_page.expect_and_dismiss_toaster message: "Successful update."
# Changing the scheduling mode is journalized
work_packages_page.expect_activity_message("Manual scheduling activated")
- expect_dates(wp, '2016-01-05', '2016-01-10')
+ expect_dates(wp, "2016-01-05", "2016-01-10")
expect(wp.schedule_manually).to be_truthy
# is not moved because it is a child
- expect_dates(wp_child, '2016-01-01', '2016-01-05')
+ expect_dates(wp_child, "2016-01-01", "2016-01-05")
# The due date is moved backwards because its child was moved
# but the start date remains unchanged as its grandchild stays put.
- expect_dates(wp_parent, '2016-01-01', '2016-01-10')
+ expect_dates(wp_parent, "2016-01-01", "2016-01-10")
# is moved forward because of the follows relationship
- expect_dates(wp_suc, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc, "2016-01-11", "2016-01-15")
# is moved forward because it is the parent of the successor
- expect_dates(wp_suc_parent, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc_parent, "2016-01-11", "2016-01-15")
# is moved forward as the whole hierarchy is moved forward
- expect_dates(wp_suc_child, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc_child, "2016-01-11", "2016-01-15")
# Switching back to automatic scheduling will lead to the work package
# and all work packages that are dependent to be rescheduled again.
@@ -159,27 +159,27 @@ def expect_dates(work_package, start_date, due_date)
combined_field.toggle_scheduling_mode
combined_field.save!
- work_packages_page.expect_and_dismiss_toaster message: 'Successful update.'
+ work_packages_page.expect_and_dismiss_toaster message: "Successful update."
# Moved backward again as the child determines the dates again
- expect_dates(wp, '2016-01-01', '2016-01-05')
+ expect_dates(wp, "2016-01-01", "2016-01-05")
expect(wp.schedule_manually).to be_falsey
# Had not been moved in the first place
- expect_dates(wp_child, '2016-01-01', '2016-01-05')
+ expect_dates(wp_child, "2016-01-01", "2016-01-05")
# As the child now again takes up the same time interval as the grandchild,
# the interval is shortened again.
- expect_dates(wp_parent, '2016-01-01', '2016-01-05')
+ expect_dates(wp_parent, "2016-01-01", "2016-01-05")
# does not move backwards, as it just increases the gap between wp and wp_suc
- expect_dates(wp_suc, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc, "2016-01-11", "2016-01-15")
# does not move backwards either
- expect_dates(wp_suc_parent, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc_parent, "2016-01-11", "2016-01-15")
# does not move backwards either because its parent did not move
- expect_dates(wp_suc_child, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc_child, "2016-01-11", "2016-01-15")
# Switching back to manual scheduling but this time backward will lead to the work package
# and all work packages that are dependent to be rescheduled again.
@@ -196,26 +196,26 @@ def expect_dates(work_package, start_date, due_date)
combined_field.expect_duration 12
combined_field.save!
- work_packages_page.expect_and_dismiss_toaster message: 'Successful update.'
+ work_packages_page.expect_and_dismiss_toaster message: "Successful update."
- expect_dates(wp, '2015-12-20', '2015-12-31')
+ expect_dates(wp, "2015-12-20", "2015-12-31")
expect(wp.schedule_manually).to be_truthy
# is not moved because it is a child
- expect_dates(wp_child, '2016-01-01', '2016-01-05')
+ expect_dates(wp_child, "2016-01-01", "2016-01-05")
# The start date is moved forward because its child was moved
# but the due date remains unchanged as its grandchild stays put.
- expect_dates(wp_parent, '2015-12-20', '2016-01-05')
+ expect_dates(wp_parent, "2015-12-20", "2016-01-05")
# does not move backwards, as it just increases the gap between wp and wp_suc
- expect_dates(wp_suc, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc, "2016-01-11", "2016-01-15")
# does not move backwards either
- expect_dates(wp_suc_parent, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc_parent, "2016-01-11", "2016-01-15")
# does not move backwards either because its parent did not move
- expect_dates(wp_suc_child, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc_child, "2016-01-11", "2016-01-15")
# Switching back to automatic scheduling will lead to the work package
# and all work packages that are dependent to be rescheduled again to
@@ -225,26 +225,26 @@ def expect_dates(work_package, start_date, due_date)
combined_field.toggle_scheduling_mode
combined_field.save!
- work_packages_page.expect_and_dismiss_toaster message: 'Successful update.'
+ work_packages_page.expect_and_dismiss_toaster message: "Successful update."
# Moved backwards again as the child determines the dates again
- expect_dates(wp, '2016-01-01', '2016-01-05')
+ expect_dates(wp, "2016-01-01", "2016-01-05")
expect(wp.schedule_manually).to be_falsey
# Had not been moved in the first place
- expect_dates(wp_child, '2016-01-01', '2016-01-05')
+ expect_dates(wp_child, "2016-01-01", "2016-01-05")
# As the child now again takes up the same time interval as the grandchild,
# the interval is shortened again.
- expect_dates(wp_parent, '2016-01-01', '2016-01-05')
+ expect_dates(wp_parent, "2016-01-01", "2016-01-05")
# does not move
- expect_dates(wp_suc, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc, "2016-01-11", "2016-01-15")
# does not move either
- expect_dates(wp_suc_parent, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc_parent, "2016-01-11", "2016-01-15")
# does not move either because its parent did not move
- expect_dates(wp_suc_child, '2016-01-11', '2016-01-15')
+ expect_dates(wp_suc_child, "2016-01-11", "2016-01-15")
end
end
diff --git a/spec/features/work_packages/select/select_query_spec.rb b/spec/features/work_packages/select/select_query_spec.rb
index aacfe9d38943..202d1dcaa52f 100644
--- a/spec/features/work_packages/select/select_query_spec.rb
+++ b/spec/features/work_packages/select/select_query_spec.rb
@@ -26,11 +26,11 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'Query selection' do
- let(:project) { create(:project, identifier: 'test_project', public: false) }
+RSpec.describe "Query selection" do
+ let(:project) { create(:project, identifier: "test_project", public: false) }
let(:role) { create(:project_role, permissions: [:view_work_packages]) }
let(:current_user) do
create(:user, member_with_roles: { project => role })
@@ -43,8 +43,8 @@
let(:query) do
build(:query, project:, public: true).tap do |query|
query.filters.clear
- query.add_filter('assigned_to_id', '=', ['me'])
- query.add_filter('done_ratio', '>=', [10])
+ query.add_filter("assigned_to_id", "=", ["me"])
+ query.add_filter("done_ratio", ">=", [10])
query.save!
create(:view_work_packages_table,
query:)
@@ -61,35 +61,35 @@
login_as(current_user)
end
- context 'default view, without a query selected' do
+ context "default view, without a query selected" do
before do
work_packages_page.visit_index
filters.open
end
- it 'shows the default (status) filter', :js do
+ it "shows the default (status) filter", :js do
filters.expect_filter_count 1
- filters.expect_filter_by 'Status', 'open', nil
+ filters.expect_filter_by "Status", "open", nil
end
end
- context 'when a query is selected' do
+ context "when a query is selected" do
before do
query
work_packages_page.select_query query
end
- it 'shows the saved filters', :js do
+ it "shows the saved filters", :js do
filters.open
- filters.expect_filter_by 'Assignee', 'is (OR)', ['me']
- filters.expect_filter_by 'Percent Complete', '>=', ['10'], 'percentageDone'
+ filters.expect_filter_by "Assignee", "is (OR)", ["me"]
+ filters.expect_filter_by "Percent Complete", ">=", ["10"], "percentageDone"
- expect(page).to have_css("#{test_selector('wp-filter-button')} .badge", text: '2')
+ expect(page).to have_css("#{test_selector('wp-filter-button')} .badge", text: "2")
end
end
- context 'when the selected query is changed' do
+ context "when the selected query is changed" do
let(:query2) do
create(:query_with_view_work_packages_table,
project:,
@@ -103,10 +103,10 @@
work_packages_page.select_query query
end
- it 'updates the page upon query switching', :js do
+ it "updates the page upon query switching", :js do
wp_page.expect_title query.name, editable: false
- find('.op-sidemenu--item-action', text: query2.name).click
+ find(".op-sidemenu--item-action", text: query2.name).click
end
end
end
diff --git a/spec/features/work_packages/select/select_work_package_row_spec.rb b/spec/features/work_packages/select/select_work_package_row_spec.rb
index 1be14e379003..054bcebac989 100644
--- a/spec/features/work_packages/select/select_work_package_row_spec.rb
+++ b/spec/features/work_packages/select/select_work_package_row_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Select work package row', :js, :selenium do
+RSpec.describe "Select work package row", :js, :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_package_1) { create(:work_package, project:) }
@@ -36,7 +36,7 @@
let(:work_package_3) { create(:work_package, project:) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
- include_context 'work package table helpers'
+ include_context "work package table helpers"
before do
login_as(user)
@@ -103,18 +103,18 @@ def check_row_selection_state(row_index, state = true)
end
def check_all
- find('body').send_keys [:control, 'a']
+ find("body").send_keys [:control, "a"]
expect_row_checked(1, 2, 3)
- expect(page).to have_no_css '#work-package-context-menu'
+ expect(page).to have_no_css "#work-package-context-menu"
end
def uncheck_all
- find('body').send_keys [:control, 'd']
+ find("body").send_keys [:control, "d"]
expect_row_unchecked(1, 2, 3)
- expect(page).to have_no_css '#work-package-context-menu'
+ expect(page).to have_no_css "#work-package-context-menu"
end
- it 'handles selection flows' do
+ it "handles selection flows" do
###
# Keyboard shortcuts
###
@@ -198,30 +198,30 @@ def uncheck_all
expect_row_unchecked(2)
end
- describe 'opening work package full screen view' do
+ describe "opening work package full screen view" do
before do
wp_table.open_full_screen_by_doubleclick(work_package_1)
end
it do
- expect(page).to have_css('.work-packages--details--subject',
+ expect(page).to have_css(".work-packages--details--subject",
text: work_package_1.subject)
end
end
- describe 'opening last selected work package' do
+ describe "opening last selected work package" do
before do
select_work_package_row(2)
expect_row_checked(2)
end
it do
- find_by_id('work-packages-details-view-button').click
+ find_by_id("work-packages-details-view-button").click
split_wp = Pages::SplitWorkPackage.new(work_package_2)
split_wp.expect_attributes Subject: work_package_2.subject
- find_by_id('work-packages-details-view-button').click
- expect(page).to have_no_css('.work-packages--details')
+ find_by_id("work-packages-details-view-button").click
+ expect(page).to have_no_css(".work-packages--details")
end
end
end
diff --git a/spec/features/work_packages/share/access_spec.rb b/spec/features/work_packages/share/access_spec.rb
index 19ae9b24db20..a93e3c727feb 100644
--- a/spec/features/work_packages/share/access_spec.rb
+++ b/spec/features/work_packages/share/access_spec.rb
@@ -26,15 +26,15 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Shared Work Package Access',
+RSpec.describe "Shared Work Package Access",
:js, :with_cuprite,
with_ee: %i[work_package_sharing] do
shared_let(:project) { create(:project_with_types) }
- shared_let(:work_package) { create(:work_package, project:, journal_notes: 'Hello!') }
+ shared_let(:work_package) { create(:work_package, project:, journal_notes: "Hello!") }
shared_let(:sharer) { create(:admin) }
- shared_let(:shared_with_user) { create(:user, firstname: 'Mean', lastname: 'Turkey') }
+ shared_let(:shared_with_user) { create(:user, firstname: "Mean", lastname: "Turkey") }
shared_let(:viewer_role) { create(:view_work_package_role) }
shared_let(:commenter_role) { create(:comment_work_package_role) }
@@ -47,8 +47,8 @@
let(:work_packages_page) { Pages::WorkPackagesTable.new(project) }
let(:work_package_page) { Pages::FullWorkPackage.new(work_package) }
let(:share_modal) { Components::WorkPackages::ShareModal.new(work_package) }
- let(:add_comment_button_selector) { '.work-packages--activity--add-comment' }
- let(:attach_files_button_selector) { 'op-attachments--upload-button' }
+ let(:add_comment_button_selector) { ".work-packages--activity--add-comment" }
+ let(:attach_files_button_selector) { "op-attachments--upload-button" }
specify "'View' role share access" do
using_session "sharer" do
@@ -59,17 +59,17 @@
work_package_page.click_share_button
share_modal.expect_open
- share_modal.invite_user!(shared_with_user, 'View')
+ share_modal.invite_user!(shared_with_user, "View")
share_modal.close
# Shared-with users with the "View" role CAN'T become assignees
assignee_field = work_package_page.edit_field(:assignee)
assignee_field.activate!
- results = assignee_field.autocomplete('Mean Turkey', select: false)
+ results = assignee_field.autocomplete("Mean Turkey", select: false)
wait_for_network_idle
expect(results)
- .to have_no_css('.ng-option', text: 'Mean Turkey', wait: 0)
+ .to have_no_css(".ng-option", text: "Mean Turkey", wait: 0)
assignee_field.cancel_by_escape
end
@@ -90,7 +90,7 @@
#
# Work Package is now visible
project_page.within_sidebar do
- click_link(I18n.t('label_work_package_plural'))
+ click_link(I18n.t("label_work_package_plural"))
end
work_packages_page.expect_work_package_listed(work_package)
work_package_page.visit!
@@ -113,8 +113,8 @@
end
# And so is viewing and uploading attachments
- work_package_page.switch_to_tab(tab: 'Files')
- work_package_page.expect_tab('Files')
+ work_package_page.switch_to_tab(tab: "Files")
+ work_package_page.expect_tab("Files")
work_package_page.within_active_tab do
expect(page)
.not_to have_test_selector(attach_files_button_selector)
@@ -131,7 +131,7 @@
work_package_page.click_share_button
share_modal.expect_open
- share_modal.invite_user!(shared_with_user, 'Comment')
+ share_modal.invite_user!(shared_with_user, "Comment")
share_modal.close
# TODO: This is currently expected failing behavior.
@@ -164,7 +164,7 @@
#
# Work Package is now visible
project_page.within_sidebar do
- click_link(I18n.t('label_work_package_plural'))
+ click_link(I18n.t("label_work_package_plural"))
end
work_packages_page.expect_work_package_listed(work_package)
work_package_page.visit!
@@ -180,7 +180,7 @@
end
# Spent time is visible and loggable
- SpentTimeEditField.new(page, 'spentTime')
+ SpentTimeEditField.new(page, "spentTime")
.time_log_icon_visible(true)
work_package_page.ensure_page_loaded # waits for activity section to be ready
@@ -191,8 +191,8 @@
end
# Attachments are uploadable
- work_package_page.switch_to_tab(tab: 'Files')
- work_package_page.expect_tab('Files')
+ work_package_page.switch_to_tab(tab: "Files")
+ work_package_page.expect_tab("Files")
work_package_page.within_active_tab do
expect(page)
.to have_test_selector(attach_files_button_selector)
@@ -209,7 +209,7 @@
work_package_page.click_share_button
share_modal.expect_open
- share_modal.invite_user!(shared_with_user, 'Edit')
+ share_modal.invite_user!(shared_with_user, "Edit")
share_modal.close
@@ -243,7 +243,7 @@
#
# Work Package is now visible
project_page.within_sidebar do
- click_link(I18n.t('label_work_package_plural'))
+ click_link(I18n.t("label_work_package_plural"))
end
work_packages_page.expect_work_package_listed(work_package)
work_package_page.visit!
@@ -264,7 +264,7 @@
end
# Spent time is visible and loggable
- SpentTimeEditField.new(page, 'spentTime')
+ SpentTimeEditField.new(page, "spentTime")
.time_log_icon_visible(true)
work_package_page.ensure_page_loaded # waits for activity section to be ready
@@ -275,8 +275,8 @@
end
# Attachments are uploadable
- work_package_page.switch_to_tab(tab: 'Files')
- work_package_page.expect_tab('Files')
+ work_package_page.switch_to_tab(tab: "Files")
+ work_package_page.expect_tab("Files")
work_package_page.within_active_tab do
expect(page)
.to have_test_selector(attach_files_button_selector)
diff --git a/spec/features/work_packages/share/bulk_sharing_spec.rb b/spec/features/work_packages/share/bulk_sharing_spec.rb
index 71e241f4a223..d57b066274d8 100644
--- a/spec/features/work_packages/share/bulk_sharing_spec.rb
+++ b/spec/features/work_packages/share/bulk_sharing_spec.rb
@@ -28,9 +28,9 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Packages', 'Bulk Sharing',
+RSpec.describe "Work Packages", "Bulk Sharing",
:js, :with_cuprite,
with_ee: %i[work_package_sharing] do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
@@ -48,16 +48,16 @@
view_shared_work_packages])
end
- shared_let(:sharer) { create(:user, firstname: 'Sharer', lastname: 'User') }
- shared_let(:viewer) { create(:user, firstname: 'Viewer', lastname: 'User') }
+ shared_let(:sharer) { create(:user, firstname: "Sharer", lastname: "User") }
+ shared_let(:viewer) { create(:user, firstname: "Viewer", lastname: "User") }
shared_let(:project) do
create(:project, members: { sharer => [sharer_role], viewer => [viewer_role] })
end
- shared_let(:dinesh) { create(:user, firstname: 'Dinesh', lastname: 'Chugtai') }
- shared_let(:gilfoyle) { create(:user, firstname: 'Bertram', lastname: 'Gilfoyle') }
- shared_let(:richard) { create(:user, firstname: 'Richard', lastname: 'Hendricks') }
+ shared_let(:dinesh) { create(:user, firstname: "Dinesh", lastname: "Chugtai") }
+ shared_let(:gilfoyle) { create(:user, firstname: "Bertram", lastname: "Gilfoyle") }
+ shared_let(:richard) { create(:user, firstname: "Richard", lastname: "Hendricks") }
shared_let(:work_package) do
create(:work_package, project:) do |wp|
@@ -70,10 +70,10 @@
let(:work_package_page) { Pages::FullWorkPackage.new(work_package) }
let(:share_modal) { Components::WorkPackages::ShareModal.new(work_package) }
- context 'when having share permission' do
+ context "when having share permission" do
current_user { sharer }
- it 'allows administrating shares in bulk' do
+ it "allows administrating shares in bulk" do
work_package_page.visit!
work_package_page.click_share_button
@@ -92,7 +92,7 @@
share_modal.expect_select_all_untoggled
# Available now
share_modal.expect_bulk_actions_available
- share_modal.expect_bulk_update_label('View')
+ share_modal.expect_bulk_update_label("View")
# Toggling all selects all
share_modal.toggle_select_all
@@ -100,7 +100,7 @@
share_modal.expect_selected_count_of(3)
share_modal.expect_select_all_toggled
share_modal.expect_bulk_actions_available
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
# Deselecting one individually
share_modal.deselect_shares(richard)
@@ -108,7 +108,7 @@
share_modal.expect_selected_count_of(2)
share_modal.expect_select_all_untoggled
share_modal.expect_bulk_actions_available
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
# Re-selecting the missing share
share_modal.select_shares(richard)
@@ -116,7 +116,7 @@
share_modal.expect_selected_count_of(3)
share_modal.expect_select_all_toggled
share_modal.expect_bulk_actions_available
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
# De-selecting all
share_modal.toggle_select_all
@@ -133,7 +133,7 @@
share_modal.expect_select_all_toggled
# Available again
share_modal.expect_bulk_actions_available
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
# De-selecting all individually
share_modal.deselect_shares(richard, dinesh, gilfoyle)
@@ -147,7 +147,7 @@
share_modal.select_shares(richard, dinesh)
share_modal.expect_selected_count_of(2)
share_modal.expect_select_all_untoggled
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
share_modal.remove_user(gilfoyle)
share_modal.expect_not_shared_with(gilfoyle)
@@ -155,35 +155,35 @@
share_modal.expect_selected(richard, dinesh)
share_modal.expect_selected_count_of(2)
share_modal.expect_select_all_toggled
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
- share_modal.invite_user(gilfoyle, 'Comment')
+ share_modal.invite_user(gilfoyle, "Comment")
share_modal.expect_shared_with(gilfoyle)
share_modal.expect_selected(richard, dinesh)
share_modal.expect_selected_count_of(2)
share_modal.expect_select_all_untoggled
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
end
aggregate_failures "Preserving selected states when performing individual updates" do
- share_modal.change_role(gilfoyle, 'View')
- share_modal.expect_shared_with(gilfoyle, 'View')
+ share_modal.change_role(gilfoyle, "View")
+ share_modal.expect_shared_with(gilfoyle, "View")
share_modal.expect_selected(richard, dinesh)
share_modal.expect_selected_count_of(2)
share_modal.expect_select_all_untoggled
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
share_modal.toggle_select_all
share_modal.expect_selected_count_of(3)
share_modal.expect_select_all_toggled
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
- share_modal.change_role(gilfoyle, 'Edit')
- share_modal.expect_shared_with(gilfoyle, 'Edit')
+ share_modal.change_role(gilfoyle, "Edit")
+ share_modal.expect_shared_with(gilfoyle, "Edit")
share_modal.expect_selected_count_of(3)
share_modal.expect_select_all_toggled
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
end
# Reset
@@ -212,37 +212,37 @@
end
# Re-populate
- share_modal.invite_user(richard, 'View')
+ share_modal.invite_user(richard, "View")
share_modal.expect_shared_with(richard)
- share_modal.invite_user(dinesh, 'Comment')
+ share_modal.invite_user(dinesh, "Comment")
share_modal.expect_shared_with(dinesh)
- aggregate_failures 'Bulk updating' do
+ aggregate_failures "Bulk updating" do
share_modal.select_shares(richard)
share_modal.expect_selected(richard)
share_modal.expect_selected_count_of(1)
- share_modal.expect_bulk_update_label('View')
+ share_modal.expect_bulk_update_label("View")
- share_modal.bulk_update('Edit')
+ share_modal.bulk_update("Edit")
- share_modal.expect_shared_with(richard, 'Edit')
- share_modal.expect_shared_with(dinesh, 'Comment')
+ share_modal.expect_shared_with(richard, "Edit")
+ share_modal.expect_shared_with(dinesh, "Comment")
share_modal.expect_selected(richard)
share_modal.expect_selected_count_of(1)
- share_modal.expect_bulk_update_label('Edit')
+ share_modal.expect_bulk_update_label("Edit")
share_modal.select_shares(richard, dinesh)
share_modal.expect_selected(richard, dinesh)
share_modal.expect_selected_count_of(2)
- share_modal.expect_bulk_update_label('Mixed')
+ share_modal.expect_bulk_update_label("Mixed")
- share_modal.bulk_update('View')
+ share_modal.bulk_update("View")
- share_modal.expect_shared_with(richard, 'View')
- share_modal.expect_shared_with(dinesh, 'View')
+ share_modal.expect_shared_with(richard, "View")
+ share_modal.expect_shared_with(dinesh, "View")
share_modal.expect_selected(richard, dinesh)
share_modal.expect_selected_count_of(2)
- share_modal.expect_bulk_update_label('View')
+ share_modal.expect_bulk_update_label("View")
share_modal.toggle_select_all
share_modal.expect_deselected(richard, dinesh)
@@ -273,8 +273,8 @@
share_modal.expect_select_all_not_available
share_modal.expect_bulk_actions_not_available
- share_modal.invite_user(richard, 'View')
- share_modal.expect_shared_with(richard, 'View')
+ share_modal.invite_user(richard, "View")
+ share_modal.expect_shared_with(richard, "View")
share_modal.expect_shared_count_of(2)
share_modal.expect_select_all_available
@@ -282,10 +282,10 @@
end
end
- context 'without share permission' do
+ context "without share permission" do
current_user { viewer }
- it 'does not allow bulk sharing' do
+ it "does not allow bulk sharing" do
work_package_page.visit!
work_package_page.click_share_button
diff --git a/spec/features/work_packages/share/enterprise_restriction_spec.rb b/spec/features/work_packages/share/enterprise_restriction_spec.rb
index 31afb836d9f2..8bede4e0c1b6 100644
--- a/spec/features/work_packages/share/enterprise_restriction_spec.rb
+++ b/spec/features/work_packages/share/enterprise_restriction_spec.rb
@@ -28,9 +28,9 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'rails_helper'
+require "rails_helper"
-RSpec.describe 'Work Package Sharing Enterprise Restriction', :js, :with_cuprite do
+RSpec.describe "Work Package Sharing Enterprise Restriction", :js, :with_cuprite do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
shared_let(:comment_work_package_role) { create(:comment_work_package_role) }
shared_let(:edit_work_package_role) { create(:edit_work_package_role) }
@@ -41,7 +41,7 @@
share_work_packages])
end
- shared_let(:sharer) { create(:user, firstname: 'Sharer', lastname: 'User') }
+ shared_let(:sharer) { create(:user, firstname: "Sharer", lastname: "User") }
shared_let(:project) { create(:project, members: { sharer => [sharer_role] }) }
shared_let(:work_package) { create(:work_package, project:) }
@@ -58,14 +58,14 @@
share_modal.expect_open
end
- context 'without an enterprise token' do
- it 'renders an upsale banner' do
+ context "without an enterprise token" do
+ it "renders an upsale banner" do
share_modal.expect_upsale_banner
end
end
- context 'with an enterprise token', with_ee: %i[work_package_sharing] do
- it 'renders the share modal' do
+ context "with an enterprise token", with_ee: %i[work_package_sharing] do
+ it "renders the share modal" do
share_modal.expect_blankslate
end
end
diff --git a/spec/features/work_packages/share/filter_spec.rb b/spec/features/work_packages/share/filter_spec.rb
index 4dadacce50c2..c6e7e81e6a12 100644
--- a/spec/features/work_packages/share/filter_spec.rb
+++ b/spec/features/work_packages/share/filter_spec.rb
@@ -28,19 +28,19 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package sharing',
+RSpec.describe "Work package sharing",
:js, :with_cuprite,
with_ee: %i[work_package_sharing] do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
shared_let(:comment_work_package_role) { create(:comment_work_package_role) }
shared_let(:edit_work_package_role) { create(:edit_work_package_role) }
- shared_let(:project_user) { create(:user, firstname: 'Anton') }
- shared_let(:project_user2) { create(:user, firstname: 'Bertha') }
- shared_let(:inherited_project_user) { create(:user, firstname: 'Caesar') }
- shared_let(:non_project_user) { create(:user, firstname: 'Dora') }
+ shared_let(:project_user) { create(:user, firstname: "Anton") }
+ shared_let(:project_user2) { create(:user, firstname: "Bertha") }
+ shared_let(:inherited_project_user) { create(:user, firstname: "Caesar") }
+ shared_let(:non_project_user) { create(:user, firstname: "Dora") }
shared_let(:shared_project_group) { create(:group, members: [project_user, inherited_project_user]) }
shared_let(:shared_non_project_group) { create(:group, members: [project_user2, non_project_user]) }
@@ -73,35 +73,35 @@
let(:work_package_page) { Pages::FullWorkPackage.new(work_package) }
let(:share_modal) { Components::WorkPackages::ShareModal.new(work_package) }
- current_user { create(:admin, firstname: 'Signed in', lastname: 'User') }
+ current_user { create(:admin, firstname: "Signed in", lastname: "User") }
- context 'when having share permission' do
+ context "when having share permission" do
before do
work_package_page.visit!
work_package_page.click_share_button
end
- it 'allows to filter for the type' do
+ it "allows to filter for the type" do
share_modal.expect_open
share_modal.expect_shared_count_of(6)
# Filter for: project members (users only)
- share_modal.filter('type', I18n.t('work_package.sharing.filter.project_member'))
+ share_modal.filter("type", I18n.t("work_package.sharing.filter.project_member"))
share_modal.expect_shared_count_of(3)
- share_modal.expect_shared_with(project_user, 'View')
- share_modal.expect_shared_with(project_user2, 'Comment')
+ share_modal.expect_shared_with(project_user, "View")
+ share_modal.expect_shared_with(project_user2, "Comment")
# The non-project user is listed because it is part of the project group and thus the membership is inherited.
- share_modal.expect_shared_with(inherited_project_user, 'Edit')
+ share_modal.expect_shared_with(inherited_project_user, "Edit")
share_modal.expect_not_shared_with(non_project_user)
share_modal.expect_not_shared_with(shared_project_group)
share_modal.expect_not_shared_with(shared_non_project_group)
# Filter for: non-project members (users only)
- share_modal.filter('type', I18n.t('work_package.sharing.filter.not_project_member'))
+ share_modal.filter("type", I18n.t("work_package.sharing.filter.not_project_member"))
share_modal.expect_shared_count_of(1)
- share_modal.expect_shared_with(non_project_user, 'Edit')
+ share_modal.expect_shared_with(non_project_user, "Edit")
share_modal.expect_not_shared_with(inherited_project_user)
share_modal.expect_not_shared_with(project_user)
share_modal.expect_not_shared_with(project_user2)
@@ -109,10 +109,10 @@
share_modal.expect_not_shared_with(shared_non_project_group)
# Filter for: project members (groups only)
- share_modal.filter('type', I18n.t('work_package.sharing.filter.project_group'))
+ share_modal.filter("type", I18n.t("work_package.sharing.filter.project_group"))
share_modal.expect_shared_count_of(1)
- share_modal.expect_shared_with(shared_project_group, 'Edit')
+ share_modal.expect_shared_with(shared_project_group, "Edit")
share_modal.expect_not_shared_with(project_user)
share_modal.expect_not_shared_with(project_user2)
share_modal.expect_not_shared_with(inherited_project_user)
@@ -120,10 +120,10 @@
share_modal.expect_not_shared_with(shared_non_project_group)
# Filter for: non-project members (groups only)
- share_modal.filter('type', I18n.t('work_package.sharing.filter.not_project_group'))
+ share_modal.filter("type", I18n.t("work_package.sharing.filter.not_project_group"))
share_modal.expect_shared_count_of(1)
- share_modal.expect_shared_with(shared_non_project_group, 'View')
+ share_modal.expect_shared_with(shared_non_project_group, "View")
share_modal.expect_not_shared_with(project_user)
share_modal.expect_not_shared_with(project_user2)
share_modal.expect_not_shared_with(inherited_project_user)
@@ -131,48 +131,48 @@
share_modal.expect_not_shared_with(shared_project_group)
# Clicking again on the filter will reset it
- share_modal.filter('type', I18n.t('work_package.sharing.filter.not_project_group'))
+ share_modal.filter("type", I18n.t("work_package.sharing.filter.not_project_group"))
share_modal.expect_shared_count_of(6)
- share_modal.expect_shared_with(project_user, 'View')
- share_modal.expect_shared_with(project_user2, 'Comment')
- share_modal.expect_shared_with(inherited_project_user, 'Edit')
- share_modal.expect_shared_with(non_project_user, 'Edit')
- share_modal.expect_shared_with(shared_project_group, 'Edit')
- share_modal.expect_shared_with(shared_non_project_group, 'View')
+ share_modal.expect_shared_with(project_user, "View")
+ share_modal.expect_shared_with(project_user2, "Comment")
+ share_modal.expect_shared_with(inherited_project_user, "Edit")
+ share_modal.expect_shared_with(non_project_user, "Edit")
+ share_modal.expect_shared_with(shared_project_group, "Edit")
+ share_modal.expect_shared_with(shared_non_project_group, "View")
end
- it 'allows to filter for the role' do
+ it "allows to filter for the role" do
share_modal.expect_open
share_modal.expect_shared_count_of(6)
# Filter for: all principals with Edit permission
- share_modal.filter('role', I18n.t('work_package.sharing.permissions.edit'))
+ share_modal.filter("role", I18n.t("work_package.sharing.permissions.edit"))
share_modal.expect_shared_count_of(3)
- share_modal.expect_shared_with(inherited_project_user, 'Edit')
- share_modal.expect_shared_with(non_project_user, 'Edit')
- share_modal.expect_shared_with(shared_project_group, 'Edit')
+ share_modal.expect_shared_with(inherited_project_user, "Edit")
+ share_modal.expect_shared_with(non_project_user, "Edit")
+ share_modal.expect_shared_with(shared_project_group, "Edit")
share_modal.expect_not_shared_with(project_user)
share_modal.expect_not_shared_with(project_user2)
share_modal.expect_not_shared_with(shared_non_project_group)
# Filter for: all principals with View permission
- share_modal.filter('role', I18n.t('work_package.sharing.permissions.view'))
+ share_modal.filter("role", I18n.t("work_package.sharing.permissions.view"))
share_modal.expect_shared_count_of(2)
- share_modal.expect_shared_with(project_user, 'View')
- share_modal.expect_shared_with(shared_non_project_group, 'View')
+ share_modal.expect_shared_with(project_user, "View")
+ share_modal.expect_shared_with(shared_non_project_group, "View")
share_modal.expect_not_shared_with(project_user2)
share_modal.expect_not_shared_with(inherited_project_user)
share_modal.expect_not_shared_with(non_project_user)
share_modal.expect_not_shared_with(shared_project_group)
# Filter for: all principals with Comment permission
- share_modal.filter('role', I18n.t('work_package.sharing.permissions.comment'))
+ share_modal.filter("role", I18n.t("work_package.sharing.permissions.comment"))
share_modal.expect_shared_count_of(1)
- share_modal.expect_shared_with(project_user2, 'Comment')
+ share_modal.expect_shared_with(project_user2, "Comment")
share_modal.expect_not_shared_with(project_user)
share_modal.expect_not_shared_with(inherited_project_user)
share_modal.expect_not_shared_with(non_project_user)
@@ -180,29 +180,29 @@
share_modal.expect_not_shared_with(shared_non_project_group)
# Clicking again on the filter will reset it
- share_modal.filter('role', I18n.t('work_package.sharing.permissions.comment'))
+ share_modal.filter("role", I18n.t("work_package.sharing.permissions.comment"))
share_modal.expect_shared_count_of(6)
- share_modal.expect_shared_with(project_user, 'View')
- share_modal.expect_shared_with(project_user2, 'Comment')
- share_modal.expect_shared_with(inherited_project_user, 'Edit')
- share_modal.expect_shared_with(non_project_user, 'Edit')
- share_modal.expect_shared_with(shared_project_group, 'Edit')
- share_modal.expect_shared_with(shared_non_project_group, 'View')
+ share_modal.expect_shared_with(project_user, "View")
+ share_modal.expect_shared_with(project_user2, "Comment")
+ share_modal.expect_shared_with(inherited_project_user, "Edit")
+ share_modal.expect_shared_with(non_project_user, "Edit")
+ share_modal.expect_shared_with(shared_project_group, "Edit")
+ share_modal.expect_shared_with(shared_non_project_group, "View")
end
- it 'allows to filter for role and type at the same time' do
+ it "allows to filter for role and type at the same time" do
share_modal.expect_open
share_modal.expect_shared_count_of(6)
# Filter for: all principals with View permission
# role: view
# type: none
- share_modal.filter('role', I18n.t('work_package.sharing.permissions.view'))
+ share_modal.filter("role", I18n.t("work_package.sharing.permissions.view"))
share_modal.expect_shared_count_of(2)
- share_modal.expect_shared_with(project_user, 'View')
- share_modal.expect_shared_with(shared_non_project_group, 'View')
+ share_modal.expect_shared_with(project_user, "View")
+ share_modal.expect_shared_with(shared_non_project_group, "View")
share_modal.expect_not_shared_with(project_user2)
share_modal.expect_not_shared_with(inherited_project_user)
share_modal.expect_not_shared_with(non_project_user)
@@ -211,10 +211,10 @@
# Additional filter for: project members (users only)
# role: view
# type: project members (users only)
- share_modal.filter('type', I18n.t('work_package.sharing.filter.project_member'))
+ share_modal.filter("type", I18n.t("work_package.sharing.filter.project_member"))
share_modal.expect_shared_count_of(1)
- share_modal.expect_shared_with(project_user, 'View')
+ share_modal.expect_shared_with(project_user, "View")
share_modal.expect_not_shared_with(project_user2)
share_modal.expect_not_shared_with(inherited_project_user)
share_modal.expect_not_shared_with(non_project_user)
@@ -224,10 +224,10 @@
# Change type filter to: project members (groups only)
# role: view
# type: non-project members (groups only)
- share_modal.filter('type', I18n.t('work_package.sharing.filter.not_project_group'))
+ share_modal.filter("type", I18n.t("work_package.sharing.filter.not_project_group"))
share_modal.expect_shared_count_of(1)
- share_modal.expect_shared_with(shared_non_project_group, 'View')
+ share_modal.expect_shared_with(shared_non_project_group, "View")
share_modal.expect_not_shared_with(project_user)
share_modal.expect_not_shared_with(project_user2)
share_modal.expect_not_shared_with(inherited_project_user)
@@ -237,10 +237,10 @@
# Reset role filter
# role: none
# type: non-project members (groups only)
- share_modal.filter('role', I18n.t('work_package.sharing.permissions.view'))
+ share_modal.filter("role", I18n.t("work_package.sharing.permissions.view"))
share_modal.expect_shared_count_of(1)
- share_modal.expect_shared_with(shared_non_project_group, 'View')
+ share_modal.expect_shared_with(shared_non_project_group, "View")
share_modal.expect_not_shared_with(project_user)
share_modal.expect_not_shared_with(project_user2)
share_modal.expect_not_shared_with(inherited_project_user)
@@ -250,22 +250,22 @@
# Reset type filter
# role: none
# type: none
- share_modal.filter('type', I18n.t('work_package.sharing.filter.not_project_group'))
+ share_modal.filter("type", I18n.t("work_package.sharing.filter.not_project_group"))
share_modal.expect_shared_count_of(6)
- share_modal.expect_shared_with(project_user, 'View')
- share_modal.expect_shared_with(project_user2, 'Comment')
- share_modal.expect_shared_with(inherited_project_user, 'Edit')
- share_modal.expect_shared_with(non_project_user, 'Edit')
- share_modal.expect_shared_with(shared_project_group, 'Edit')
- share_modal.expect_shared_with(shared_non_project_group, 'View')
+ share_modal.expect_shared_with(project_user, "View")
+ share_modal.expect_shared_with(project_user2, "Comment")
+ share_modal.expect_shared_with(inherited_project_user, "Edit")
+ share_modal.expect_shared_with(non_project_user, "Edit")
+ share_modal.expect_shared_with(shared_project_group, "Edit")
+ share_modal.expect_shared_with(shared_non_project_group, "View")
end
- context 'and there are no matching results for my filter' do
+ context "and there are no matching results for my filter" do
it 'does not check the "toggle all" checkbox' do
share_modal.expect_open
- share_modal.filter('type', I18n.t('work_package.sharing.filter.not_project_member'))
- share_modal.filter('role', I18n.t('work_package.sharing.permissions.view'))
+ share_modal.filter("type", I18n.t("work_package.sharing.filter.not_project_member"))
+ share_modal.filter("role", I18n.t("work_package.sharing.permissions.view"))
share_modal.expect_empty_search_blankslate
share_modal.expect_shared_count_of(0)
@@ -273,14 +273,14 @@
end
end
- it 'only displays shares that match the current set of applied filters' do
+ it "only displays shares that match the current set of applied filters" do
share_modal.expect_open
share_modal.toggle_select_all
share_modal.bulk_update("View")
share_modal.toggle_select_all
- share_modal.filter('role', "View")
+ share_modal.filter("role", "View")
share_modal.expect_shared_with(project_user)
share_modal.expect_shared_with(project_user2)
@@ -290,7 +290,7 @@
share_modal.expect_shared_with(shared_non_project_group)
share_modal.change_role(project_user, "Comment")
- share_modal.filter('role', "Comment")
+ share_modal.filter("role", "Comment")
share_modal.expect_shared_with(project_user, "Comment")
share_modal.expect_not_shared_with(project_user2)
share_modal.expect_not_shared_with(inherited_project_user)
@@ -298,22 +298,22 @@
share_modal.expect_not_shared_with(shared_project_group)
share_modal.expect_not_shared_with(shared_non_project_group)
- share_modal.filter('role', "Edit")
+ share_modal.filter("role", "Edit")
share_modal.expect_empty_search_blankslate
end
- context 'when filtering for a specific role' do
+ context "when filtering for a specific role" do
before do
share_modal.expect_open
- share_modal.filter('role', "View")
+ share_modal.filter("role", "View")
end
- context 'and a share from the filtered list is subsequently updated' do
+ context "and a share from the filtered list is subsequently updated" do
before do
share_modal.change_role(project_user, "Comment")
end
- it 'removes the updated share from the list' do
+ it "removes the updated share from the list" do
share_modal.expect_not_shared_with(project_user)
end
end
diff --git a/spec/features/work_packages/share/multi_invite_spec.rb b/spec/features/work_packages/share/multi_invite_spec.rb
index 588a0cd8a88b..0b6f77f1e687 100644
--- a/spec/features/work_packages/share/multi_invite_spec.rb
+++ b/spec/features/work_packages/share/multi_invite_spec.rb
@@ -28,18 +28,18 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package sharing',
+RSpec.describe "Work package sharing",
:js, :with_cuprite,
with_ee: %i[work_package_sharing] do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
shared_let(:comment_work_package_role) { create(:comment_work_package_role) }
shared_let(:edit_work_package_role) { create(:edit_work_package_role) }
- shared_let(:not_shared_yet_with_user) { create(:user, firstname: 'Not shared Yet', lastname: 'User') }
- shared_let(:another_not_shared_yet_with_user) { create(:user, firstname: 'Another not yet shared', lastname: 'User') }
- shared_let(:richard) { create(:user, firstname: 'Richard', lastname: 'Hendricks') }
+ shared_let(:not_shared_yet_with_user) { create(:user, firstname: "Not shared Yet", lastname: "User") }
+ shared_let(:another_not_shared_yet_with_user) { create(:user, firstname: "Another not yet shared", lastname: "User") }
+ shared_let(:richard) { create(:user, firstname: "Richard", lastname: "Hendricks") }
shared_let(:not_shared_yet_with_group) { create(:group, members: [richard]) }
shared_let(:empty_group) { create(:group, members: []) }
@@ -64,7 +64,7 @@
let(:work_package_page) { Pages::FullWorkPackage.new(work_package) }
let(:share_modal) { Components::WorkPackages::ShareModal.new(work_package) }
- current_user { create(:user, firstname: 'Signed in', lastname: 'User') }
+ current_user { create(:user, firstname: "Signed in", lastname: "User") }
def shared_principals
Principal.where(id: Member.of_work_package(work_package).select(:user_id))
@@ -74,8 +74,8 @@ def inherited_member_roles(group:)
MemberRole.where(inherited_from: MemberRole.where(member_id: group.memberships))
end
- context 'when having share permission' do
- it 'allows seeing and administrating sharing' do
+ context "when having share permission" do
+ it "allows seeing and administrating sharing" do
work_package_page.visit!
# Clicking on the share button opens a modal which lists all of the users a work package
@@ -87,12 +87,12 @@ def inherited_member_roles(group:)
share_modal.expect_shared_count_of(1)
# Inviting multiple users at once
- share_modal.invite_users([not_shared_yet_with_user, another_not_shared_yet_with_user], 'Edit')
+ share_modal.invite_users([not_shared_yet_with_user, another_not_shared_yet_with_user], "Edit")
share_modal.expect_shared_count_of(3)
- share_modal.expect_shared_with(not_shared_yet_with_user, 'Edit', position: 1)
- share_modal.expect_shared_with(another_not_shared_yet_with_user, 'Edit', position: 2)
+ share_modal.expect_shared_with(not_shared_yet_with_user, "Edit", position: 1)
+ share_modal.expect_shared_with(another_not_shared_yet_with_user, "Edit", position: 2)
# They can be removed again
share_modal.remove_user(not_shared_yet_with_user)
@@ -103,12 +103,12 @@ def inherited_member_roles(group:)
share_modal.expect_shared_count_of(1)
# Groups can be added simultaneously as well
- share_modal.invite_users([not_shared_yet_with_group, empty_group], 'Comment')
+ share_modal.invite_users([not_shared_yet_with_group, empty_group], "Comment")
share_modal.expect_shared_count_of(3)
- share_modal.expect_shared_with(not_shared_yet_with_group, 'Comment', position: 1)
- share_modal.expect_shared_with(empty_group, 'Comment', position: 2)
+ share_modal.expect_shared_with(not_shared_yet_with_group, "Comment", position: 1)
+ share_modal.expect_shared_with(empty_group, "Comment", position: 2)
# They can be removed again
share_modal.remove_user(not_shared_yet_with_group)
@@ -118,12 +118,12 @@ def inherited_member_roles(group:)
share_modal.expect_shared_count_of(1)
# We can also mix
- share_modal.invite_users([not_shared_yet_with_user, empty_group], 'View')
+ share_modal.invite_users([not_shared_yet_with_user, empty_group], "View")
share_modal.expect_shared_count_of(3)
- share_modal.expect_shared_with(not_shared_yet_with_user, 'View', position: 1)
- share_modal.expect_shared_with(empty_group, 'View', position: 2)
+ share_modal.expect_shared_with(not_shared_yet_with_user, "View", position: 1)
+ share_modal.expect_shared_with(empty_group, "View", position: 2)
# They can be removed again
share_modal.remove_user(not_shared_yet_with_user)
@@ -138,7 +138,7 @@ def inherited_member_roles(group:)
aggregate_failures "Re-opening the modal after changes performed" do
# This user preserved
- share_modal.expect_shared_with(richard, 'Edit', position: 1)
+ share_modal.expect_shared_with(richard, "Edit", position: 1)
# The users have been removed
share_modal.expect_not_shared_with(not_shared_yet_with_user)
@@ -153,7 +153,7 @@ def inherited_member_roles(group:)
end
end
- context 'when starting with no shares yet' do
+ context "when starting with no shares yet" do
let(:work_package) { create(:work_package, project:) }
let(:global_manager_user) { create(:user, global_permissions: %i[manage_user create_user]) }
let(:current_user) { global_manager_user }
@@ -163,18 +163,18 @@ def inherited_member_roles(group:)
work_package_page.click_share_button
end
- it 'allows adding multiple users and updates the modal correctly' do
+ it "allows adding multiple users and updates the modal correctly" do
share_modal.expect_open
share_modal.expect_blankslate
- share_modal.invite_users([not_shared_yet_with_user, another_not_shared_yet_with_user], 'Edit')
+ share_modal.invite_users([not_shared_yet_with_user, another_not_shared_yet_with_user], "Edit")
share_modal.expect_shared_count_of(2)
# Due to the exception of starting from a blankslate, the whole modal is re-rendered.
# Thus the principals are sorted alphabetically, and not by the time there were added
- share_modal.expect_shared_with(not_shared_yet_with_user, 'Edit', position: 2)
- share_modal.expect_shared_with(another_not_shared_yet_with_user, 'Edit', position: 1)
+ share_modal.expect_shared_with(not_shared_yet_with_user, "Edit", position: 2)
+ share_modal.expect_shared_with(another_not_shared_yet_with_user, "Edit", position: 1)
# They can be removed again
share_modal.remove_user(not_shared_yet_with_user)
@@ -186,11 +186,11 @@ def inherited_member_roles(group:)
end
end
- context 'when having global invite permission' do
+ context "when having global invite permission" do
let(:global_manager_user) { create(:user, global_permissions: %i[manage_user create_user]) }
let(:current_user) { global_manager_user }
- it 'allows creating multiple users at once' do
+ it "allows creating multiple users at once" do
work_package_page.visit!
work_package_page.click_share_button
@@ -198,7 +198,7 @@ def inherited_member_roles(group:)
share_modal.expect_shared_count_of(1)
# Invite two users that does not exist yet
- share_modal.invite_users(['hello@world.de', 'aloha@world.de'], 'Comment')
+ share_modal.invite_users(["hello@world.de", "aloha@world.de"], "Comment")
# New user is shown in the list of shares
share_modal.expect_shared_count_of(3)
@@ -206,20 +206,20 @@ def inherited_member_roles(group:)
# New user is created
new_users = User.last(2)
- share_modal.expect_shared_with(new_users[0], 'Comment', position: 1)
- share_modal.expect_shared_with(new_users[1], 'Comment', position: 2)
+ share_modal.expect_shared_with(new_users[0], "Comment", position: 1)
+ share_modal.expect_shared_with(new_users[1], "Comment", position: 2)
# The new users can be interacted with
- share_modal.change_role(new_users[0], 'View')
- share_modal.expect_shared_with(new_users[0], 'View', position: 1)
- share_modal.change_role(new_users[1], 'View')
- share_modal.expect_shared_with(new_users[1], 'View', position: 2)
+ share_modal.change_role(new_users[0], "View")
+ share_modal.expect_shared_with(new_users[0], "View", position: 1)
+ share_modal.change_role(new_users[1], "View")
+ share_modal.expect_shared_with(new_users[1], "View", position: 2)
share_modal.expect_shared_count_of(3)
# The new users can be updated simultaneously
- share_modal.invite_user(new_users, 'Edit')
- share_modal.expect_shared_with(new_users[0], 'Edit', position: 1)
- share_modal.expect_shared_with(new_users[1], 'Edit', position: 2)
+ share_modal.invite_user(new_users, "Edit")
+ share_modal.expect_shared_with(new_users[0], "Edit", position: 1)
+ share_modal.expect_shared_with(new_users[1], "Edit", position: 2)
share_modal.expect_shared_count_of(3)
# The new users can be deleted
@@ -230,7 +230,7 @@ def inherited_member_roles(group:)
share_modal.expect_shared_count_of(1)
end
- it 'allows sharing with an existing user and creating a new one at the same time' do
+ it "allows sharing with an existing user and creating a new one at the same time" do
work_package_page.visit!
work_package_page.click_share_button
@@ -241,9 +241,9 @@ def inherited_member_roles(group:)
share_modal.select_existing_user not_shared_yet_with_user
share_modal.select_not_existing_user_option "hello@world.de"
- share_modal.select_invite_role('View')
+ share_modal.select_invite_role("View")
within share_modal.modal_element do
- click_button 'Share'
+ click_button "Share"
end
# Two users are added
@@ -252,11 +252,11 @@ def inherited_member_roles(group:)
# New user is created
new_user = User.last
- share_modal.expect_shared_with(not_shared_yet_with_user, 'View', position: 1)
- share_modal.expect_shared_with(new_user, 'View', position: 2)
+ share_modal.expect_shared_with(not_shared_yet_with_user, "View", position: 1)
+ share_modal.expect_shared_with(new_user, "View", position: 2)
end
- context 'and an instance user limit' do
+ context "and an instance user limit" do
before do
allow(OpenProject::Enterprise).to receive_messages(
user_limit: 10,
@@ -264,7 +264,7 @@ def inherited_member_roles(group:)
)
end
- it 'shows a warning as soon as you reach the user limit' do
+ it "shows a warning as soon as you reach the user limit" do
work_package_page.visit!
work_package_page.click_share_button
diff --git a/spec/features/work_packages/share/notification_spec.rb b/spec/features/work_packages/share/notification_spec.rb
index adc4fd1ddfc9..dc5b39342181 100644
--- a/spec/features/work_packages/share/notification_spec.rb
+++ b/spec/features/work_packages/share/notification_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe "Notifications sent on shared work packages",
:js,
@@ -62,7 +62,7 @@
let(:center) { Pages::Notifications::Center.new }
let(:side_menu) { Components::Notifications::Sidemenu.new }
- describe 'notification for being mentioned' do
+ describe "notification for being mentioned" do
before do
# The notifications need to be created as a different user
# as they are otherwise swallowed to avoid self notification.
@@ -76,7 +76,7 @@
end
end
- it 'mentioned user receives a notification' do
+ it "mentioned user receives a notification" do
login_as(recipient)
visit home_path
@@ -88,13 +88,13 @@
center.expect_work_package_item notification_mentioned
- side_menu.click_item 'Mentioned'
+ side_menu.click_item "Mentioned"
side_menu.finished_loading
center.expect_work_package_item notification_mentioned
end
end
- describe 'notification for being shared with' do
+ describe "notification for being shared with" do
before do
# The notifications need to be created as a different user
# as they are otherwise swallowed to avoid self notification.
@@ -108,7 +108,7 @@
end
end
- it 'shared with user receives notification' do
+ it "shared with user receives notification" do
login_as(recipient)
visit home_path
@@ -120,7 +120,7 @@
center.expect_work_package_item notification_shared
- side_menu.click_item 'Shared'
+ side_menu.click_item "Shared"
side_menu.finished_loading
center.expect_work_package_item notification_shared
end
diff --git a/spec/features/work_packages/share/share_account_activation_spec.rb b/spec/features/work_packages/share/share_account_activation_spec.rb
index 16f53666892e..abbadf5e2041 100644
--- a/spec/features/work_packages/share/share_account_activation_spec.rb
+++ b/spec/features/work_packages/share/share_account_activation_spec.rb
@@ -28,13 +28,13 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package sharing invited users',
+RSpec.describe "Work package sharing invited users",
:js, :with_cuprite,
with_ee: %i[work_package_sharing] do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
- shared_let(:editor) { create(:admin, firstname: 'Mr.', lastname: 'Sharer') }
+ shared_let(:editor) { create(:admin, firstname: "Mr.", lastname: "Sharer") }
shared_let(:sharer_role) do
create(:project_role,
@@ -54,16 +54,16 @@
let(:work_package_page) { Pages::FullWorkPackage.new(work_package) }
let(:share_modal) { Components::WorkPackages::ShareModal.new(work_package) }
- it 'allows to invite and activate the account' do
- login_with(editor.login, 'adminADMIN!')
- expect(page).to have_current_path '/my/page'
+ it "allows to invite and activate the account" do
+ login_with(editor.login, "adminADMIN!")
+ expect(page).to have_current_path "/my/page"
work_package_page.visit!
work_package_page.click_share_button
share_modal.expect_open
# Invite a user that does not exist yet
- share_modal.invite_user('foobar@example.com', 'View')
+ share_modal.invite_user("foobar@example.com", "View")
# New user is shown in the list of shares
share_modal.expect_shared_count_of(1)
@@ -76,23 +76,23 @@
user = token.user
expect(token).to be_present
expect(user).to be_invited
- expect(user.mail).to eq 'foobar@example.com'
+ expect(user.mail).to eq "foobar@example.com"
expect(link).to include token.value
# Can log in and register the first time
visit signout_path
visit link
- expect(page).to have_text 'Create a new account'
+ expect(page).to have_text "Create a new account"
password = SecureRandom.hex(16)
- fill_in 'Password', with: password
- fill_in 'Confirmation', with: password
+ fill_in "Password", with: password
+ fill_in "Confirmation", with: password
- click_button 'Create'
+ click_button "Create"
- expect(page).to have_text 'Welcome, your account has been activated. You are logged in now.'
- expect(page).to have_current_path project_work_package_path(project, work_package.id, 'activity')
+ expect(page).to have_text "Welcome, your account has been activated. You are logged in now."
+ expect(page).to have_current_path project_work_package_path(project, work_package.id, "activity")
expect(page).to have_text work_package.subject
expect(user.reload).to be_active
@@ -101,10 +101,10 @@
visit signout_path
visit link
- expect(page).to have_text 'Sign in'
- login_with 'foobar@example.com', password, visit_signin_path: false
+ expect(page).to have_text "Sign in"
+ login_with "foobar@example.com", password, visit_signin_path: false
- expect(page).to have_current_path project_work_package_path(project, work_package.id, 'activity')
+ expect(page).to have_current_path project_work_package_path(project, work_package.id, "activity")
expect(page).to have_text work_package.subject
end
end
diff --git a/spec/features/work_packages/share/share_spec.rb b/spec/features/work_packages/share/share_spec.rb
index 68e6797c63d5..33d4fbc47b7b 100644
--- a/spec/features/work_packages/share/share_spec.rb
+++ b/spec/features/work_packages/share/share_spec.rb
@@ -28,25 +28,25 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package sharing',
+RSpec.describe "Work package sharing",
:js, :with_cuprite,
with_ee: %i[work_package_sharing] do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
shared_let(:comment_work_package_role) { create(:comment_work_package_role) }
shared_let(:edit_work_package_role) { create(:edit_work_package_role) }
- shared_let(:view_user) { create(:user, firstname: 'View', lastname: 'User') }
- shared_let(:comment_user) { create(:user, firstname: 'Comment', lastname: 'User') }
- shared_let(:edit_user) { create(:user, firstname: 'Edit', lastname: 'User') }
- shared_let(:non_shared_project_user) { create(:user, firstname: 'Non Shared Project', lastname: 'User') }
- shared_let(:shared_project_user) { create(:user, firstname: 'Shared Project', lastname: 'User') }
- shared_let(:not_shared_yet_with_user) { create(:user, firstname: 'Not shared Yet', lastname: 'User') }
+ shared_let(:view_user) { create(:user, firstname: "View", lastname: "User") }
+ shared_let(:comment_user) { create(:user, firstname: "Comment", lastname: "User") }
+ shared_let(:edit_user) { create(:user, firstname: "Edit", lastname: "User") }
+ shared_let(:non_shared_project_user) { create(:user, firstname: "Non Shared Project", lastname: "User") }
+ shared_let(:shared_project_user) { create(:user, firstname: "Shared Project", lastname: "User") }
+ shared_let(:not_shared_yet_with_user) { create(:user, firstname: "Not shared Yet", lastname: "User") }
- shared_let(:richard) { create(:user, firstname: 'Richard', lastname: 'Hendricks') }
- shared_let(:dinesh) { create(:user, firstname: 'Dinesh', lastname: 'Chugtai') }
- shared_let(:gilfoyle) { create(:user, firstname: 'Bertram', lastname: 'Gilfoyle') }
+ shared_let(:richard) { create(:user, firstname: "Richard", lastname: "Hendricks") }
+ shared_let(:dinesh) { create(:user, firstname: "Dinesh", lastname: "Chugtai") }
+ shared_let(:gilfoyle) { create(:user, firstname: "Bertram", lastname: "Gilfoyle") }
shared_let(:not_shared_yet_with_group) { create(:group, members: [richard, dinesh, gilfoyle]) }
let(:project) do
@@ -81,7 +81,7 @@
let(:columns) { Components::WorkPackages::Columns.new }
let(:wp_modal) { Components::WorkPackages::TableConfigurationModal.new }
- current_user { create(:user, firstname: 'Signed in', lastname: 'User') }
+ current_user { create(:user, firstname: "Signed in", lastname: "User") }
def shared_principals
Principal.where(id: Member.of_work_package(work_package).select(:user_id))
@@ -91,8 +91,8 @@ def inherited_member_roles(group:)
MemberRole.where(inherited_from: MemberRole.where(member_id: group.memberships))
end
- context 'when having share permission' do
- it 'allows seeing and administrating sharing' do
+ context "when having share permission" do
+ it "allows seeing and administrating sharing" do
work_package_page.visit!
# Clicking on the share button opens a modal which lists all of the users a work package
@@ -102,14 +102,14 @@ def inherited_member_roles(group:)
work_package_page.click_share_button
aggregate_failures "Initial shares list" do
- share_modal.expect_title(I18n.t('js.work_packages.sharing.title'))
- share_modal.expect_shared_with(comment_user, 'Comment', position: 1)
- share_modal.expect_shared_with(dinesh, 'Edit', position: 2)
- share_modal.expect_shared_with(edit_user, 'Edit', position: 3)
- share_modal.expect_shared_with(shared_project_user, 'Edit', position: 4)
+ share_modal.expect_title(I18n.t("js.work_packages.sharing.title"))
+ share_modal.expect_shared_with(comment_user, "Comment", position: 1)
+ share_modal.expect_shared_with(dinesh, "Edit", position: 2)
+ share_modal.expect_shared_with(edit_user, "Edit", position: 3)
+ share_modal.expect_shared_with(shared_project_user, "Edit", position: 4)
# The current users share is also displayed but not editable
share_modal.expect_shared_with(current_user, position: 5, editable: false)
- share_modal.expect_shared_with(view_user, 'View', position: 6)
+ share_modal.expect_shared_with(view_user, "View", position: 6)
share_modal.expect_not_shared_with(non_shared_project_user)
share_modal.expect_not_shared_with(not_shared_yet_with_user)
@@ -119,9 +119,9 @@ def inherited_member_roles(group:)
aggregate_failures "Inviting a user for the first time" do
# Inviting a user will lead to that user being prepended to the list together with the rest of the shared with users.
- share_modal.invite_user(not_shared_yet_with_user, 'View')
+ share_modal.invite_user(not_shared_yet_with_user, "View")
- share_modal.expect_shared_with(not_shared_yet_with_user, 'View', position: 1)
+ share_modal.expect_shared_with(not_shared_yet_with_user, "View", position: 1)
share_modal.expect_shared_count_of(7)
end
@@ -134,8 +134,8 @@ def inherited_member_roles(group:)
aggregate_failures "Re-inviting a user" do
# Adding a user multiple times will lead to the user's role being updated.
- share_modal.invite_user(not_shared_yet_with_user, 'Edit')
- share_modal.expect_shared_with(not_shared_yet_with_user, 'Edit', position: 1)
+ share_modal.invite_user(not_shared_yet_with_user, "Edit")
+ share_modal.expect_shared_with(not_shared_yet_with_user, "Edit", position: 1)
share_modal.expect_shared_count_of(6)
# Sent out email only on first share and not again when updating.
@@ -145,8 +145,8 @@ def inherited_member_roles(group:)
aggregate_failures "Updating a share" do
# Updating the share
- share_modal.change_role(not_shared_yet_with_user, 'Comment')
- share_modal.expect_shared_with(not_shared_yet_with_user, 'Comment', position: 1)
+ share_modal.change_role(not_shared_yet_with_user, "Comment")
+ share_modal.expect_shared_with(not_shared_yet_with_user, "Comment", position: 1)
share_modal.expect_shared_count_of(6)
# Sent out email only on first share and not again when updating so the
@@ -158,11 +158,11 @@ def inherited_member_roles(group:)
aggregate_failures "Inviting a group" do
# Inviting a group propagates the membership to the group's users. However, these propagated
# memberships are not expected to be visible.
- share_modal.invite_group(not_shared_yet_with_group, 'View')
- share_modal.expect_shared_with(not_shared_yet_with_group, 'View', position: 1)
+ share_modal.invite_group(not_shared_yet_with_group, "View")
+ share_modal.expect_shared_with(not_shared_yet_with_group, "View", position: 1)
# This user has a share independent of the group's share. Hence, that Role prevails
- share_modal.expect_shared_with(dinesh, 'Edit')
+ share_modal.expect_shared_with(dinesh, "Edit")
share_modal.expect_not_shared_with(richard)
share_modal.expect_not_shared_with(gilfoyle)
@@ -183,8 +183,8 @@ def inherited_member_roles(group:)
aggregate_failures "Inviting a group member with its own independent role" do
# Inviting a group user to a Work Package independently of the the group displays
# said user in the shares list
- share_modal.invite_user(gilfoyle, 'Comment')
- share_modal.expect_shared_with(gilfoyle, 'Comment', position: 1)
+ share_modal.invite_user(gilfoyle, "Comment")
+ share_modal.expect_shared_with(gilfoyle, "Comment", position: 1)
share_modal.expect_shared_count_of(8)
perform_enqueued_jobs
@@ -196,10 +196,10 @@ def inherited_member_roles(group:)
aggregate_failures "Updating a group's share" do
# Updating a group's share role also propagates to the inherited member roles of
# its users
- share_modal.change_role(not_shared_yet_with_group, 'Comment')
+ share_modal.change_role(not_shared_yet_with_group, "Comment")
wait_for_network_idle
- share_modal.expect_shared_with(not_shared_yet_with_group, 'Comment')
+ share_modal.expect_shared_with(not_shared_yet_with_group, "Comment")
share_modal.expect_shared_count_of(8)
expect(inherited_member_roles(group: not_shared_yet_with_group))
.to all(have_attributes(role: comment_work_package_role))
@@ -217,8 +217,8 @@ def inherited_member_roles(group:)
share_modal.expect_not_shared_with(not_shared_yet_with_group)
share_modal.expect_not_shared_with(richard)
- share_modal.expect_shared_with(dinesh, 'Edit')
- share_modal.expect_shared_with(gilfoyle, 'Comment')
+ share_modal.expect_shared_with(dinesh, "Edit")
+ share_modal.expect_shared_with(gilfoyle, "Comment")
share_modal.expect_shared_count_of(7)
expect(inherited_member_roles(group: not_shared_yet_with_group))
.to be_empty
@@ -235,16 +235,16 @@ def inherited_member_roles(group:)
aggregate_failures "Re-opening the modal after changes performed" do
# This user preserved its group independent share
- share_modal.expect_shared_with(gilfoyle, 'Comment', position: 1)
- share_modal.expect_shared_with(comment_user, 'Comment', position: 2)
+ share_modal.expect_shared_with(gilfoyle, "Comment", position: 1)
+ share_modal.expect_shared_with(comment_user, "Comment", position: 2)
# This user preserved its group independent share
- share_modal.expect_shared_with(dinesh, 'Edit', position: 3)
+ share_modal.expect_shared_with(dinesh, "Edit", position: 3)
# This user's role was updated
- share_modal.expect_shared_with(not_shared_yet_with_user, 'Comment', position: 4)
+ share_modal.expect_shared_with(not_shared_yet_with_user, "Comment", position: 4)
# These users were not changed
- share_modal.expect_shared_with(shared_project_user, 'Edit', position: 5)
+ share_modal.expect_shared_with(shared_project_user, "Edit", position: 5)
share_modal.expect_shared_with(current_user, position: 6, editable: false)
- share_modal.expect_shared_with(view_user, 'View', position: 7)
+ share_modal.expect_shared_with(view_user, "View", position: 7)
# This group's share was revoked
share_modal.expect_not_shared_with(not_shared_yet_with_group)
@@ -260,54 +260,54 @@ def inherited_member_roles(group:)
visit project_members_path(project)
- aggregate_failures 'Observing the shared members with view permission' do
- members_page.click_menu_item 'View'
+ aggregate_failures "Observing the shared members with view permission" do
+ members_page.click_menu_item "View"
expect(members_page).to have_user view_user.name
members_page.in_user_row(view_user) do
- expect(page).to have_text '1 work package'
+ expect(page).to have_text "1 work package"
end
expect(members_page).not_to have_user gilfoyle.name
expect(members_page).not_to have_user comment_user.name
expect(members_page).not_to have_user dinesh.name
end
- aggregate_failures 'Observing the shared members with comment permission' do
- members_page.click_menu_item 'Comment'
+ aggregate_failures "Observing the shared members with comment permission" do
+ members_page.click_menu_item "Comment"
expect(members_page).to have_user gilfoyle.name
members_page.in_user_row(gilfoyle) do
- expect(page).to have_text '1 work package'
+ expect(page).to have_text "1 work package"
end
expect(members_page).to have_user comment_user.name
expect(members_page).not_to have_user view_user.name
expect(members_page).not_to have_user dinesh.name
end
- aggregate_failures 'Observing the shared members with edit permission' do
- members_page.click_menu_item 'Edit'
+ aggregate_failures "Observing the shared members with edit permission" do
+ members_page.click_menu_item "Edit"
expect(members_page).to have_user dinesh.name
expect(members_page).not_to have_user gilfoyle.name
expect(members_page).not_to have_user comment_user.name
expect(members_page).not_to have_user view_user.name
end
- aggregate_failures 'Showing the shared users in the table' do
+ aggregate_failures "Showing the shared users in the table" do
wp_table.visit!
wp_modal.open!
- wp_modal.switch_to 'Columns'
+ wp_modal.switch_to "Columns"
columns.assume_opened
columns.uncheck_all save_changes: false
- columns.add 'ID', save_changes: false
- columns.add 'Subject', save_changes: false
- columns.add 'Shared with', save_changes: false
+ columns.add "ID", save_changes: false
+ columns.add "Subject", save_changes: false
+ columns.add "Shared with", save_changes: false
columns.apply
wp_row = wp_table.row(work_package)
- expect(wp_row).to have_css('.wp-table--cell-td.sharedWithUsers .badge', text: '7')
- wp_row.find('.wp-table--cell-td.sharedWithUsers .badge').click
+ expect(wp_row).to have_css(".wp-table--cell-td.sharedWithUsers .badge", text: "7")
+ wp_row.find(".wp-table--cell-td.sharedWithUsers .badge").click
- share_modal.expect_title(I18n.t('js.work_packages.sharing.title'))
+ share_modal.expect_title(I18n.t("js.work_packages.sharing.title"))
share_modal.expect_shared_count_of(7)
end
end
@@ -320,20 +320,20 @@ def inherited_member_roles(group:)
share_modal.click_share
share_modal.expect_select_a_user_hint
- share_modal.invite_user(not_shared_yet_with_user, 'View')
+ share_modal.invite_user(not_shared_yet_with_user, "View")
share_modal.expect_shared_with(not_shared_yet_with_user, position: 1)
share_modal.expect_no_select_a_user_hint
end
end
- context 'when lacking share permission but having the viewing permission' do
+ context "when lacking share permission but having the viewing permission" do
let(:sharer_role) do
create(:project_role,
permissions: %i(view_work_packages
view_shared_work_packages))
end
- it 'allows seeing shares but not editing' do
+ it "allows seeing shares but not editing" do
work_package_page.visit!
# Clicking on the share button opens a modal which lists all of the users a work package
@@ -383,42 +383,42 @@ def inherited_member_roles(group:)
it_behaves_like "'Share' button is not rendered"
end
- context 'when having global invite permission' do
+ context "when having global invite permission" do
let(:global_manager_user) { create(:user, global_permissions: %i[manage_user create_user]) }
let(:current_user) { global_manager_user }
- let(:locked_user) { create(:user, mail: 'holly@openproject.com', status: :locked) }
+ let(:locked_user) { create(:user, mail: "holly@openproject.com", status: :locked) }
before do
work_package_page.visit!
work_package_page.click_share_button
end
- it 'allows inviting and directly sharing with a user who is not part of the instance yet' do
+ it "allows inviting and directly sharing with a user who is not part of the instance yet" do
share_modal.expect_open
share_modal.expect_shared_count_of(6)
# Invite a user that does not exist yet
- share_modal.invite_user('hello@world.de', 'View')
+ share_modal.invite_user("hello@world.de", "View")
# New user is shown in the list of shares
share_modal.expect_shared_count_of(7)
# New user is created
new_user = User.last
- share_modal.expect_shared_with(new_user, 'View', position: 1)
+ share_modal.expect_shared_with(new_user, "View", position: 1)
perform_enqueued_jobs
# Only one combined email for create and share should be send out
expect(ActionMailer::Base.deliveries.size).to eq(1)
# The new user can be interacted with
- share_modal.change_role(new_user, 'Comment')
- share_modal.expect_shared_with(new_user, 'Comment', position: 1)
+ share_modal.change_role(new_user, "Comment")
+ share_modal.expect_shared_with(new_user, "Comment", position: 1)
share_modal.expect_shared_count_of(7)
# The new user can be updated
- share_modal.invite_user(new_user, 'Edit')
- share_modal.expect_shared_with(new_user, 'Edit', position: 1)
+ share_modal.invite_user(new_user, "Edit")
+ share_modal.expect_shared_with(new_user, "Edit", position: 1)
share_modal.expect_shared_count_of(7)
# The invite can be resent
@@ -434,7 +434,7 @@ def inherited_member_roles(group:)
share_modal.expect_shared_count_of(6)
end
- it 'shows an error message when inviting an existing locked user' do
+ it "shows an error message when inviting an existing locked user" do
share_modal.expect_open
share_modal.expect_shared_count_of(6)
@@ -446,7 +446,7 @@ def inherited_member_roles(group:)
share_modal.expect_no_ng_option("", locked_user.name, results_selector: "body")
# Invite the email address
- share_modal.invite_user(locked_user.mail, 'View')
+ share_modal.invite_user(locked_user.mail, "View")
# The number of shared people has not changed, but an error message is shown
share_modal.expect_shared_count_of(6)
@@ -454,8 +454,8 @@ def inherited_member_roles(group:)
end
end
- context 'when lacking global invite permission' do
- it 'does not allow creating a user who is not part of the instance yet' do
+ context "when lacking global invite permission" do
+ it "does not allow creating a user who is not part of the instance yet" do
work_package_page.visit!
work_package_page.click_share_button
@@ -463,7 +463,7 @@ def inherited_member_roles(group:)
share_modal.expect_shared_count_of(6)
# Search for a user that does not exist
- share_modal.search_user('hello@world.de')
+ share_modal.search_user("hello@world.de")
# There is no option to directly create and share the WP for the unknown email address
share_modal.expect_no_ng_option("", 'Send invite to"hello@world.de"', results_selector: "body")
diff --git a/spec/features/work_packages/shared_contexts.rb b/spec/features/work_packages/shared_contexts.rb
index d9e8a4bb2db1..6ebb643a2552 100644
--- a/spec/features/work_packages/shared_contexts.rb
+++ b/spec/features/work_packages/shared_contexts.rb
@@ -28,7 +28,7 @@
# Ensure the page is completely loaded before the spec is run.
# The status filter is loaded very late in the page setup.
-RSpec.shared_context 'ensure wp details pane update done' do
+RSpec.shared_context "ensure wp details pane update done" do
after do
unless update_user
raise "Expect to have a let called 'update_user' defining which user \
@@ -37,7 +37,7 @@
# safeguard to ensure all backend queries
# have been answered before starting a new spec
- expect(page).to have_css('.op-user-activity--user-name',
+ expect(page).to have_css(".op-user-activity--user-name",
text: update_user.name)
end
end
diff --git a/spec/features/work_packages/sorting/manual_sorting_spec.rb b/spec/features/work_packages/sorting/manual_sorting_spec.rb
index 385c9c17d6dd..e871dddf1126 100644
--- a/spec/features/work_packages/sorting/manual_sorting_spec.rb
+++ b/spec/features/work_packages/sorting/manual_sorting_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'Manual sorting of WP table', :js do
+RSpec.describe "Manual sorting of WP table", :js do
let(:user) { create(:admin) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -37,11 +37,11 @@
let(:type_bug) { create(:type_bug) }
let(:project) { create(:project, types: [type_task, type_bug], enabled_module_names: %i[work_package_tracking gantt]) }
let(:work_package1) do
- create(:work_package, subject: 'WP1', project:, type: type_task, created_at: Time.zone.now)
+ create(:work_package, subject: "WP1", project:, type: type_task, created_at: Time.zone.now)
end
let(:work_package2) do
create(:work_package,
- subject: 'WP2',
+ subject: "WP2",
project:,
parent: work_package1,
type: type_task,
@@ -49,7 +49,7 @@
end
let(:work_package3) do
create(:work_package,
- subject: 'WP3',
+ subject: "WP3",
project:,
parent: work_package2,
type: type_bug,
@@ -57,7 +57,7 @@
end
let(:work_package4) do
create(:work_package,
- subject: 'WP4',
+ subject: "WP4",
project:,
parent: work_package3,
type: type_bug,
@@ -89,7 +89,7 @@ def expect_query_order(query, expected)
work_package4
end
- describe 'hierarchy mode' do
+ describe "hierarchy mode" do
before do
wp_table.visit!
@@ -99,18 +99,18 @@ def expect_query_order(query, expected)
hierarchies.expect_leaf_at(work_package4)
end
- it 'maintains the order and automatically saves the query' do
+ it "maintains the order and automatically saves the query" do
wp_table.drag_and_drop_work_package from: 3, to: 1
loading_indicator_saveguard
hierarchies.expect_hierarchy_at(work_package1, work_package2)
hierarchies.expect_leaf_at(work_package4, work_package3)
- wp_table.expect_and_dismiss_toaster message: 'Successful creation.'
+ wp_table.expect_and_dismiss_toaster message: "Successful creation."
query = nil
retry_block do
query = Query.last
- raise "Query was not yet saved." unless query.name == 'New manually sorted query'
+ raise "Query was not yet saved." unless query.name == "New manually sorted query"
end
# Expect sorted 1 and 2, the rest is not positioned
@@ -121,7 +121,7 @@ def expect_query_order(query, expected)
pagination.expect_no_per_page_options
end
- it 'can drag an element into a hierarchy' do
+ it "can drag an element into a hierarchy" do
# Move up the hierarchy
wp_table.drag_and_drop_work_package from: 3, to: 1
loading_indicator_saveguard
@@ -134,7 +134,7 @@ def expect_query_order(query, expected)
hierarchies.expect_leaf_at(work_package3, work_package4)
end
- it 'can drag an element completely out of the hierarchy' do
+ it "can drag an element completely out of the hierarchy" do
# Move up the hierarchy
wp_table.drag_and_drop_work_package from: 3, to: 0
loading_indicator_saveguard
@@ -153,12 +153,12 @@ def expect_query_order(query, expected)
wp_page.expect_no_parent
end
- context 'when dragging an element partly out of the hierarchy' do
+ context "when dragging an element partly out of the hierarchy" do
let(:work_package5) do
- create(:work_package, subject: 'WP5', project:, parent: work_package1)
+ create(:work_package, subject: "WP5", project:, parent: work_package1)
end
let(:work_package6) do
- create(:work_package, subject: 'WP6', project:, parent: work_package1)
+ create(:work_package, subject: "WP6", project:, parent: work_package1)
end
before do
@@ -179,7 +179,7 @@ def expect_query_order(query, expected)
hierarchies.expect_leaf_at(work_package3, work_package4, work_package5, work_package6)
end
- it 'move below a sibling of my parent' do
+ it "move below a sibling of my parent" do
wp_table.drag_and_drop_work_package from: 3, to: 5
loading_indicator_saveguard
@@ -195,46 +195,46 @@ def expect_query_order(query, expected)
end
end
- describe 'group mode' do
- describe 'group by type' do
+ describe "group mode" do
+ describe "group by type" do
let(:group_by) { Components::WorkPackages::GroupBy.new }
before do
wp_table.visit!
- group_by.enable_via_menu 'Type'
+ group_by.enable_via_menu "Type"
- wp_table.save_as 'Type query'
- wp_table.expect_and_dismiss_toaster message: 'Successful creation.'
+ wp_table.save_as "Type query"
+ wp_table.expect_and_dismiss_toaster message: "Successful creation."
end
- it 'updates the work packages appropriately' do
- expect(page).to have_css('.group--value', text: 'Task (2)')
- expect(page).to have_css('.group--value', text: 'Bug (2)')
+ it "updates the work packages appropriately" do
+ expect(page).to have_css(".group--value", text: "Task (2)")
+ expect(page).to have_css(".group--value", text: "Bug (2)")
wp_table.drag_and_drop_work_package from: 0, to: 3
- expect(page).to have_css('.group--value', text: 'Task (1)')
- expect(page).to have_css('.group--value', text: 'Bug (3)')
+ expect(page).to have_css(".group--value", text: "Task (1)")
+ expect(page).to have_css(".group--value", text: "Bug (3)")
end
- it 'dragging item with parent does not result in an error (Regression #30832)' do
- expect(page).to have_css('.group--value', text: 'Task (2)')
- expect(page).to have_css('.group--value', text: 'Bug (2)')
+ it "dragging item with parent does not result in an error (Regression #30832)" do
+ expect(page).to have_css(".group--value", text: "Task (2)")
+ expect(page).to have_css(".group--value", text: "Bug (2)")
wp_table.drag_and_drop_work_package from: 1, to: 3
- expect(page).to have_css('.group--value', text: 'Task (1)')
- expect(page).to have_css('.group--value', text: 'Bug (3)')
+ expect(page).to have_css(".group--value", text: "Task (1)")
+ expect(page).to have_css(".group--value", text: "Bug (3)")
- expect(page).to have_no_css '.op-toast.error'
+ expect(page).to have_no_css ".op-toast.error"
end
end
end
- describe 'with a saved query and positions increasing from zero' do
+ describe "with a saved query and positions increasing from zero" do
let(:query) do
create(:query, user:, project:, show_hierarchies: false).tap do |q|
- q.sort_criteria = [[:manual_sorting, 'asc']]
+ q.sort_criteria = [[:manual_sorting, "asc"]]
q.save!
end
end
@@ -248,7 +248,7 @@ def expect_query_order(query, expected)
OrderedWorkPackage.create(query:, work_package: work_package4, position: 3)
end
- it 'can inline create a work package and it is positioned to the bottom (Regression #31078)' do
+ it "can inline create a work package and it is positioned to the bottom (Regression #31078)" do
wp_table.visit_query query
wp_table.expect_work_package_order work_package1, work_package2, work_package3, work_package4
@@ -257,17 +257,17 @@ def expect_query_order(query, expected)
subject_field.expect_active!
# Save the WP
- subject_field.set_value 'Foobar!'
+ subject_field.set_value "Foobar!"
subject_field.submit_by_enter
wp_table.expect_and_dismiss_toaster(
- message: 'Successful creation. Click here to open this work package in fullscreen view.'
+ message: "Successful creation. Click here to open this work package in fullscreen view."
)
- wp_table.expect_work_package_subject 'Foobar!'
+ wp_table.expect_work_package_subject "Foobar!"
inline_created = WorkPackage.last
- expect(inline_created.subject).to eq 'Foobar!'
+ expect(inline_created.subject).to eq "Foobar!"
# Wait until the order was saved, this might take a few moments
retry_block do
@@ -288,15 +288,15 @@ def expect_query_order(query, expected)
end
end
- describe 'with a saved query that is NOT manually sorted' do
+ describe "with a saved query that is NOT manually sorted" do
let(:query) do
create(:query, user:, project:, show_hierarchies: false).tap do |q|
- q.sort_criteria = [[:id, 'asc']]
+ q.sort_criteria = [[:id, "asc"]]
q.save!
end
end
- it 'can drag and drop and will save the query' do
+ it "can drag and drop and will save the query" do
wp_table.visit_query query
wp_table.expect_work_package_order work_package1, work_package2, work_package3, work_package4
@@ -304,12 +304,12 @@ def expect_query_order(query, expected)
wp_table.expect_work_package_order work_package1, work_package3, work_package2, work_package4
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
retry_block do
query.reload
- if query.sort_criteria != [['manual_sorting', 'asc']]
+ if query.sort_criteria != [["manual_sorting", "asc"]]
raise "Expected sort_criteria to be updated to manual_sorting, was #{query.sort_criteria.inspect}"
end
end
@@ -319,22 +319,22 @@ def expect_query_order(query, expected)
end
end
- describe 'flat mode' do
+ describe "flat mode" do
before do
wp_table.visit!
hierarchies.disable_via_header
wp_table.expect_work_package_order work_package1, work_package2, work_package3, work_package4
end
- it 'can sort table rows via DragNDrop' do
+ it "can sort table rows via DragNDrop" do
wp_table.drag_and_drop_work_package from: 1, to: 3
wp_table.expect_work_package_order work_package1, work_package3, work_package2, work_package4
- wp_table.expect_and_dismiss_toaster message: 'Successful creation.'
+ wp_table.expect_and_dismiss_toaster message: "Successful creation."
query = Query.last
- expect(query.name).to eq 'New manually sorted query'
+ expect(query.name).to eq "New manually sorted query"
expect_query_order(query, [work_package1.id, work_package3.id, work_package2.id])
@@ -343,11 +343,11 @@ def expect_query_order(query, expected)
expect_query_order(query, [work_package3.id, work_package1.id, work_package2.id])
end
- it 'saves the changed order in a previously saved query' do
- wp_table.save_as 'Manual sorted query'
+ it "saves the changed order in a previously saved query" do
+ wp_table.save_as "Manual sorted query"
sort_by.open_modal
- sort_by.update_sorting_mode 'manual'
+ sort_by.update_sorting_mode "manual"
sort_by.apply_changes
wp_table.drag_and_drop_work_package from: 1, to: 3
@@ -355,34 +355,34 @@ def expect_query_order(query, expected)
wp_table.expect_work_package_order work_package1, work_package3, work_package2, work_package4
query = Query.last
- expect(query.name).to eq 'Manual sorted query'
+ expect(query.name).to eq "Manual sorted query"
expect_query_order(query, [work_package1.id, work_package3.id, work_package2.id])
pagination.expect_range(1, 4, 4)
pagination.expect_no_per_page_options
end
- it 'does not loose the current order when switching to manual sorting' do
+ it "does not loose the current order when switching to manual sorting" do
# Sort by creation date
- sort_by.update_criteria 'Created on'
+ sort_by.update_criteria "Created on"
wp_table.expect_work_package_order work_package4, work_package3, work_package2, work_package1
# Enable manual sorting
sort_by.open_modal
- sort_by.update_sorting_mode 'manual'
+ sort_by.update_sorting_mode "manual"
sort_by.apply_changes
# Expect same order
wp_table.expect_work_package_order work_package4, work_package3, work_package2, work_package1
end
- it 'shows a warning when switching from manual to automatic sorting' do
+ it "shows a warning when switching from manual to automatic sorting" do
wp_table.drag_and_drop_work_package from: 1, to: 3
wp_table.expect_work_package_order work_package1, work_package3, work_package2, work_package4
# Try to sort by creation date
- sort_by.sort_via_header 'Subject'
+ sort_by.sort_via_header "Subject"
# Shows a warning
dialog.expect_open
@@ -390,20 +390,20 @@ def expect_query_order(query, expected)
wp_table.expect_work_package_order work_package1, work_package2, work_package3, work_package4
end
- context 'when view is gantt chart' do
+ context "when view is gantt chart" do
let(:wp_timeline) { Pages::WorkPackagesTimeline.new(project) }
let!(:query_tl) do
query = build(:query_with_view_gantt, user:, project:)
query.filters.clear
query.timeline_visible = true
- query.name = 'Query with Timeline'
+ query.name = "Query with Timeline"
query.save!
query
end
- it 'reloads after drop' do
+ it "reloads after drop" do
wp_timeline.visit_query(query_tl)
wp_timeline.expect_timeline!
wp_timeline.expect_row_count(4)
diff --git a/spec/features/work_packages/sorting/table_sorting_spec.rb b/spec/features/work_packages/sorting/table_sorting_spec.rb
index 231ae2130966..811c44c784cb 100644
--- a/spec/features/work_packages/sorting/table_sorting_spec.rb
+++ b/spec/features/work_packages/sorting/table_sorting_spec.rb
@@ -26,16 +26,16 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'Select work package row', :js do
+RSpec.describe "Select work package row", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_packages_page) { WorkPackagesPage.new(project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
- describe 'sorting by version' do
+ describe "sorting by version" do
let(:work_package_1) do
create(:work_package, project:)
end
@@ -45,11 +45,11 @@
let(:version_1) do
create(:version, project:,
- name: 'aaa_version')
+ name: "aaa_version")
end
let(:version_2) do
create(:version, project:,
- name: 'zzz_version')
+ name: "zzz_version")
end
let(:columns) { Components::WorkPackages::Columns.new }
let(:sort_by) { Components::WorkPackages::SortBy.new }
@@ -63,23 +63,23 @@
work_packages_page.visit_index
end
- include_context 'work package table helpers'
+ include_context "work package table helpers"
- context 'sorting by version' do
+ context "sorting by version" do
before do
work_package_1.update_attribute(:version_id, version_2.id)
work_package_2.update_attribute(:version_id, version_1.id)
end
- it 'sorts by version although version is not selected as a column' do
+ it "sorts by version although version is not selected as a column" do
sort_by.open_modal
- sort_by.update_nth_criteria(0, 'Version')
+ sort_by.update_nth_criteria(0, "Version")
expect_work_packages_to_be_in_order([work_package_1, work_package_2])
end
end
end
- describe 'sorting modal' do
+ describe "sorting modal" do
let(:sort_by) { Components::WorkPackages::SortBy.new }
before do
@@ -87,22 +87,22 @@
wp_table.visit!
end
- it 'provides the default sortation and allows using the value at another level (Regression WP#26792)' do
+ it "provides the default sortation and allows using the value at another level (Regression WP#26792)" do
# Expect current criteria
- sort_by.expect_criteria(['-', 'asc'])
+ sort_by.expect_criteria(["-", "asc"])
# Expect we can change the criteria and reuse that value
sort_by.open_modal
- sort_by.update_nth_criteria(0, 'Type', descending: true)
- sort_by.update_nth_criteria(0, 'ID', descending: true)
- sort_by.update_nth_criteria(1, 'Type')
+ sort_by.update_nth_criteria(0, "Type", descending: true)
+ sort_by.update_nth_criteria(0, "ID", descending: true)
+ sort_by.update_nth_criteria(1, "Type")
sort_by.apply_changes
- sort_by.expect_criteria(['ID', 'desc'], ['Type', 'asc'])
+ sort_by.expect_criteria(["ID", "desc"], ["Type", "asc"])
end
end
- describe 'parent sorting' do
+ describe "parent sorting" do
let(:sort_by) { Components::WorkPackages::SortBy.new }
let(:parent) do
@@ -136,7 +136,7 @@
end
before do
- allow(Setting).to receive(:per_page_options).and_return '4'
+ allow(Setting).to receive(:per_page_options).and_return "4"
parent
child1
@@ -149,7 +149,7 @@
wp_table.visit!
end
- it 'default sortation (id) does not order depth first (Reverted in #29122)' do
+ it "default sortation (id) does not order depth first (Reverted in #29122)" do
wp_table.expect_work_package_listed parent, child1, grand_child1, child2
wp_table.expect_work_package_order parent.id, child1.id, grand_child1.id, child2
end
diff --git a/spec/features/work_packages/switching_to_project_from_work_package_spec.rb b/spec/features/work_packages/switching_to_project_from_work_package_spec.rb
index 55d4f8be5775..3d773a97fd2b 100644
--- a/spec/features/work_packages/switching_to_project_from_work_package_spec.rb
+++ b/spec/features/work_packages/switching_to_project_from_work_package_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Switching to project from work package', :js do
+RSpec.describe "Switching to project from work package", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -14,7 +14,7 @@
work_package
end
- it 'allows to switch to the project the work package belongs to' do
+ it "allows to switch to the project the work package belongs to" do
wp_table.visit!
wp_table.expect_work_package_listed work_package
@@ -22,8 +22,8 @@
wp_table.open_full_screen_by_link work_package
# Follow link to project
- expect(page).to have_css('.attributes-group.-project-context')
- link = find('.attributes-group.-project-context .project-context--switch-link')
+ expect(page).to have_css(".attributes-group.-project-context")
+ link = find(".attributes-group.-project-context .project-context--switch-link")
expect(link[:href]).to include(project_path(project.id))
link.click
diff --git a/spec/features/work_packages/table/baseline/baseline_invisible_project_spec.rb b/spec/features/work_packages/table/baseline/baseline_invisible_project_spec.rb
index 7dc636fa7c26..8397afa62695 100644
--- a/spec/features/work_packages/table/baseline/baseline_invisible_project_spec.rb
+++ b/spec/features/work_packages/table/baseline/baseline_invisible_project_spec.rb
@@ -26,18 +26,18 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'baseline with a work package moved to an invisible project', :js,
- with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe "baseline with a work package moved to an invisible project", :js,
+ with_settings: { date_format: "%Y-%m-%d" } do
shared_let(:type_bug) { create(:type_bug) }
shared_let(:visible_project) { create(:project, types: [type_bug]) }
shared_let(:private_project) { create(:project, types: [type_bug]) }
shared_let(:user) do
create(:user,
- firstname: 'Itsa',
- lastname: 'Me',
+ firstname: "Itsa",
+ lastname: "Me",
member_with_permissions: { visible_project => %i[view_work_packages edit_work_packages work_package_assigned
assign_versions] })
end
@@ -49,16 +49,16 @@
type: type_bug,
assigned_to: user,
responsible: user,
- subject: 'WP in public project',
- start_date: '2023-05-01',
- due_date: '2023-05-02')
+ subject: "WP in public project",
+ start_date: "2023-05-01",
+ due_date: "2023-05-02")
end
Timecop.travel(1.hour.ago) do
WorkPackages::UpdateService
.new(user: User.system, model: wp)
.call(
- subject: 'Moved to private project',
+ subject: "Moved to private project",
project: private_project
)
.on_failure { |result| raise result.message }
@@ -68,7 +68,7 @@
shared_let(:query) do
query = create(:query,
- name: 'Global query changes since yesterday',
+ name: "Global query changes since yesterday",
project: nil,
user:)
@@ -85,17 +85,17 @@
current_user { user }
- describe 'with EE active', with_ee: %i[baseline_comparison] do
- it 'shows the item with all values removed' do
+ describe "with EE active", with_ee: %i[baseline_comparison] do
+ it "shows the item with all values removed" do
wp_table.visit_query(query)
baseline.expect_active
baseline.expect_removed wp_bug
baseline.expect_changed_attributes wp_bug,
- subject: ['WP in public project', ''],
- startDate: ['2023-05-01', ''],
- dueDate: ['2023-05-02', '']
+ subject: ["WP in public project", ""],
+ startDate: ["2023-05-01", ""],
+ dueDate: ["2023-05-02", ""]
end
end
end
diff --git a/spec/features/work_packages/table/baseline/baseline_query_spec.rb b/spec/features/work_packages/table/baseline/baseline_query_spec.rb
index 9a984223e318..f20307e4207d 100644
--- a/spec/features/work_packages/table/baseline/baseline_query_spec.rb
+++ b/spec/features/work_packages/table/baseline/baseline_query_spec.rb
@@ -26,13 +26,13 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'baseline query saving',
+RSpec.describe "baseline query saving",
:js,
:with_cuprite,
with_ee: %i[baseline_comparison],
- with_settings: { date_format: '%Y-%m-%d' } do
+ with_settings: { date_format: "%Y-%m-%d" } do
shared_let(:project) { create(:project) }
shared_let(:work_package) { create(:work_package, project:) }
@@ -43,7 +43,7 @@
shared_let(:berlin_user) do
create(:user,
- preferences: { time_zone: 'Europe/Berlin' },
+ preferences: { time_zone: "Europe/Berlin" },
member_with_permissions: { project => %i[view_work_packages save_queries manage_public_queries] })
end
@@ -56,7 +56,7 @@
shared_let(:tokyo_user) do
create(:user,
- preferences: { time_zone: 'Asia/Tokyo' },
+ preferences: { time_zone: "Asia/Tokyo" },
member_with_permissions: { project => %i[view_work_packages save_queries manage_public_queries] })
end
# always 9 as Japan does not observe daylight saving time
@@ -66,7 +66,7 @@
# always "UTC+9"
shared_let(:tokyo_utc_offset) { "UTC+#{tokyo_hours_offset}" }
- it 'shows a warning when an incompatible filter is used' do
+ it "shows a warning when an incompatible filter is used" do
login_as berlin_user
wp_table.visit!
@@ -74,30 +74,30 @@
baseline.expect_no_legends
baseline_modal.toggle_drop_modal
baseline_modal.expect_open
- baseline_modal.expect_selected '-'
+ baseline_modal.expect_selected "-"
- baseline_modal.select_filter 'yesterday'
- baseline_modal.set_time '09:00'
+ baseline_modal.select_filter "yesterday"
+ baseline_modal.set_time "09:00"
baseline_modal.expect_offset berlin_utc_offset
baseline_modal.apply
loading_indicator_saveguard
filters.open
- filters.add_filter_by('Watcher', 'is (OR)', 'me')
+ filters.add_filter_by("Watcher", "is (OR)", "me")
loading_indicator_saveguard
expect(page).to have_css(
- '.op-toast.-warning',
- text: 'Baseline mode is on but some of your active filters are not included in the comparison.'
+ ".op-toast.-warning",
+ text: "Baseline mode is on but some of your active filters are not included in the comparison."
)
- page.within('#filter_watcher') do
- expect(page).to have_test_selector('query-filter-baseline-incompatible')
+ page.within("#filter_watcher") do
+ expect(page).to have_test_selector("query-filter-baseline-incompatible")
end
end
- it 'can configure and save baseline queries' do
+ it "can configure and save baseline queries" do
login_as berlin_user
wp_table.visit!
@@ -105,10 +105,10 @@
baseline.expect_no_legends
baseline_modal.toggle_drop_modal
baseline_modal.expect_open
- baseline_modal.expect_selected '-'
+ baseline_modal.expect_selected "-"
- baseline_modal.select_filter 'yesterday'
- baseline_modal.set_time '09:00'
+ baseline_modal.select_filter "yesterday"
+ baseline_modal.set_time "09:00"
baseline_modal.expect_offset berlin_utc_offset
baseline_modal.apply
@@ -116,20 +116,20 @@
baseline_modal.toggle_drop_modal
baseline_modal.expect_open
- baseline_modal.expect_selected 'yesterday'
+ baseline_modal.expect_selected "yesterday"
baseline_modal.toggle_drop_modal
baseline_modal.expect_closed
baseline.expect_legends
baseline.expect_legend_text "Changes since yesterday (#{Date.yesterday.iso8601} 9:00 AM #{berlin_utc_offset})"
- expect(page).to have_css(".op-baseline-legends--details-added", text: 'Now meets filter criteria (1)')
- expect(page).to have_css(".op-baseline-legends--details-removed", text: 'No longer meets filter criteria (0)')
- expect(page).to have_css(".op-baseline-legends--details-changed", text: 'Maintained with changes (0)')
+ expect(page).to have_css(".op-baseline-legends--details-added", text: "Now meets filter criteria (1)")
+ expect(page).to have_css(".op-baseline-legends--details-removed", text: "No longer meets filter criteria (0)")
+ expect(page).to have_css(".op-baseline-legends--details-changed", text: "Maintained with changes (0)")
- wp_table.save_as 'Baseline query'
- wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_table.save_as "Baseline query"
+ wp_table.expect_and_dismiss_toaster(message: "Successful creation.")
- query = retry_block { Query.find_by! name: 'Baseline query' }
- expect(query.timestamps.map(&:to_s)).to eq ["oneDayAgo@09:00#{berlin_time_offset}", 'PT0S']
+ query = retry_block { Query.find_by! name: "Baseline query" }
+ expect(query.timestamps.map(&:to_s)).to eq ["oneDayAgo@09:00#{berlin_time_offset}", "PT0S"]
query.update! public: true
login_as tokyo_user
@@ -142,41 +142,41 @@
baseline_modal.expect_closed
baseline_modal.toggle_drop_modal
baseline_modal.expect_open
- baseline_modal.expect_selected 'yesterday'
- baseline_modal.expect_selected_time '09:00'
+ baseline_modal.expect_selected "yesterday"
+ baseline_modal.expect_selected_time "09:00"
baseline_modal.expect_offset berlin_utc_offset
- baseline_modal.select_filter '-'
+ baseline_modal.select_filter "-"
- baseline_modal.select_filter 'yesterday'
+ baseline_modal.select_filter "yesterday"
baseline_modal.expect_offset tokyo_utc_offset
- baseline_modal.select_filter '-'
+ baseline_modal.select_filter "-"
baseline_modal.apply
baseline.expect_no_legends
loading_indicator_saveguard
wp_table.save
- wp_table.expect_and_dismiss_toaster(message: 'Successful update.')
+ wp_table.expect_and_dismiss_toaster(message: "Successful update.")
query.reload
- expect(query.timestamps).to eq ['PT0S']
+ expect(query.timestamps).to eq ["PT0S"]
baseline_modal.expect_closed
baseline_modal.toggle_drop_modal
baseline_modal.expect_open
- baseline_modal.select_filter 'a specific date'
+ baseline_modal.select_filter "a specific date"
baseline_modal.expect_offset tokyo_utc_offset
- baseline_modal.set_time '06:00'
- baseline_modal.set_date '2023-05-20'
+ baseline_modal.set_time "06:00"
+ baseline_modal.set_date "2023-05-20"
baseline_modal.apply
loading_indicator_saveguard
wp_table.save
- wp_table.expect_and_dismiss_toaster(message: 'Successful update.')
+ wp_table.expect_and_dismiss_toaster(message: "Successful update.")
query.reload
- expect(query.timestamps.map(&:to_s)).to eq ['2023-05-20T06:00+09:00', 'PT0S']
+ expect(query.timestamps.map(&:to_s)).to eq ["2023-05-20T06:00+09:00", "PT0S"]
login_as berlin_user
wp_table.visit_query query
@@ -186,11 +186,11 @@
baseline_modal.expect_closed
baseline_modal.toggle_drop_modal
baseline_modal.expect_open
- baseline_modal.expect_selected 'a specific date'
- baseline_modal.expect_selected_time '06:00'
- baseline_modal.expect_offset 'UTC+9'
+ baseline_modal.expect_selected "a specific date"
+ baseline_modal.expect_selected_time "06:00"
+ baseline_modal.expect_offset "UTC+9"
baseline_modal.expect_time_help_text "In your local time: 2023-05-19 11:00 PM"
- baseline_modal.select_filter 'between two specific dates'
+ baseline_modal.select_filter "between two specific dates"
# TODO: on the 2023-05-19, utc offset is +2 hours. But when current date is
# outside of DST (from November to February for instance), then on time
@@ -198,17 +198,17 @@
# would be better to change the offset depending on the selected date: here
# UTC+2 offset should be used so that 8:00 is really 8:00 in Berlin on this
# date, and not 9:00 (because 8:00 UTC+1 is 9:00 UTC+2).
- baseline_modal.set_between_dates from: '2023-05-19',
- to: '2023-05-25',
- from_time: '08:00',
- to_time: '20:00'
+ baseline_modal.set_between_dates from: "2023-05-19",
+ to: "2023-05-25",
+ from_time: "08:00",
+ to_time: "20:00"
baseline_modal.apply
loading_indicator_saveguard
wp_table.save
- wp_table.expect_and_dismiss_toaster(message: 'Successful update.')
+ wp_table.expect_and_dismiss_toaster(message: "Successful update.")
query.reload
expect(query.timestamps.map(&:to_s)).to eq ["2023-05-19T08:00#{berlin_time_offset}", "2023-05-25T20:00#{berlin_time_offset}"]
@@ -224,11 +224,11 @@
baseline_modal.expect_closed
baseline_modal.toggle_drop_modal
baseline_modal.expect_open
- baseline_modal.expect_selected 'between two specific dates'
- baseline_modal.expect_between_dates from: '2023-05-19',
- to: '2023-05-25',
- from_time: '08:00',
- to_time: '20:00'
+ baseline_modal.expect_selected "between two specific dates"
+ baseline_modal.expect_between_dates from: "2023-05-19",
+ to: "2023-05-25",
+ from_time: "08:00",
+ to_time: "20:00"
baseline_modal.expect_offset berlin_utc_offset, count: 2
end
diff --git a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
index 402fe968728c..fb851d6bd95d 100644
--- a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
+++ b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
@@ -26,12 +26,12 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'baseline rendering',
+RSpec.describe "baseline rendering",
:js,
:with_cuprite,
- with_settings: { date_format: '%Y-%m-%d' } do
+ with_settings: { date_format: "%Y-%m-%d" } do
shared_let(:list_wp_custom_field) { create(:list_wp_custom_field) }
shared_let(:multi_list_wp_custom_field) { create(:list_wp_custom_field, multi_value: true) }
shared_let(:version_wp_custom_field) { create(:version_wp_custom_field) }
@@ -67,35 +67,35 @@
end
shared_let(:user) do
create(:admin,
- firstname: 'Itsa',
- lastname: 'Me',
+ firstname: "Itsa",
+ lastname: "Me",
member_with_permissions: { project => %i[view_work_packages edit_work_packages work_package_assigned
assign_versions] })
end
shared_let(:assignee) do
create(:user,
- firstname: 'Assigned',
- lastname: 'User',
+ firstname: "Assigned",
+ lastname: "User",
member_with_permissions: { project => %i[view_work_packages edit_work_packages work_package_assigned] })
end
shared_let(:default_priority) do
- create(:issue_priority, name: 'Default', is_default: true)
+ create(:issue_priority, name: "Default", is_default: true)
end
shared_let(:high_priority) do
- create(:issue_priority, name: 'High priority')
+ create(:issue_priority, name: "High priority")
end
- shared_let(:version_a) { create(:version, project:, name: 'Version A') }
- shared_let(:version_b) { create(:version, project:, name: 'Version B') }
+ shared_let(:version_a) { create(:version, project:, name: "Version A") }
+ shared_let(:version_b) { create(:version, project:, name: "Version B") }
shared_let(:wp_bug) do
create(:work_package,
project:,
type: type_bug,
- subject: 'A bug',
+ subject: "A bug",
created_at: 5.days.ago,
updated_at: 5.days.ago)
end
@@ -104,7 +104,7 @@
create(:work_package,
project:,
type: type_task,
- subject: 'A task',
+ subject: "A task",
created_at: 5.days.ago,
updated_at: 5.days.ago)
@@ -119,16 +119,16 @@
responsible: assignee,
priority: default_priority,
version: version_a,
- subject: 'Old subject',
- start_date: '2023-05-01',
- due_date: '2023-05-02')
+ subject: "Old subject",
+ start_date: "2023-05-01",
+ due_date: "2023-05-02")
end
Timecop.travel(1.day.ago) do
WorkPackages::UpdateService
.new(user:, model: wp)
.call(
- subject: 'New subject',
+ subject: "New subject",
start_date: Time.zone.today - 1.day,
due_date: Time.zone.today,
assigned_to: user,
@@ -160,7 +160,7 @@
shared_let(:wp_task_was_bug) do
wp = Timecop.travel(5.days.ago) do
- create(:work_package, project:, type: type_bug, subject: 'Bug changed to Task')
+ create(:work_package, project:, type: type_bug, subject: "Bug changed to Task")
end
Timecop.travel(1.day.ago) do
@@ -174,7 +174,7 @@
shared_let(:wp_bug_was_task) do
wp = Timecop.travel(5.days.ago) do
- create(:work_package, project:, type: type_task, subject: 'Task changed to Bug')
+ create(:work_package, project:, type: type_task, subject: "Task changed to Bug")
end
Timecop.travel(1.day.ago) do
@@ -191,7 +191,7 @@
create(:work_package,
project:,
type: type_milestone,
- subject: 'Milestone 1',
+ subject: "Milestone 1",
start_date: Time.zone.today,
due_date: Time.zone.today)
end
@@ -206,7 +206,7 @@
shared_let(:initial_custom_values) do
{
int_wp_custom_field.id => 1,
- string_wp_custom_field.id => 'this is a string',
+ string_wp_custom_field.id => "this is a string",
bool_wp_custom_field.id => true,
float_wp_custom_field.id => nil,
date_wp_custom_field.id => Date.yesterday,
@@ -220,7 +220,7 @@
shared_let(:changed_custom_values) do
{
"custom_field_#{int_wp_custom_field.id}": nil,
- "custom_field_#{string_wp_custom_field.id}": 'this is a changed string',
+ "custom_field_#{string_wp_custom_field.id}": "this is a changed string",
"custom_field_#{bool_wp_custom_field.id}": false,
"custom_field_#{float_wp_custom_field.id}": 3.7,
"custom_field_#{date_wp_custom_field.id}": Time.zone.today,
@@ -241,7 +241,7 @@
:skip_validations,
project:,
type: type_task,
- subject: 'A task with CFs',
+ subject: "A task with CFs",
custom_values: initial_custom_values)
end
end
@@ -255,12 +255,12 @@
shared_let(:query) do
query = create(:query,
- name: 'Timestamps Query',
+ name: "Timestamps Query",
project:,
user:)
query.timestamps = ["P-2d", "PT0S"]
- query.add_filter('type_id', '=', [type_task.id, type_milestone.id])
+ query.add_filter("type_id", "=", [type_task.id, type_milestone.id])
query.column_names =
%w[id subject status type start_date due_date version priority assigned_to responsible] +
CustomField.all.pluck(:id).map { |id| "cf_#{id}" }
@@ -276,8 +276,8 @@
current_user { user }
- describe 'with EE', with_ee: %i[baseline_comparison] do
- it 'does show changes' do
+ describe "with EE", with_ee: %i[baseline_comparison] do
+ it "does show changes" do
wp_table.visit_query(query)
wp_table.expect_work_package_listed wp_task, wp_task_changed, wp_task_was_bug, wp_bug_was_task,
wp_task_assigned, wp_milestone_date_changed
@@ -298,16 +298,16 @@
type: %w[TASK BUG]
baseline.expect_changed_attributes wp_task_changed,
- subject: ['Old subject', 'New subject'],
- startDate: ['2023-05-01', (today - 2.days).iso8601],
- dueDate: ['2023-05-02', (today - 1.day).iso8601],
- version: ['Version A', 'Version B'],
- priority: ['Default', 'High priority'],
- assignee: ['Assigned User', 'Itsa Me'],
- responsible: ['Assigned User', 'Itsa Me']
+ subject: ["Old subject", "New subject"],
+ startDate: ["2023-05-01", (today - 2.days).iso8601],
+ dueDate: ["2023-05-02", (today - 1.day).iso8601],
+ version: ["Version A", "Version B"],
+ priority: ["Default", "High priority"],
+ assignee: ["Assigned User", "Itsa Me"],
+ responsible: ["Assigned User", "Itsa Me"]
baseline.expect_changed_attributes wp_task_assigned,
- assignee: ['-', 'Itsa Me']
+ assignee: ["-", "Itsa Me"]
baseline.expect_changed_attributes wp_milestone_date_changed,
startDate: [
@@ -326,20 +326,20 @@
baseline.expect_changed_attributes wp_task_cf,
"customField#{int_wp_custom_field.id}": [
- '1',
- '-'
+ "1",
+ "-"
],
"customField#{string_wp_custom_field.id}": [
- 'this is a string',
- 'this is a changed string'
+ "this is a string",
+ "this is a changed string"
],
"customField#{bool_wp_custom_field.id}": [
- 'yes',
- 'no'
+ "yes",
+ "no"
],
"customField#{float_wp_custom_field.id}": [
- '-',
- '3.7'
+ "-",
+ "3.7"
],
"customField#{date_wp_custom_field.id}": [
Date.yesterday.iso8601,
@@ -354,12 +354,12 @@
"A, B"
],
"customField#{user_wp_custom_field.id}": [
- 'Assigned User',
- '-'
+ "Assigned User",
+ "-"
],
"customField#{version_wp_custom_field.id}": [
- 'Version A',
- 'Version B'
+ "Version A",
+ "Version B"
]
# Shows changes even if columns not showing
@@ -367,68 +367,68 @@
query.save!
wp_table.visit_query(query)
- baseline.expect_icon wp_milestone_date_changed, 'changed'
+ baseline.expect_icon wp_milestone_date_changed, "changed"
end
- shared_examples_for 'selecting a builtin view' do
- let(:builtin_view_name) { 'All open' }
+ shared_examples_for "selecting a builtin view" do
+ let(:builtin_view_name) { "All open" }
before do
- within '#main-menu' do
+ within "#main-menu" do
click_link builtin_view_name
end
end
- it 'does not show changes or render baseline details' do
+ it "does not show changes or render baseline details" do
wp_table.expect_title builtin_view_name
baseline.expect_inactive
baseline.expect_no_legends
baseline_modal.toggle_drop_modal
- baseline_modal.expect_selected '-'
+ baseline_modal.expect_selected "-"
end
end
- context 'when a baseline filter is set' do
+ context "when a baseline filter is set" do
before do
wp_table.visit!
wait_for_reload # Ensure page is fully loaded
baseline_modal.toggle_drop_modal
- baseline_modal.select_filter 'yesterday'
+ baseline_modal.select_filter "yesterday"
baseline_modal.apply
wait_for_reload # Ensure page is fully loaded
end
- context 'and the query is saved' do
+ context "and the query is saved" do
before do
- wp_table.save_as('My Baseline Query', by_title: true)
+ wp_table.save_as("My Baseline Query", by_title: true)
end
- it_behaves_like 'selecting a builtin view'
+ it_behaves_like "selecting a builtin view"
end
- context 'and the query is not saved' do
- it_behaves_like 'selecting a builtin view'
+ context "and the query is not saved" do
+ it_behaves_like "selecting a builtin view"
end
end
end
- describe 'without EE', with_ee: false do
- it 'disabled options' do
+ describe "without EE", with_ee: false do
+ it "disabled options" do
wp_table.visit_query(query)
baseline_modal.expect_closed
baseline_modal.toggle_drop_modal
baseline_modal.expect_open
expect(page).to have_css(".op-baseline--enterprise-title")
# only yesterday is selectable
- page.select('a specific date', from: 'op-baseline-filter')
- expect(page).to have_no_select('op-baseline-filter', selected: 'a specific date')
+ page.select("a specific date", from: "op-baseline-filter")
+ expect(page).to have_no_select("op-baseline-filter", selected: "a specific date")
- page.select('yesterday', from: 'op-baseline-filter')
- expect(page).to have_select('op-baseline-filter', selected: 'yesterday')
+ page.select("yesterday", from: "op-baseline-filter")
+ expect(page).to have_select("op-baseline-filter", selected: "yesterday")
end
end
end
diff --git a/spec/features/work_packages/table/configuration_modal/column_spec.rb b/spec/features/work_packages/table/configuration_modal/column_spec.rb
index 50538dcab351..51d272727f7d 100644
--- a/spec/features/work_packages/table/configuration_modal/column_spec.rb
+++ b/spec/features/work_packages/table/configuration_modal/column_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table configuration modal columns spec', :js do
+RSpec.describe "Work Package table configuration modal columns spec", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -22,31 +22,31 @@
login_as(user)
wp_table.visit_query query
wp_table.expect_work_package_listed work_package
- expect(page).to have_css('.wp-table--table-header', text: 'ID')
- expect(page).to have_css('.wp-table--table-header', text: 'SUBJECT')
+ expect(page).to have_css(".wp-table--table-header", text: "ID")
+ expect(page).to have_css(".wp-table--table-header", text: "SUBJECT")
end
- shared_examples 'add and remove columns' do
+ shared_examples "add and remove columns" do
it do
columns.open_modal
- columns.expect_checked 'ID'
- columns.expect_checked 'Subject'
+ columns.expect_checked "ID"
+ columns.expect_checked "Subject"
- columns.remove 'Subject', save_changes: false
- columns.add 'Project', save_changes: true
- columns.expect_column_available 'Subject'
- columns.expect_column_not_available 'Project'
+ columns.remove "Subject", save_changes: false
+ columns.add "Project", save_changes: true
+ columns.expect_column_available "Subject"
+ columns.expect_column_not_available "Project"
- expect(page).to have_css('.wp-table--table-header', text: 'ID')
- expect(page).to have_css('.wp-table--table-header', text: 'PROJECT')
- expect(page).to have_no_css('.wp-table--table-header', text: 'SUBJECT')
+ expect(page).to have_css(".wp-table--table-header", text: "ID")
+ expect(page).to have_css(".wp-table--table-header", text: "PROJECT")
+ expect(page).to have_no_css(".wp-table--table-header", text: "SUBJECT")
end
end
- context 'When seeing the table' do
- it_behaves_like 'add and remove columns'
+ context "When seeing the table" do
+ it_behaves_like "add and remove columns"
- context 'with three columns', driver: :firefox_de do
+ context "with three columns", driver: :firefox_de do
let!(:query) do
query = build(:query, user:, project:)
query.column_names = %w[id project subject]
@@ -55,15 +55,15 @@
query
end
- it 'can reorder columns' do
+ it "can reorder columns" do
columns.open_modal
- columns.expect_checked 'ID'
- columns.expect_checked 'Project'
- columns.expect_checked 'Subject'
+ columns.expect_checked "ID"
+ columns.expect_checked "Project"
+ columns.expect_checked "Subject"
# Drag subject left of project
- subject_column = columns.column_item('Subject').find('span')
- project_column = columns.column_item('Project').find('span')
+ subject_column = columns.column_item("Subject").find("span")
+ project_column = columns.column_item("Project").find("span")
page
.driver
@@ -76,11 +76,11 @@
sleep 1
columns.apply
- expect(page).to have_css('.wp-table--table-header', text: 'ID')
- expect(page).to have_css('.wp-table--table-header', text: 'PROJECT')
- expect(page).to have_css('.wp-table--table-header', text: 'SUBJECT')
+ expect(page).to have_css(".wp-table--table-header", text: "ID")
+ expect(page).to have_css(".wp-table--table-header", text: "PROJECT")
+ expect(page).to have_css(".wp-table--table-header", text: "SUBJECT")
- names = all('.wp-table--table-header').map(&:text)
+ names = all(".wp-table--table-header").map(&:text)
# Depending on what browser is used, subject column may be first or second
# it doesn't matter for the outcome of this test
expect(names).to eq(%w[SUBJECT ID PROJECT]).or(eq(%w[ID SUBJECT PROJECT]))
diff --git a/spec/features/work_packages/table/configuration_modal/filter_spec.rb b/spec/features/work_packages/table/configuration_modal/filter_spec.rb
index 27694868bd28..7e58c08409dc 100644
--- a/spec/features/work_packages/table/configuration_modal/filter_spec.rb
+++ b/spec/features/work_packages/table/configuration_modal/filter_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table configuration modal filters spec', :js do
+RSpec.describe "Work Package table configuration modal filters spec", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -12,7 +12,7 @@
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['subject', 'done_ratio']
+ query.column_names = ["subject", "done_ratio"]
query.save!
query
@@ -22,7 +22,7 @@
login_as(user)
end
- context 'by version in project' do
+ context "by version in project" do
let(:version) { create(:version, project:) }
let(:work_package_with_version) { create(:work_package, project:, version:) }
let(:work_package_without_version) { create(:work_package, project:) }
@@ -34,22 +34,22 @@
wp_table.visit!
end
- it 'allows filtering, saving, retrieving and altering the saved filter' do
+ it "allows filtering, saving, retrieving and altering the saved filter" do
wp_table.expect_work_package_listed work_package_with_version, work_package_without_version
filters.open
filters.expect_filter_count 2
- filters.add_filter_by('Version', 'is (OR)', version.name)
+ filters.add_filter_by("Version", "is (OR)", version.name)
filters.save
wp_table.expect_work_package_listed work_package_with_version
wp_table.ensure_work_package_not_listed! work_package_without_version
- wp_table.save_as('Some query name')
+ wp_table.save_as("Some query name")
filters.open
filters.expect_filter_count 3
- filters.remove_filter 'version'
+ filters.remove_filter "version"
filters.save
loading_indicator_saveguard
diff --git a/spec/features/work_packages/table/configuration_modal/table_configuration_modal_spec.rb b/spec/features/work_packages/table/configuration_modal/table_configuration_modal_spec.rb
index 2cf00353f1a6..2e48119623c0 100644
--- a/spec/features/work_packages/table/configuration_modal/table_configuration_modal_spec.rb
+++ b/spec/features/work_packages/table/configuration_modal/table_configuration_modal_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table configuration modal', :js do
+RSpec.describe "Work Package table configuration modal", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -11,7 +11,7 @@
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['subject', 'done_ratio']
+ query.column_names = ["subject", "done_ratio"]
query.save!
query
@@ -24,14 +24,14 @@
wp_table.expect_work_package_listed wp_1
end
- it 'focuses on the columns tab when opened through header' do
+ it "focuses on the columns tab when opened through header" do
# Open header dropdown
- find('.work-package-table--container th #subject').click
+ find(".work-package-table--container th #subject").click
# Open insert columns entry
- find('#column-context-menu .menu-item', text: 'Insert columns').click
+ find("#column-context-menu .menu-item", text: "Insert columns").click
# Expect active tab is columns
- expect(page).to have_css('.op-tab-row--link_selected', text: 'COLUMNS')
+ expect(page).to have_css(".op-tab-row--link_selected", text: "COLUMNS")
end
end
diff --git a/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb b/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb
index 3503e0025235..f09dfbb757db 100644
--- a/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb
+++ b/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb
@@ -1,92 +1,92 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.shared_examples_for 'provides a single WP context menu' do
- let(:open_context_menu) { raise 'needs to be defined' }
+RSpec.shared_examples_for "provides a single WP context menu" do
+ let(:open_context_menu) { raise "needs to be defined" }
let(:destroy_modal) { Components::WorkPackages::DestroyModal.new }
let(:time_logging_modal) { Components::TimeLoggingModal.new }
let(:wp_timeline) { Pages::WorkPackagesTimeline.new(work_package.project) }
- it 'provides a context menu' do
+ it "provides a context menu" do
# Open detail pane
open_context_menu.call
- menu.choose('Open details view')
+ menu.choose("Open details view")
split_page = Pages::SplitWorkPackage.new(work_package, work_package.project)
split_page.expect_attributes Subject: work_package.subject
# Open full view
open_context_menu.call
- menu.choose('Open fullscreen view')
- expect(page).to have_css('.work-packages--show-view .inline-edit--container.subject',
+ menu.choose("Open fullscreen view")
+ expect(page).to have_css(".work-packages--show-view .inline-edit--container.subject",
text: work_package.subject)
# Open log time
open_context_menu.call
- menu.choose('Log time')
+ menu.choose("Log time")
time_logging_modal.is_visible true
time_logging_modal.work_package_is_missing false
- time_logging_modal.perform_action 'Cancel'
+ time_logging_modal.perform_action "Cancel"
# Open Move
open_context_menu.call
- menu.choose('Change project')
- expect(page).to have_css('h2', text: I18n.t(:button_move))
- expect(page).to have_css('a.work_package', text: "##{work_package.id}")
+ menu.choose("Change project")
+ expect(page).to have_css("h2", text: I18n.t(:button_move))
+ expect(page).to have_css("a.work_package", text: "##{work_package.id}")
# Open Copy
open_context_menu.call
- menu.choose('Copy')
+ menu.choose("Copy")
# Split view open in copy state
expect(page)
- .to have_css('.wp-new-top-row',
+ .to have_css(".wp-new-top-row",
text: "#{work_package.status.name.capitalize}\n#{work_package.type.name.upcase}")
- expect(page).to have_field('wp-new-inline-edit--field-subject', with: work_package.subject)
+ expect(page).to have_field("wp-new-inline-edit--field-subject", with: work_package.subject)
# Open Delete
open_context_menu.call
- menu.choose('Delete')
+ menu.choose("Delete")
destroy_modal.expect_listed(work_package)
destroy_modal.cancel_deletion
# Open create new child
open_context_menu.call
- menu.choose('Create new child')
- expect(page).to have_css('.inline-edit--container.subject input')
+ menu.choose("Create new child")
+ expect(page).to have_css(".inline-edit--container.subject input")
expect(current_url).to match(/.*\/create_new\?.*(&)*parent_id=#{work_package.id}/)
- find_by_id('work-packages--edit-actions-cancel').click
- expect(page).to have_no_css('.inline-edit--container.subject input')
+ find_by_id("work-packages--edit-actions-cancel").click
+ expect(page).to have_no_css(".inline-edit--container.subject input")
# Timeline actions only shown when open
wp_timeline.expect_timeline!(open: false)
open_context_menu.call
- menu.expect_no_options 'Add predecessor', 'Add follower, Show relations'
+ menu.expect_no_options "Add predecessor", "Add follower, Show relations"
# Copy to other project
open_context_menu.call
- menu.choose('Copy to other project')
- expect(page).to have_css('h2', text: I18n.t(:button_copy))
- expect(page).to have_css('a.work_package', text: "##{work_package.id}")
+ menu.choose("Copy to other project")
+ expect(page).to have_css("h2", text: I18n.t(:button_copy))
+ expect(page).to have_css("a.work_package", text: "##{work_package.id}")
end
- describe 'creating work packages' do
+ describe "creating work packages" do
let!(:priority) { create(:issue_priority, is_default: true) }
let!(:status) { create(:default_status) }
- it 'can create a new child from the context menu (Regression #33329)' do
+ it "can create a new child from the context menu (Regression #33329)" do
open_context_menu.call
- menu.choose('Create new child')
- expect(page).to have_css('.inline-edit--container.subject input')
+ menu.choose("Create new child")
+ expect(page).to have_css(".inline-edit--container.subject input")
expect(current_url).to match(/.*\/create_new\?.*(&)*parent_id=#{work_package.id}/)
split_view = Pages::SplitWorkPackageCreate.new project: work_package.project
subject = split_view.edit_field(:subject)
- subject.set_value 'Child task'
+ subject.set_value "Child task"
# Wait a bit for the split view to be fully initialized
sleep 1
subject.submit_by_enter
- split_view.expect_and_dismiss_toaster message: 'Successful creation.'
+ split_view.expect_and_dismiss_toaster message: "Successful creation."
expect(page).to have_css('[data-test-selector="op-wp-breadcrumb"]', text: "Parent:\n#{work_package.subject}")
wp = WorkPackage.last
expect(wp.parent).to eq work_package
diff --git a/spec/features/work_packages/table/context_menu/context_menu_spec.rb b/spec/features/work_packages/table/context_menu/context_menu_spec.rb
index 39845bd9e298..e919047e0981 100644
--- a/spec/features/work_packages/table/context_menu/context_menu_spec.rb
+++ b/spec/features/work_packages/table/context_menu/context_menu_spec.rb
@@ -1,7 +1,7 @@
-require 'spec_helper'
-require_relative 'context_menu_shared_examples'
+require "spec_helper"
+require_relative "context_menu_shared_examples"
-RSpec.describe 'Work package table context menu',
+RSpec.describe "Work package table context menu",
:js,
:with_cuprite do
shared_let(:user) { create(:admin) }
@@ -16,7 +16,7 @@
query = build(:query_with_view_gantt, user:, project:)
query.filters.clear
query.timeline_visible = true
- query.name = 'Query with Timeline'
+ query.name = "Query with Timeline"
query.save!
@@ -28,8 +28,8 @@
work_package
end
- context 'when in the table' do
- it_behaves_like 'provides a single WP context menu' do
+ context "when in the table" do
+ it_behaves_like "provides a single WP context menu" do
let(:open_context_menu) do
-> {
# Go to table
@@ -43,10 +43,10 @@
}
end
- context 'for multiple selected WPs' do
+ context "for multiple selected WPs" do
let!(:work_package2) { create(:work_package, project: work_package.project) }
- it 'provides a context menu with a subset of the available menu items' do
+ it "provides a context menu with a subset of the available menu items" do
# Go to table
wp_table.visit!
@@ -55,17 +55,17 @@
wp_table.expect_work_package_listed(work_package2)
# Select all WPs
- find('body').send_keys [:control, 'a']
+ find("body").send_keys [:control, "a"]
menu.open_for(work_package)
- menu.expect_options 'Open details view', 'Open fullscreen view',
- 'Bulk edit', 'Bulk copy', 'Bulk change of project', 'Bulk delete'
+ menu.expect_options "Open details view", "Open fullscreen view",
+ "Bulk edit", "Bulk copy", "Bulk change of project", "Bulk delete"
end
end
end
- context 'when in Gantt' do
- it 'provides a context menu with timeline options' do
+ context "when in Gantt" do
+ it "provides a context menu with timeline options" do
wp_timeline.visit_query(query_tl)
loading_indicator_saveguard
wp_timeline.expect_work_package_listed(work_package)
@@ -74,11 +74,11 @@
# Open context menu
menu.expect_closed
menu.open_for(work_package)
- menu.expect_options 'Open details view', 'Open fullscreen view', 'Add predecessor', 'Add follower', 'Show relations'
- menu.expect_no_options 'Log time'
+ menu.expect_options "Open details view", "Open fullscreen view", "Add predecessor", "Add follower", "Show relations"
+ menu.expect_no_options "Log time"
# Show relations tab when selecting show-relations from menu
- menu.choose('Show relations')
+ menu.choose("Show relations")
expect(page).to have_current_path /details\/#{work_package.id}\/relations/
end
end
diff --git a/spec/features/work_packages/table/delete_work_packages_spec.rb b/spec/features/work_packages/table/delete_work_packages_spec.rb
index 4eef1626ce62..42ce18edbd1e 100644
--- a/spec/features/work_packages/table/delete_work_packages_spec.rb
+++ b/spec/features/work_packages/table/delete_work_packages_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Delete work package', :js do
+RSpec.describe "Delete work package", :js do
let(:user) { create(:admin) }
let(:context_menu) { Components::WorkPackages::ContextMenu.new }
let(:destroy_modal) { Components::WorkPackages::DestroyModal.new }
@@ -37,8 +37,8 @@
login_as(user)
end
- shared_examples 'close split view' do
- describe 'when deleting a work package that is opened in the split view' do
+ shared_examples "close split view" do
+ describe "when deleting a work package that is opened in the split view" do
before do
work_package
@@ -46,7 +46,7 @@
split_view.ensure_page_loaded
context_menu.open_for(work_package)
- context_menu.choose('Delete')
+ context_menu.choose("Delete")
destroy_modal.expect_listed(work_package)
destroy_modal.confirm_deletion
@@ -54,35 +54,35 @@
loading_indicator_saveguard
end
- it 'closes the split view' do
+ it "closes the split view" do
split_view.expect_closed
wp_table.expect_current_path
end
end
end
- describe 'deleting multiple work packages in the table' do
+ describe "deleting multiple work packages in the table" do
let!(:wp1) { create(:work_package) }
let!(:wp2) { create(:work_package) }
let!(:wp_child) { create(:work_package, parent: wp1) }
let(:wp_table) { Pages::WorkPackagesTable.new }
- it 'shows deletion for all selected work packages' do
+ it "shows deletion for all selected work packages" do
wp_table.visit!
wp_table.expect_work_package_listed wp1, wp2, wp_child
- find('body').send_keys [:control, 'a']
+ find("body").send_keys [:control, "a"]
context_menu.open_for(wp1)
- context_menu.choose('Bulk delete')
+ context_menu.choose("Bulk delete")
destroy_modal.expect_listed(wp1, wp2, wp_child)
destroy_modal.cancel_deletion
wp_table.expect_work_package_listed wp1, wp2, wp_child
context_menu.open_for(wp1)
- context_menu.choose('Bulk delete')
+ context_menu.choose("Bulk delete")
destroy_modal.confirm_children_deletion
destroy_modal.confirm_deletion
@@ -91,20 +91,20 @@
end
end
- describe 'when deleting it outside a project context' do
+ describe "when deleting it outside a project context" do
let(:work_package) { create(:work_package) }
let(:split_view) { Pages::SplitWorkPackage.new(work_package) }
let(:wp_table) { Pages::WorkPackagesTable.new }
- it_behaves_like 'close split view'
+ it_behaves_like "close split view"
end
- describe 'when deleting it within a project context' do
+ describe "when deleting it within a project context" do
let(:project) { create(:project) }
let(:work_package) { create(:work_package, project:) }
let(:split_view) { Pages::SplitWorkPackage.new(work_package, project.identifier) }
let(:wp_table) { Pages::WorkPackagesTable.new(project.identifier) }
- it_behaves_like 'close split view'
+ it_behaves_like "close split view"
end
end
diff --git a/spec/features/work_packages/table/duration_field_spec.rb b/spec/features/work_packages/table/duration_field_spec.rb
index 81dbb374c80a..38fc4268b96a 100644
--- a/spec/features/work_packages/table/duration_field_spec.rb
+++ b/spec/features/work_packages/table/duration_field_spec.rb
@@ -1,11 +1,11 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Duration field in the work package table', :js do
+RSpec.describe "Duration field in the work package table", :js do
shared_let(:current_user) { create(:admin) }
shared_let(:work_package) do
next_monday = Time.zone.today.beginning_of_week.next_occurring(:monday)
create(:work_package,
- subject: 'moved',
+ subject: "moved",
author: current_user,
start_date: next_monday,
due_date: next_monday.next_occurring(:thursday))
@@ -32,12 +32,12 @@
wp_table.expect_work_package_listed work_package
end
- it 'shows the duration as days and opens the datepicker on click' do
- duration.expect_state_text '4 days'
+ it "shows the duration as days and opens the datepicker on click" do
+ duration.expect_state_text "4 days"
duration.activate!
date_field.expect_duration_highlighted
expect(page).to have_focus_on("#{test_selector('op-datepicker-modal--duration-field')} input[name='duration']")
- expect(page).to have_field('duration', with: '4', wait: 10)
+ expect(page).to have_field("duration", with: "4", wait: 10)
end
end
diff --git a/spec/features/work_packages/table/edit_work_packages_spec.rb b/spec/features/work_packages/table/edit_work_packages_spec.rb
index 72c409906413..6b49032e6fb3 100644
--- a/spec/features/work_packages/table/edit_work_packages_spec.rb
+++ b/spec/features/work_packages/table/edit_work_packages_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Inline editing work packages', :js do
+RSpec.describe "Inline editing work packages", :js do
let(:manager_role) do
create(:project_role,
permissions: %i[view_work_packages
@@ -8,8 +8,8 @@
end
let(:manager) do
create(:user,
- firstname: 'Manager',
- lastname: 'Guy',
+ firstname: "Manager",
+ lastname: "Guy",
member_with_roles: { project => manager_role })
end
let(:type) { create(:type) }
@@ -22,7 +22,7 @@
project:,
type:,
status: status1,
- subject: 'Foobar')
+ subject: "Foobar")
end
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -41,7 +41,7 @@
login_as(manager)
end
- context 'simple work package' do
+ context "simple work package" do
before do
work_package
workflow
@@ -50,35 +50,35 @@
wp_table.expect_work_package_listed(work_package)
end
- it 'allows updating and seeing the results' do
+ it "allows updating and seeing the results" do
subject_field = wp_table.edit_field(work_package, :subject)
- subject_field.expect_text('Foobar')
+ subject_field.expect_text("Foobar")
subject_field.activate!
- subject_field.set_value('New subject!')
+ subject_field.set_value("New subject!")
expect(WorkPackages::UpdateService).to receive(:new).and_call_original
subject_field.save!
- subject_field.expect_text('New subject!')
+ subject_field.expect_text("New subject!")
wp_table.expect_toast(
- message: 'Successful update. Click here to open this work package in fullscreen view.'
+ message: "Successful update. Click here to open this work package in fullscreen view."
)
work_package.reload
- expect(work_package.subject).to eq('New subject!')
+ expect(work_package.subject).to eq("New subject!")
end
- it 'allows to subsequently edit multiple fields' do
+ it "allows to subsequently edit multiple fields" do
subject_field = wp_table.edit_field(work_package, :subject)
status_field = wp_table.edit_field(work_package, :status)
subject_field.activate!
- subject_field.set_value('Other subject!')
+ subject_field.set_value("Other subject!")
subject_field.save!
- wp_table.expect_and_dismiss_toaster(message: 'Successful update')
+ wp_table.expect_and_dismiss_toaster(message: "Successful update")
status_field.activate!
status_field.set_value(status2.name)
@@ -86,36 +86,36 @@
subject_field.expect_inactive!
status_field.expect_inactive!
- subject_field.expect_text('Other subject!')
+ subject_field.expect_text("Other subject!")
status_field.expect_text(status2.name)
- wp_table.expect_and_dismiss_toaster(message: 'Successful update')
+ wp_table.expect_and_dismiss_toaster(message: "Successful update")
work_package.reload
- expect(work_package.subject).to eq('Other subject!')
+ expect(work_package.subject).to eq("Other subject!")
expect(work_package.status.id).to eq(status2.id)
end
- it 'provides error handling' do
+ it "provides error handling" do
subject_field = wp_table.edit_field(work_package, :subject)
- subject_field.expect_text('Foobar')
+ subject_field.expect_text("Foobar")
subject_field.activate!
- subject_field.set_value('')
+ subject_field.set_value("")
subject_field.expect_invalid
subject_field.save!
- expect(work_package.reload.subject).to eq 'Foobar'
+ expect(work_package.reload.subject).to eq "Foobar"
end
end
- context 'custom field' do
+ context "custom field" do
let!(:custom_fields) do
fields = [
create(
:work_package_custom_field,
- field_format: 'list',
+ field_format: "list",
possible_values: %w(foo bar xyz),
is_required: false,
is_for_all: false,
@@ -124,7 +124,7 @@
),
create(
:work_package_custom_field,
- field_format: 'string',
+ field_format: "string",
is_required: false,
is_for_all: false,
types: [type],
@@ -138,7 +138,7 @@
let(:project) { create(:project, types: [type]) }
let!(:work_package) do
create(:work_package,
- subject: 'Foobar',
+ subject: "Foobar",
status: status1,
type:,
project:)
@@ -155,12 +155,12 @@
wp_table.expect_work_package_listed(work_package)
end
- it 'opens required custom fields when not set' do
+ it "opens required custom fields when not set" do
subject_field = wp_table.edit_field(work_package, :subject)
- subject_field.expect_text('Foobar')
+ subject_field.expect_text("Foobar")
subject_field.activate!
- subject_field.set_value('New subject!')
+ subject_field.set_value("New subject!")
subject_field.save!
# Should raise two errors
@@ -171,28 +171,28 @@
message: "#{cf_list_name} can't be blank.\n#{cf_text_name} can't be blank."
)
- expect(page).to have_css('th a', text: cf_list_name.upcase)
- expect(page).to have_css('th a', text: cf_text_name.upcase)
- expect(wp_table.row(work_package)).to have_css('.wp-table--cell-container.-error', count: 2)
+ expect(page).to have_css("th a", text: cf_list_name.upcase)
+ expect(page).to have_css("th a", text: cf_text_name.upcase)
+ expect(wp_table.row(work_package)).to have_css(".wp-table--cell-container.-error", count: 2)
cf_text = wp_table.edit_field(work_package, custom_fields.last.attribute_name(:camel_case))
- cf_text.update('my custom text', expect_failure: true)
+ cf_text.update("my custom text", expect_failure: true)
cf_list = wp_table.edit_field(work_package, custom_fields.first.attribute_name(:camel_case))
- cf_list.field_type = 'create-autocompleter'
+ cf_list.field_type = "create-autocompleter"
cf_list.openSelectField
- cf_list.set_value('bar')
+ cf_list.set_value("bar")
cf_text.expect_inactive!
cf_list.expect_inactive!
wp_table.expect_toast(
- message: 'Successful update. Click here to open this work package in fullscreen view.'
+ message: "Successful update. Click here to open this work package in fullscreen view."
)
work_package.reload
- expect(work_package.send(custom_fields.first.attribute_getter)).to eq('bar')
- expect(work_package.send(custom_fields.last.attribute_getter)).to eq('my custom text')
+ expect(work_package.send(custom_fields.first.attribute_getter)).to eq("bar")
+ expect(work_package.send(custom_fields.last.attribute_getter)).to eq("my custom text")
# Saveguard to let the background update complete
wp_table.visit!
diff --git a/spec/features/work_packages/table/empty_filters_spec.rb b/spec/features/work_packages/table/empty_filters_spec.rb
index 8053a2766181..cb9a70163369 100644
--- a/spec/features/work_packages/table/empty_filters_spec.rb
+++ b/spec/features/work_packages/table/empty_filters_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Empty query filters', :js do
+RSpec.describe "Empty query filters", :js do
let(:user) { create(:admin) }
let(:work_package) { create(:work_package) }
let(:wp_table) { Pages::WorkPackagesTable.new }
@@ -14,7 +14,7 @@
end
# Tests for regression #23739
- it 'allows to delete the last query filter' do
+ it "allows to delete the last query filter" do
# Open filter menu
filters.expect_filter_count(1)
filters.open
diff --git a/spec/features/work_packages/table/group_by/group_by_boolean_spec.rb b/spec/features/work_packages/table/group_by/group_by_boolean_spec.rb
index bea6f49e021e..881cace61ab1 100644
--- a/spec/features/work_packages/table/group_by/group_by_boolean_spec.rb
+++ b/spec/features/work_packages/table/group_by/group_by_boolean_spec.rb
@@ -1,10 +1,10 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package group by boolean field', :js do
+RSpec.describe "Work Package group by boolean field", :js do
let(:user) { create(:admin) }
let(:project) { create(:project, types: [type], work_package_custom_fields: [bool_cf]) }
- let(:bool_cf) { create(:boolean_wp_custom_field, name: 'booleanField', types: [type]) }
+ let(:bool_cf) { create(:boolean_wp_custom_field, name: "booleanField", types: [type]) }
let(:type) { create(:type) }
let!(:wp1) { create(:work_package, project:, type:) }
@@ -20,15 +20,15 @@
wp_table.expect_work_package_listed wp1, wp2, wp3
end
- it 'shows group headers for groups by bool cf (regression test #34904)' do
+ it "shows group headers for groups by bool cf (regression test #34904)" do
# Group by category
- group_by.enable_via_menu 'booleanField'
+ group_by.enable_via_menu "booleanField"
loading_indicator_saveguard
# Expect table to be grouped
group_by.expect_number_of_groups 3
- group_by.expect_grouped_by_value '-', 1
- group_by.expect_grouped_by_value 'true', 1
- group_by.expect_grouped_by_value 'false', 1
+ group_by.expect_grouped_by_value "-", 1
+ group_by.expect_grouped_by_value "true", 1
+ group_by.expect_grouped_by_value "false", 1
end
end
diff --git a/spec/features/work_packages/table/group_by/group_by_progress_spec.rb b/spec/features/work_packages/table/group_by/group_by_progress_spec.rb
index 9fdbe3a8e908..fdf97f538e20 100644
--- a/spec/features/work_packages/table/group_by/group_by_progress_spec.rb
+++ b/spec/features/work_packages/table/group_by/group_by_progress_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package group by progress', :js do
+RSpec.describe "Work Package group by progress", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -15,7 +15,7 @@
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['subject', 'done_ratio']
+ query.column_names = ["subject", "done_ratio"]
query.save!
query
@@ -28,39 +28,39 @@
wp_table.expect_work_package_listed wp_1, wp_2, wp_3, wp_4
end
- it 'shows group headers for group by progress (regression test #26717)' do
+ it "shows group headers for group by progress (regression test #26717)" do
# Group by category
- group_by.enable_via_menu '% Complete'
+ group_by.enable_via_menu "% Complete"
# Expect table to be grouped as WP created above
group_by.expect_number_of_groups 3
- group_by.expect_grouped_by_value '0%', 1
- group_by.expect_grouped_by_value '10%', 2
- group_by.expect_grouped_by_value '50%', 1
+ group_by.expect_grouped_by_value "0%", 1
+ group_by.expect_grouped_by_value "10%", 2
+ group_by.expect_grouped_by_value "50%", 1
# Update category of wp_none
cat = wp_table.edit_field(wp_1, :percentageDone)
- cat.update '50'
+ cat.update "50"
loading_indicator_saveguard
# Expect changed groups
group_by.expect_number_of_groups 2
- group_by.expect_grouped_by_value '10%', 2
- group_by.expect_grouped_by_value '50%', 2
+ group_by.expect_grouped_by_value "10%", 2
+ group_by.expect_grouped_by_value "50%", 2
end
- context 'with grouped query' do
+ context "with grouped query" do
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['subject', 'done_ratio']
- query.group_by = 'done_ratio'
+ query.column_names = ["subject", "done_ratio"]
+ query.group_by = "done_ratio"
query.save!
query
end
- it 'keeps the disabled group by when reloading (Regression WP#26778)' do
+ it "keeps the disabled group by when reloading (Regression WP#26778)" do
# Expect table to be grouped as WP created above
group_by.expect_number_of_groups 3
@@ -73,7 +73,7 @@
# But query has not been changed
query.reload
- expect(query.group_by).to eq 'done_ratio'
+ expect(query.group_by).to eq "done_ratio"
end
end
end
diff --git a/spec/features/work_packages/table/group_by/group_by_spec.rb b/spec/features/work_packages/table/group_by/group_by_spec.rb
index b9b0fb6cbb01..7eff288e4f81 100644
--- a/spec/features/work_packages/table/group_by/group_by_spec.rb
+++ b/spec/features/work_packages/table/group_by/group_by_spec.rb
@@ -28,9 +28,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package group by progress', :js do
+RSpec.describe "Work Package group by progress", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:group_by) { Components::WorkPackages::GroupBy.new }
@@ -49,6 +49,6 @@
# Expect table to be grouped into 1 group
group_by.expect_number_of_groups 1
- group_by.expect_grouped_by_value '0%', 3
+ group_by.expect_grouped_by_value "0%", 3
end
end
diff --git a/spec/features/work_packages/table/group_by/group_headers_spec.rb b/spec/features/work_packages/table/group_by/group_headers_spec.rb
index 37e32290854c..b215e7a89565 100644
--- a/spec/features/work_packages/table/group_by/group_headers_spec.rb
+++ b/spec/features/work_packages/table/group_by/group_headers_spec.rb
@@ -1,11 +1,11 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table group headers', :js do
+RSpec.describe "Work Package table group headers", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
- let(:category) { create(:category, project:, name: 'Foo') }
- let(:category2) { create(:category, project:, name: 'Bar') }
+ let(:category) { create(:category, project:, name: "Foo") }
+ let(:category2) { create(:category, project:, name: "Bar") }
let!(:wp_cat1) { create(:work_package, project:, category:) }
let!(:wp_cat2) { create(:work_package, project:, category: category2) }
@@ -15,7 +15,7 @@
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['subject', 'category']
+ query.column_names = ["subject", "category"]
query.show_hierarchies = false
query.save!
@@ -31,26 +31,26 @@
wp_table.expect_work_package_listed(wp_none)
end
- it 'shows group headers for group by category' do
+ it "shows group headers for group by category" do
# Group by category
- group_by.enable_via_menu 'Category'
+ group_by.enable_via_menu "Category"
# Expect table to be grouped as WP created above
group_by.expect_number_of_groups 3
- group_by.expect_grouped_by_value 'Foo', 1
- group_by.expect_grouped_by_value 'Bar', 1
- group_by.expect_grouped_by_value '-', 1
+ group_by.expect_grouped_by_value "Foo", 1
+ group_by.expect_grouped_by_value "Bar", 1
+ group_by.expect_grouped_by_value "-", 1
# Update category of wp_none
cat = wp_table.edit_field(wp_none, :category)
cat.activate!
- cat.set_value 'Foo'
+ cat.set_value "Foo"
loading_indicator_saveguard
# Expect changed groups
group_by.expect_number_of_groups 2
- group_by.expect_grouped_by_value 'Foo', 2
- group_by.expect_grouped_by_value 'Bar', 1
+ group_by.expect_grouped_by_value "Foo", 2
+ group_by.expect_grouped_by_value "Bar", 1
end
end
diff --git a/spec/features/work_packages/table/hierarchy/hierarchy_indent_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_indent_spec.rb
index 50e7bfc931fb..aef59c3dd233 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_indent_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_indent_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table hierarchy and sorting', :js, :with_cuprite do
+RSpec.describe "Work Package table hierarchy and sorting", :js, :with_cuprite do
shared_let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -10,33 +10,33 @@
shared_let(:wp_root) do
create(:work_package,
project:,
- subject: 'Parent')
+ subject: "Parent")
end
shared_let(:wp_child1) do
create(:work_package,
project:,
parent: wp_root,
- subject: 'WP child 1')
+ subject: "WP child 1")
end
shared_let(:wp_child2) do
create(:work_package,
project:,
parent: wp_root,
- subject: 'WP child 2')
+ subject: "WP child 2")
end
shared_let(:wp_child3) do
create(:work_package,
project:,
parent: wp_root,
- subject: 'WP child 3')
+ subject: "WP child 3")
end
shared_current_user { create(:admin) }
- it 'can indent hierarchies' do
+ it "can indent hierarchies" do
wp_table.visit!
wp_table.expect_work_package_listed(wp_root, wp_child1, wp_child2, wp_child3)
hierarchy.expect_hierarchy_at(wp_root)
@@ -51,7 +51,7 @@
# Indent last child
hierarchy.indent! wp_child3
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
hierarchy.expect_hierarchy_at(wp_root, wp_child2)
hierarchy.expect_leaf_at(wp_child1, wp_child3)
@@ -69,33 +69,33 @@
expect(wp_child3.parent).to eq(wp_child2)
end
- it 'can edit a work package, then indent, and then edit again (Regression #30994)' do
+ it "can edit a work package, then indent, and then edit again (Regression #30994)" do
wp_table.visit!
wp_table.expect_work_package_listed(wp_root, wp_child1, wp_child2, wp_child3)
hierarchy.expect_hierarchy_at(wp_root)
hierarchy.expect_leaf_at(wp_child1, wp_child2, wp_child3)
subject = wp_table.edit_field(wp_child3, :subject)
- subject.update 'First edit'
+ subject.update "First edit"
wait_for_network_idle
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
# Indent last child
hierarchy.indent! wp_child3
wait_for_network_idle
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
# Expect changed
hierarchy.expect_hierarchy_at(wp_root, wp_child2)
hierarchy.expect_leaf_at(wp_child1, wp_child3)
subject = wp_table.edit_field(wp_child3, :subject)
- subject.update 'Second edit'
+ subject.update "Second edit"
wait_for_network_idle
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
wp_child3.reload
- expect(wp_child3.subject).to eq 'Second edit'
+ expect(wp_child3.subject).to eq "Second edit"
expect(wp_child3.parent).to eq wp_child2
end
end
diff --git a/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb
index cfacef7ab2fd..75ff409c095e 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table hierarchy parent below', :js do
+RSpec.describe "Work Package table hierarchy parent below", :js do
let(:user) { create(:admin) }
let(:type_bug) { create(:type_bug) }
let(:type_task) { create(:type_task) }
@@ -33,17 +33,17 @@
# .. V Parent
# .... Child
# V Grandparent
- describe 'grand-parent sorted below child, parent invisible' do
+ describe "grand-parent sorted below child, parent invisible" do
let(:child) { create(:work_package, project:, type: type_task) }
let(:parent) { create(:work_package, project:, type: type_bug) }
let(:grandparent) { create(:work_package, project:, type: type_task) }
let(:query) do
query = build(:query, user:, project:)
- query.column_names = ['id', 'subject', 'type']
+ query.column_names = ["id", "subject", "type"]
query.sort_criteria = [%w(id asc)]
query.filters.clear
- query.add_filter('type_id', '=', [type_task.id])
+ query.add_filter("type_id", "=", [type_task.id])
query.show_hierarchies = true
query.save!
@@ -61,7 +61,7 @@
query
end
- it 'shows hierarchy correctly' do
+ it "shows hierarchy correctly" do
wp_table.visit_query query
wp_table.expect_work_package_listed(child, parent, grandparent)
@@ -93,11 +93,11 @@
end
end
- describe 'grand-parent of 2+ children visible anywhere on the page, but parent is not (Regression #29652)' do
- let(:child) { create(:work_package, subject: 'AA Child WP', project:, type: type_task) }
- let(:child2) { create(:work_package, subject: 'BB Child WP', project:, type: type_task) }
- let(:parent) { create(:work_package, subject: 'ZZ Parent WP', project:, type: type_task) }
- let(:grandparent) { create(:work_package, subject: 'Grandparent', project:, type: type_task) }
+ describe "grand-parent of 2+ children visible anywhere on the page, but parent is not (Regression #29652)" do
+ let(:child) { create(:work_package, subject: "AA Child WP", project:, type: type_task) }
+ let(:child2) { create(:work_package, subject: "BB Child WP", project:, type: type_task) }
+ let(:parent) { create(:work_package, subject: "ZZ Parent WP", project:, type: type_task) }
+ let(:grandparent) { create(:work_package, subject: "Grandparent", project:, type: type_task) }
let(:query) do
query = build(:query, user:, project:)
@@ -118,20 +118,20 @@
child2.update(parent_id: parent.id)
parent.update(parent_id: grandparent.id)
- allow(Setting).to receive(:per_page_options).and_return '3'
+ allow(Setting).to receive(:per_page_options).and_return "3"
query
end
- it 'shows hierarchy correctly' do
+ it "shows hierarchy correctly" do
wp_table.visit_query query
wp_table.expect_work_package_listed(child, child2, parent, grandparent)
# Expect pagination to be correct
- expect(page).to have_css('.op-pagination--item_current', text: '3')
+ expect(page).to have_css(".op-pagination--item_current", text: "3")
# Expect count to be correct (one additional parent shown)
- expect(page).to have_css('.wp--row', count: 4)
+ expect(page).to have_css(".wp--row", count: 4)
# Double order result from regression
wp_table.expect_work_package_order(grandparent.id, parent.id, child.id, child2.id)
@@ -142,9 +142,9 @@
end
end
- describe 'An arrow is beside parent name' do
- let(:child) { create(:work_package, subject: 'AA Child WP', project:, parent:) }
- let(:parent) { create(:work_package, subject: 'ZZ Parent WP', project:) }
+ describe "An arrow is beside parent name" do
+ let(:child) { create(:work_package, subject: "AA Child WP", project:, parent:) }
+ let(:parent) { create(:work_package, subject: "ZZ Parent WP", project:) }
let(:relations) { Components::WorkPackages::Relations.new(parent) }
before do
@@ -155,14 +155,14 @@
wp_table.visit!
wp_table.expect_work_package_listed(child, parent)
- expect(page).to have_css('.wp-table--hierarchy-indicator-icon')
+ expect(page).to have_css(".wp-table--hierarchy-indicator-icon")
split_page = wp_table.open_split_view(parent)
split_page.visit_tab!("relations")
relations.remove_child(child)
loading_indicator_saveguard
- expect(page).to have_no_css('.wp-table--hierarchy-indicator-icon')
+ expect(page).to have_no_css(".wp-table--hierarchy-indicator-icon")
end
end
end
diff --git a/spec/features/work_packages/table/hierarchy/hierarchy_sorting_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_sorting_spec.rb
index 705b0fb5a6b4..a36c81e3e81c 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_sorting_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_sorting_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table hierarchy and sorting', :js do
+RSpec.describe "Work Package table hierarchy and sorting", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -11,7 +11,7 @@
let!(:wp_root) do
create(:work_package,
project:,
- subject: 'Parent',
+ subject: "Parent",
start_date: 10.days.ago,
due_date: Date.current)
end
@@ -20,7 +20,7 @@
create(:work_package,
project:,
parent: wp_root,
- subject: 'Child at end',
+ subject: "Child at end",
start_date: 2.days.ago,
due_date: Date.current)
end
@@ -29,7 +29,7 @@
create(:work_package,
project:,
parent: wp_root,
- subject: 'Middle child',
+ subject: "Middle child",
start_date: 5.days.ago,
due_date: 3.days.ago)
end
@@ -38,7 +38,7 @@
create(:work_package,
project:,
parent: wp_root,
- subject: 'Child at beginning',
+ subject: "Child at beginning",
start_date: 10.days.ago,
due_date: 9.days.ago)
end
@@ -47,7 +47,7 @@
login_as(user)
end
- it 'can show hierarchies and sort by start_date' do
+ it "can show hierarchies and sort by start_date" do
wp_table.visit!
wp_table.expect_work_package_listed(wp_root, wp_child1, wp_child2, wp_child3)
hierarchy.expect_hierarchy_at(wp_root)
@@ -57,7 +57,7 @@
wp_table.expect_work_package_order wp_root, wp_child1, wp_child2, wp_child3
# Enable sort by start date
- sort_by.update_criteria ['Start date', 'asc']
+ sort_by.update_criteria ["Start date", "asc"]
loading_indicator_saveguard
# Hierarchy still exists
diff --git a/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb
index d1e3a8d0b35a..04bd7c2b2306 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table hierarchy', :js do
+RSpec.describe "Work Package table hierarchy", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -11,8 +11,8 @@
login_as(user)
end
- describe 'hierarchies in same project' do
- let(:category) { create(:category, project:, name: 'Foo') }
+ describe "hierarchies in same project" do
+ let(:category) { create(:category, project:, name: "Foo") }
let!(:wp_root) { create(:work_package, project:) }
let!(:wp_inter) { create(:work_package, project:, parent: wp_root) }
@@ -21,16 +21,16 @@
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['subject', 'category']
+ query.column_names = ["subject", "category"]
query.filters.clear
- query.add_filter('category_id', '=', [category.id])
+ query.add_filter("category_id", "=", [category.id])
query.show_hierarchies = true
query.save!
query
end
- it 'shows hierarchy correctly' do
+ it "shows hierarchy correctly" do
wp_table.visit!
wp_table.expect_work_package_listed(wp_root, wp_inter, wp_leaf, wp_other)
@@ -57,9 +57,9 @@
# Editing is possible while retaining hierarchy
hierarchy.enable_hierarchy
subject = wp_table.edit_field wp_inter, :subject
- subject.update 'New subject'
+ subject.update "New subject"
- wp_table.expect_toast message: 'Successful update.'
+ wp_table.expect_toast message: "Successful update."
wp_table.dismiss_toaster!
hierarchy.expect_hierarchy_at(wp_root, wp_inter)
@@ -88,13 +88,13 @@
end
end
- describe 'with a cross project hierarchy' do
+ describe "with a cross project hierarchy" do
let(:project2) { create(:project) }
let!(:wp_root) { create(:work_package, project:) }
let!(:wp_inter) { create(:work_package, project: project2, parent: wp_root) }
let(:global_table) { Pages::WorkPackagesTable.new }
- it 'shows the hierarchy indicator only when the rows are both shown' do
+ it "shows the hierarchy indicator only when the rows are both shown" do
wp_table.visit!
wp_table.expect_work_package_listed(wp_root)
wp_table.ensure_work_package_not_listed!(wp_inter)
@@ -108,23 +108,23 @@
end
end
- describe 'flat table such that the parent appears below the child' do
+ describe "flat table such that the parent appears below the child" do
let!(:wp_root) { create(:work_package, project:) }
let!(:wp_inter) { create(:work_package, project:, parent: wp_root) }
let!(:wp_leaf) { create(:work_package, project:, parent: wp_inter) }
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['subject', 'category']
+ query.column_names = ["subject", "category"]
query.filters.clear
query.show_hierarchies = false
- query.sort_criteria = [['id', 'asc']]
+ query.sort_criteria = [["id", "asc"]]
query.save!
query
end
- it 'removes the parent from the flow in hierarchy mode, moving it above' do
+ it "removes the parent from the flow in hierarchy mode, moving it above" do
# Hierarchy disabled, expect wp_inter before wp_root
wp_table.visit_query query
wp_table.expect_work_package_listed(wp_inter, wp_root, wp_leaf)
@@ -136,7 +136,7 @@
hierarchy.enable_hierarchy
# Should not be marked as additional row (grey)
- expect(page).to have_no_css('.wp-table--hierarchy-aditional-row')
+ expect(page).to have_no_css(".wp-table--hierarchy-aditional-row")
hierarchy.expect_hierarchy_at(wp_root, wp_inter)
hierarchy.expect_leaf_at(wp_leaf)
@@ -154,25 +154,25 @@
end
end
- describe 'sorting by assignee' do
- include_context 'work package table helpers'
+ describe "sorting by assignee" do
+ include_context "work package table helpers"
let(:root_assigned) do
- create(:work_package, subject: 'root_assigned', project:, assigned_to: user)
+ create(:work_package, subject: "root_assigned", project:, assigned_to: user)
end
let(:inter_assigned) do
- create(:work_package, subject: 'inter_assigned', project:, assigned_to: user, parent: root_assigned)
+ create(:work_package, subject: "inter_assigned", project:, assigned_to: user, parent: root_assigned)
end
let(:inter) do
- create(:work_package, subject: 'inter', project:, parent: root_assigned)
+ create(:work_package, subject: "inter", project:, parent: root_assigned)
end
let(:leaf_assigned) do
- create(:work_package, subject: 'leaf_assigned', project:, assigned_to: user, parent: inter)
+ create(:work_package, subject: "leaf_assigned", project:, assigned_to: user, parent: inter)
end
let(:leaf) do
- create(:work_package, subject: 'leaf', project:, parent: inter)
+ create(:work_package, subject: "leaf", project:, parent: inter)
end
let(:root) do
- create(:work_package, subject: 'root', project:)
+ create(:work_package, subject: "root", project:)
end
let(:user) do
@@ -185,9 +185,9 @@
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['id', 'subject', 'assigned_to']
+ query.column_names = ["id", "subject", "assigned_to"]
query.filters.clear
- query.sort_criteria = [['assigned_to', 'asc'], ['id', 'asc']]
+ query.sort_criteria = [["assigned_to", "asc"], ["id", "asc"]]
query.show_hierarchies = false
query.save!
@@ -205,7 +205,7 @@
leaf_assigned
end
- it 'shows the respective order' do
+ it "shows the respective order" do
wp_table.visit_query query
wp_table.expect_work_package_listed(leaf, inter, root)
wp_table.expect_work_package_listed(leaf_assigned, inter_assigned, root_assigned)
@@ -250,7 +250,7 @@
hierarchy.toggle_row(root_assigned)
# Sort descending
- sort_by.update_criteria(['Assignee', { descending: true }])
+ sort_by.update_criteria(["Assignee", { descending: true }])
loading_indicator_saveguard
wp_table.expect_work_package_listed(root, root_assigned)
diff --git a/spec/features/work_packages/table/hierarchy/hierarchy_vs_grouping_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_vs_grouping_spec.rb
index 9e2f4f2a0e32..252976d4107a 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_vs_grouping_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_vs_grouping_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table hierarchy vs grouping', :js do
+RSpec.describe "Work Package table hierarchy vs grouping", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -40,25 +40,25 @@
login_as(user)
end
- it 'is mutually exclusive' do
+ it "is mutually exclusive" do
wp_table.visit!
hierarchy.expect_mode_enabled
- group_by.enable_via_header('Type')
+ group_by.enable_via_header("Type")
hierarchy.expect_mode_disabled
hierarchy.enable_via_menu
- group_by.expect_not_grouped_by('Type')
+ group_by.expect_not_grouped_by("Type")
- group_by.enable_via_menu('Type')
+ group_by.enable_via_menu("Type")
hierarchy.expect_mode_disabled
hierarchy.enable_via_header
- group_by.expect_not_grouped_by('Type')
+ group_by.expect_not_grouped_by("Type")
end
end
diff --git a/spec/features/work_packages/table/hierarchy/parent_column_spec.rb b/spec/features/work_packages/table/hierarchy/parent_column_spec.rb
index e4bf762a997d..a29da2d2bb0c 100644
--- a/spec/features/work_packages/table/hierarchy/parent_column_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/parent_column_spec.rb
@@ -1,13 +1,13 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table parent column', :js do
+RSpec.describe "Work Package table parent column", :js do
let(:user) { create(:admin) }
let!(:parent) { create(:work_package, project:) }
let!(:child) { create(:work_package, project:, parent:) }
let!(:other_wp) { create(:work_package, project:) }
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['subject', 'parent']
+ query.column_names = ["subject", "parent"]
query.filters.clear
query.show_hierarchies = false
@@ -22,28 +22,28 @@
login_as(user)
end
- it 'shows parent columns correctly (Regression #26951)' do
+ it "shows parent columns correctly (Regression #26951)" do
wp_table.visit_query query
wp_table.expect_work_package_listed(parent, child)
# Hierarchy mode is enabled by default
page.within(".wp-row-#{parent.id}") do
- expect(page).to have_css('td.parent', text: '-')
+ expect(page).to have_css("td.parent", text: "-")
end
page.within(".wp-row-#{child.id}") do
- expect(page).to have_css('td.parent', text: "##{parent.id}")
+ expect(page).to have_css("td.parent", text: "##{parent.id}")
end
end
- it 'can edit the parent work package (Regression #43647)' do
+ it "can edit the parent work package (Regression #43647)" do
wp_table.visit_query query
wp_table.expect_work_package_listed(parent, child)
parent_field = wp_table.edit_field(child, :parent)
parent_field.update other_wp.subject
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
child.reload
expect(child.parent).to eq other_wp
diff --git a/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb b/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb
index 8450cc93b072..4bcbd45d2a71 100644
--- a/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb
+++ b/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'inline create work package', :js do
+RSpec.describe "inline create work package", :js do
let(:type) { create(:type) }
let(:types) { [type] }
@@ -28,67 +28,67 @@
login_as user
end
- shared_examples 'inline create work package' do
- context 'when user may create work packages' do
- it 'allows to create work packages' do
+ shared_examples "inline create work package" do
+ context "when user may create work packages" do
+ it "allows to create work packages" do
wp_table.expect_work_package_listed(existing_wp)
wp_table.click_inline_create
- expect(page).to have_css('.wp--row', count: 2)
- expect(page).to have_css('.wp-inline-create-row')
- expect(page).to have_focus_on('#wp-new-inline-edit--field-subject')
+ expect(page).to have_css(".wp--row", count: 2)
+ expect(page).to have_css(".wp-inline-create-row")
+ expect(page).to have_focus_on("#wp-new-inline-edit--field-subject")
# Expect subject to be activated
subject_field = wp_table.edit_field(nil, :subject)
subject_field.expect_active!
- subject_field.set_value 'Some subject'
+ subject_field.set_value "Some subject"
subject_field.save!
# Callback for adjustments
callback.call
wp_table.expect_toast(
- message: 'Successful creation. Click here to open this work package in fullscreen view.'
+ message: "Successful creation. Click here to open this work package in fullscreen view."
)
# Expect new create row to exist
- expect(page).to have_css('.wp--row', count: 2)
- expect(page).to have_button(exact_text: 'Create new work package')
+ expect(page).to have_css(".wp--row", count: 2)
+ expect(page).to have_button(exact_text: "Create new work package")
wp_table.click_inline_create
subject_field = wp_table.edit_field(nil, :subject)
subject_field.expect_active!
- subject_field.set_value 'Another subject'
+ subject_field.set_value "Another subject"
subject_field.save!
# Callback for adjustments
callback.call
- expect(page).to have_css('.wp--row .subject', text: 'Some subject')
- expect(page).to have_css('.wp--row .subject', text: 'Another subject')
+ expect(page).to have_css(".wp--row .subject", text: "Some subject")
+ expect(page).to have_css(".wp--row .subject", text: "Another subject")
# safeguards
wp_table.dismiss_toaster!
wp_table.expect_no_toaster(
- message: 'Successful update. Click here to open this work package in fullscreen view.'
+ message: "Successful update. Click here to open this work package in fullscreen view."
)
# Expect no inline create open
- expect(page).to have_no_css('.wp-inline-create-row')
+ expect(page).to have_no_css(".wp-inline-create-row")
end
end
- context 'when user may not create work packages' do
+ context "when user may not create work packages" do
let(:permissions) { [:view_work_packages] }
- it 'renders the work package, but no create row' do
+ it "renders the work package, but no create row" do
wp_table.expect_work_package_listed(existing_wp)
- expect(page).to have_no_button(exact_text: 'Create new work package')
+ expect(page).to have_no_button(exact_text: "Create new work package")
end
end
- context 'when having filtered by custom field and switching to that type' do
+ context "when having filtered by custom field and switching to that type" do
let(:cf_list) do
create(:list_wp_custom_field, is_for_all: true, is_filter: true)
end
@@ -98,10 +98,10 @@
let(:cf_type) { create(:type, custom_fields: [cf_list]) }
let(:columns) { Components::WorkPackages::Columns.new }
- it 'applies the filter value for the custom field' do
+ it "applies the filter value for the custom field" do
wp_table.visit!
filters.open
- filters.add_filter_by cf_list.name, 'is (OR)', cf_list.custom_options.second.name, cf_accessor_frontend
+ filters.add_filter_by cf_list.name, "is (OR)", cf_list.custom_options.second.name, cf_accessor_frontend
sleep(0.3)
@@ -118,16 +118,16 @@
wp_table.expect_toast(
type: :error,
- message: 'Subject can\'t be blank.'
+ message: "Subject can't be blank."
)
subject_field = wp_table.edit_field(nil, :subject)
subject_field.expect_active!
- subject_field.set_value 'Some subject'
+ subject_field.set_value "Some subject"
subject_field.save!
wp_table.expect_toast(
- message: 'Successful creation. Click here to open this work package in fullscreen view.'
+ message: "Successful creation. Click here to open this work package in fullscreen view."
)
created_wp = WorkPackage.last
@@ -138,14 +138,14 @@
end
end
- describe 'global create' do
+ describe "global create" do
let(:wp_table) { Pages::WorkPackagesTable.new }
before do
wp_table.visit!
end
- it_behaves_like 'inline create work package' do
+ it_behaves_like "inline create work package" do
let(:callback) do
-> {
# Set project which will also select the type (first one in the selected project)
@@ -159,20 +159,20 @@
end
end
- describe 'project context create' do
+ describe "project context create" do
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
before do
wp_table.visit!
end
- it_behaves_like 'inline create work package' do
+ it_behaves_like "inline create work package" do
let(:callback) do
-> {}
end
end
- context 'when user has permissions in other project' do
+ context "when user has permissions in other project" do
let(:permissions) { [:view_work_packages] }
let(:project2) { create(:project) }
@@ -188,10 +188,10 @@
roles: [role2])
end
- it 'renders the work packages, but no create' do
+ it "renders the work packages, but no create" do
wp_table.expect_work_package_listed(existing_wp)
- expect(page).to have_no_button(exact_text: 'Create new work package')
- expect(page).to have_css('.add-work-package[disabled]')
+ expect(page).to have_no_button(exact_text: "Create new work package")
+ expect(page).to have_css(".add-work-package[disabled]")
end
end
end
diff --git a/spec/features/work_packages/table/inline_create/inline_create_refresh_spec.rb b/spec/features/work_packages/table/inline_create/inline_create_refresh_spec.rb
index 84cbcd892863..9d362f9a59a0 100644
--- a/spec/features/work_packages/table/inline_create/inline_create_refresh_spec.rb
+++ b/spec/features/work_packages/table/inline_create/inline_create_refresh_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Refreshing in inline-create row', :flaky, :js do
+RSpec.describe "Refreshing in inline-create row", :flaky, :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -10,7 +10,7 @@
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['subject', 'category']
+ query.column_names = ["subject", "category"]
query.filters.clear
query.save!
@@ -22,17 +22,17 @@
wp_table.visit_query(query)
end
- it 'correctly updates the set of active columns' do
- expect(page).to have_css('.wp--row', count: 0)
+ it "correctly updates the set of active columns" do
+ expect(page).to have_css(".wp--row", count: 0)
wp_table.click_inline_create
- expect(page).to have_css('.wp--row', count: 1)
+ expect(page).to have_css(".wp--row", count: 1)
- expect(page).to have_css('.wp-inline-create-row')
- expect(page).to have_css('.wp-inline-create-row .wp-table--cell-td.subject')
- expect(page).to have_css('.wp-inline-create-row .wp-table--cell-td.category')
+ expect(page).to have_css(".wp-inline-create-row")
+ expect(page).to have_css(".wp-inline-create-row .wp-table--cell-td.subject")
+ expect(page).to have_css(".wp-inline-create-row .wp-table--cell-td.category")
- columns.add '% Complete'
- expect(page).to have_css('.wp-inline-create-row .wp-table--cell-td.wp-table--cell-td.percentageDone')
+ columns.add "% Complete"
+ expect(page).to have_css(".wp-inline-create-row .wp-table--cell-td.wp-table--cell-td.percentageDone")
end
end
diff --git a/spec/features/work_packages/table/inline_create/parallel_creation_spec.rb b/spec/features/work_packages/table/inline_create/parallel_creation_spec.rb
index 0e9b73355720..aa26dda79bc5 100644
--- a/spec/features/work_packages/table/inline_create/parallel_creation_spec.rb
+++ b/spec/features/work_packages/table/inline_create/parallel_creation_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Parallel work package creation spec', :js do
+RSpec.describe "Parallel work package creation spec", :js do
let(:type) { project.types.first }
let(:permissions) { %i(view_work_packages add_work_packages edit_work_packages) }
@@ -35,39 +35,39 @@ def new_work_package_in_both(subject, description)
# Create in split screen
split = wp_table.create_wp_by_button type
- description_field = TextEditorField.new split, 'description'
+ description_field = TextEditorField.new split, "description"
description_field.expect_active!
description_field.set_value description
end
- it 'with a new work package in split and inline create, both are saved' do
+ it "with a new work package in split and inline create, both are saved" do
# Expect table to be empty
wp_table.visit!
wp_table.expect_no_work_package_listed
# Open split screen and inline create
- new_work_package_in_both 'Some subject', 'My description!'
+ new_work_package_in_both "Some subject", "My description!"
# Save in inline create
- expect(page).to have_css('.wp-inline-create-row')
- expect(page).to have_css('.wp--row', count: 1)
+ expect(page).to have_css(".wp-inline-create-row")
+ expect(page).to have_css(".wp--row", count: 1)
subject_field = wp_table.edit_field(nil, :subject)
subject_field.save!
# There should be one row, and no open inline create row
- expect(page).to have_css('.wp--row', count: 1)
- expect(page).to have_no_css('.wp-inline-create-row')
+ expect(page).to have_css(".wp--row", count: 1)
+ expect(page).to have_no_css(".wp-inline-create-row")
wp_table.expect_toast(
- message: 'Successful creation. Click here to open this work package in fullscreen view.'
+ message: "Successful creation. Click here to open this work package in fullscreen view."
)
wp_table.dismiss_toaster!
# Get the last work package
wp1 = WorkPackage.last
- expect(wp1.subject).to eq 'Some subject'
- expect(wp1.description).to eq 'My description!'
+ expect(wp1.subject).to eq "Some subject"
+ expect(wp1.description).to eq "My description!"
wp_table.expect_work_package_listed wp1
@@ -75,31 +75,31 @@ def new_work_package_in_both(subject, description)
created_split = Pages::SplitWorkPackage.new wp1, project
subject_field = created_split.edit_field :subject
subject_field.expect_inactive!
- subject_field.expect_state_text 'Some subject'
+ subject_field.expect_state_text "Some subject"
# Open split screen and inline create
- new_work_package_in_both 'New subject', 'New description'
+ new_work_package_in_both "New subject", "New description"
# Inline create still open
- expect(page).to have_css('.wp-inline-create-row')
+ expect(page).to have_css(".wp-inline-create-row")
# Save in split screen
new_split = Pages::SplitWorkPackageCreate.new(project:)
subject_field = new_split.edit_field :subject
subject_field.expect_active!
- subject_field.expect_value 'New subject'
+ subject_field.expect_value "New subject"
subject_field.save!
wp_table.expect_toast(
- message: 'Successful creation.'
+ message: "Successful creation."
)
wp_table.dismiss_toaster!
- expect(page).to have_css('.wp--row', count: 2)
- expect(page).to have_no_css('.wp-inline-create-row')
+ expect(page).to have_css(".wp--row", count: 2)
+ expect(page).to have_no_css(".wp-inline-create-row")
# Get the last work package
wp2 = WorkPackage.last
- expect(wp2.subject).to eq 'New subject'
- expect(wp2.description).to eq 'New description'
+ expect(wp2.subject).to eq "New subject"
+ expect(wp2.description).to eq "New description"
end
end
diff --git a/spec/features/work_packages/table/invalid_query_spec.rb b/spec/features/work_packages/table/invalid_query_spec.rb
index c95955c7a3e7..abb7c49432f9 100644
--- a/spec/features/work_packages/table/invalid_query_spec.rb
+++ b/spec/features/work_packages/table/invalid_query_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Invalid query spec', :js do
+RSpec.describe "Invalid query spec", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -26,9 +26,9 @@
project:,
user:)
- query.add_filter('assigned_to_id', '=', [99999])
- query.columns << 'cf_0815'
- query.group_by = 'cf_0815'
+ query.add_filter("assigned_to_id", "=", [99999])
+ query.columns << "cf_0815"
+ query.group_by = "cf_0815"
query.sort_criteria = [%w(cf_0815 desc)]
query.save(validate: false)
create(:view_work_packages_table, query:)
@@ -57,55 +57,55 @@
work_package_assigned
end
- it 'handles invalid queries' do
+ it "handles invalid queries" do
# should load a faulty query and also the drop down
wp_table.visit_query(invalid_query)
filters.open
filters.expect_filter_count 1
- filters.expect_no_filter_by('Assignee')
- filters.expect_filter_by('Status', 'open', nil)
+ filters.expect_no_filter_by("Assignee")
+ filters.expect_filter_by("Status", "open", nil)
wp_table.expect_no_toaster(type: :error,
- message: I18n.t('js.work_packages.faulty_query.description'))
+ message: I18n.t("js.work_packages.faulty_query.description"))
wp_table.expect_work_package_listed work_package_assigned
wp_table.expect_query_in_select_dropdown(invalid_query.name)
- Capybara.current_session.driver.execute_script('window.localStorage.clear()')
+ Capybara.current_session.driver.execute_script("window.localStorage.clear()")
# should not load with faulty parameters but can be fixed
- filter_props = [{ n: 'assignee', o: '=', v: ['999999'] },
- { n: 'status', o: '=', v: [status.id.to_s, status2.id.to_s] }]
+ filter_props = [{ n: "assignee", o: "=", v: ["999999"] },
+ { n: "status", o: "=", v: [status.id.to_s, status2.id.to_s] }]
column_props = %w(id subject customField0815)
invalid_props = JSON.dump({ f: filter_props,
c: column_props,
- g: 'customField0815',
- t: 'customField0815:desc' })
+ g: "customField0815",
+ t: "customField0815:desc" })
wp_table.visit_with_params("query_id=#{valid_query.id}&query_props=#{invalid_props}")
wp_table.expect_toast(type: :error,
- message: I18n.t('js.work_packages.faulty_query.description'))
+ message: I18n.t("js.work_packages.faulty_query.description"))
wp_table.dismiss_toaster!
wp_table.expect_no_work_package_listed
filters.expect_filter_count 2
filters.open
- filters.expect_filter_by('Assignee', 'is (OR)', :placeholder)
- filters.expect_filter_by('Status', 'is (OR)', [status.name, status2.name])
+ filters.expect_filter_by("Assignee", "is (OR)", :placeholder)
+ filters.expect_filter_by("Status", "is (OR)", [status.name, status2.name])
- group_by.enable_via_menu('Assignee')
+ group_by.enable_via_menu("Assignee")
sleep(0.3)
- filters.set_filter('Assignee', 'is (OR)', user.name)
+ filters.set_filter("Assignee", "is (OR)", user.name)
sleep(0.3)
wp_table.expect_work_package_listed work_package_assigned
wp_table.save
- wp_table.expect_toast(message: I18n.t('js.notice_successful_update'))
+ wp_table.expect_toast(message: I18n.t("js.notice_successful_update"))
end
end
diff --git a/spec/features/work_packages/table/milestones_spec.rb b/spec/features/work_packages/table/milestones_spec.rb
index 702a42791ba1..2b74d9a7c9b5 100644
--- a/spec/features/work_packages/table/milestones_spec.rb
+++ b/spec/features/work_packages/table/milestones_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Inline editing milestones', :js do
+RSpec.describe "Inline editing milestones", :js do
let(:user) { create(:admin) }
let(:type) { create(:type, is_milestone: true) }
@@ -9,7 +9,7 @@
create(:work_package,
project:,
type:,
- subject: 'Foobar')
+ subject: "Foobar")
end
let!(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -30,7 +30,7 @@
wp_table.expect_work_package_listed work_package
end
- it 'mapping for start and finish date in the table (regression #26044)' do
+ it "mapping for start and finish date in the table (regression #26044)" do
start_date = wp_table.edit_field(work_package, :startDate)
due_date = wp_table.edit_field(work_package, :dueDate)
@@ -48,14 +48,14 @@
start_date.expect_inactive!
due_date.expect_inactive!
- start_date.update '2017-08-07'
+ start_date.update "2017-08-07"
start_date.expect_inactive!
- start_date.expect_state_text '08/07/2017'
- due_date.expect_state_text '08/07/2017'
+ start_date.expect_state_text "08/07/2017"
+ due_date.expect_state_text "08/07/2017"
work_package.reload
expect work_package.milestone?
- expect(work_package.start_date.iso8601).to eq('2017-08-07')
- expect(work_package.due_date.iso8601).to eq('2017-08-07')
+ expect(work_package.start_date.iso8601).to eq("2017-08-07")
+ expect(work_package.due_date.iso8601).to eq("2017-08-07")
end
end
diff --git a/spec/features/work_packages/table/queries/assignee_filter_spec.rb b/spec/features/work_packages/table/queries/assignee_filter_spec.rb
index 547f7d34fc4f..ad0d73c314d4 100644
--- a/spec/features/work_packages/table/queries/assignee_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/assignee_filter_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package filtering by assignee', :js do
+RSpec.describe "Work package filtering by assignee", :js do
let(:project) { create(:project) }
let(:invisible_project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -36,14 +36,14 @@
let(:role) { create(:project_role, permissions: %i[view_work_packages save_queries]) }
let(:other_user) do
create(:user,
- firstname: 'Other',
- lastname: 'User',
+ firstname: "Other",
+ lastname: "User",
member_with_roles: { project => role })
end
let(:invisible_user) do
create(:user,
- firstname: 'Invisible',
- lastname: 'User',
+ firstname: "Invisible",
+ lastname: "User",
member_with_roles: { invisible_project => role })
end
let(:placeholder_user) do
@@ -65,21 +65,21 @@
create(:user, member_with_roles: { project => role })
end
- it 'shows the work package matching the assigned to filter' do
+ it "shows the work package matching the assigned to filter" do
wp_table.visit!
wp_table.expect_work_package_listed(work_package_user_assignee, work_package_placeholder_user_assignee)
filters.open
- filters.expect_missing_filter_value_by('Assignee', 'is (OR)', [invisible_user.name])
+ filters.expect_missing_filter_value_by("Assignee", "is (OR)", [invisible_user.name])
- filters.add_filter_by('Assignee', 'is (OR)', [other_user.name])
+ filters.add_filter_by("Assignee", "is (OR)", [other_user.name])
wp_table.ensure_work_package_not_listed!(work_package_placeholder_user_assignee)
wp_table.expect_work_package_listed(work_package_user_assignee)
- wp_table.save_as('Subject query')
+ wp_table.save_as("Subject query")
- wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_table.expect_and_dismiss_toaster(message: "Successful creation.")
# Revisit query
wp_table.visit_query Query.last
@@ -87,9 +87,9 @@
wp_table.expect_work_package_listed(work_package_user_assignee)
filters.open
- filters.expect_filter_by('Assignee', 'is (OR)', [other_user.name])
- filters.remove_filter 'assignee'
- filters.add_filter_by('Assignee', 'is (OR)', [placeholder_user.name])
+ filters.expect_filter_by("Assignee", "is (OR)", [other_user.name])
+ filters.remove_filter "assignee"
+ filters.add_filter_by("Assignee", "is (OR)", [placeholder_user.name])
wp_table.ensure_work_package_not_listed!(work_package_user_assignee)
wp_table.expect_work_package_listed(work_package_placeholder_user_assignee)
diff --git a/spec/features/work_packages/table/queries/assignees_role_filter_spec.rb b/spec/features/work_packages/table/queries/assignees_role_filter_spec.rb
index 2f2cb0bd95b1..216722916e72 100644
--- a/spec/features/work_packages/table/queries/assignees_role_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/assignees_role_filter_spec.rb
@@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe "Work package filtering by assignee's role", :js, :with_cuprite do
shared_let(:project) { create(:project) }
@@ -45,8 +45,8 @@
shared_let(:other_user) do
create(:user,
- firstname: 'Other',
- lastname: 'User',
+ firstname: "Other",
+ lastname: "User",
member_with_roles: { project => project_role, work_package_user_assignee => visible_work_package_role })
end
@@ -75,11 +75,11 @@
filters.open
# It does not show builtin roles such as Anonymous and NonMember or roles that don't allow the user to become an assignee
filters.expect_missing_filter_value_by("Assignee's role",
- 'is (OR)',
+ "is (OR)",
(builtin_roles + non_assignable_roles),
- 'assignedToRole')
+ "assignedToRole")
- filters.add_filter_by("Assignee's role", 'is (OR)', assignable_roles, 'assignedToRole')
+ filters.add_filter_by("Assignee's role", "is (OR)", assignable_roles, "assignedToRole")
filters.expect_filter_count("2")
@@ -93,8 +93,8 @@
sleep 1
- wp_table.save_as('Subject query', by_title: true)
- wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_table.save_as("Subject query", by_title: true)
+ wp_table.expect_and_dismiss_toaster(message: "Successful creation.")
# Revisit query
wp_table.visit_query Query.last
@@ -103,9 +103,9 @@
filters.open
# Do not show the already selected roles in the autocomplete dropdown
- filters.expect_missing_autocomplete_value('assignedToRole', assignable_roles)
+ filters.expect_missing_autocomplete_value("assignedToRole", assignable_roles)
# Ensure that all assigned roles are shown in the filter
- filters.expect_filter_by("Assignee's role", 'is (OR)', assignable_roles, 'assignedToRole')
+ filters.expect_filter_by("Assignee's role", "is (OR)", assignable_roles, "assignedToRole")
end
end
diff --git a/spec/features/work_packages/table/queries/bool_cf_filter_spec.rb b/spec/features/work_packages/table/queries/bool_cf_filter_spec.rb
index 246b34a378fe..d5827945c2c4 100644
--- a/spec/features/work_packages/table/queries/bool_cf_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/bool_cf_filter_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package filtering by bool custom field', :js do
+RSpec.describe "Work package filtering by bool custom field", :js do
let(:project) { create(:project) }
let(:type) { project.types.first }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -74,7 +74,7 @@
member_with_permissions: { project => %i[view_work_packages save_queries] })
end
- it 'shows the work package matching the bool cf filter' do
+ it "shows the work package matching the bool cf filter" do
wp_table.visit!
wp_table.expect_work_package_listed(work_package_true, work_package_false, work_package_without, work_package_other_type)
@@ -86,9 +86,9 @@
wp_table.ensure_work_package_not_listed!(work_package_false, work_package_without, work_package_other_type)
wp_table.expect_work_package_listed(work_package_true)
- wp_table.save_as('Saved query')
+ wp_table.save_as("Saved query")
- wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_table.expect_and_dismiss_toaster(message: "Successful creation.")
# Revisit query
wp_table.visit_query Query.last
diff --git a/spec/features/work_packages/table/queries/date_is_empty_filter_spec.rb b/spec/features/work_packages/table/queries/date_is_empty_filter_spec.rb
index af506d41aae5..f48f5791ae75 100644
--- a/spec/features/work_packages/table/queries/date_is_empty_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/date_is_empty_filter_spec.rb
@@ -28,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe 'Filter by date with "is empty"', :js, :with_cuprite do
let(:user) { create(:admin) }
@@ -62,7 +62,7 @@
let(:custom_field_date) do
create(:date_wp_custom_field,
- name: 'Date CF',
+ name: "Date CF",
is_filter: true,
searchable: true) do |custom_field|
project.work_package_custom_fields << custom_field
@@ -79,7 +79,7 @@ def remove_default
wp_table.expect_work_package_listed work_package_without_dates, work_package_with_start_date, work_package_with_custom_date
filters.open
- filters.remove_filter('status')
+ filters.remove_filter("status")
end
before do
@@ -93,19 +93,19 @@ def remove_default
wp_table.visit!
end
- it 'works as intended for regular fields' do
+ it "works as intended for regular fields" do
remove_default
- filters.add_filter_by('Start date', 'is empty', nil, 'startDate')
+ filters.add_filter_by("Start date", "is empty", nil, "startDate")
wp_table.expect_work_package_listed work_package_without_dates
wp_table.ensure_work_package_not_listed! work_package_with_start_date
end
- it 'works as intended for custom fields' do
+ it "works as intended for custom fields" do
remove_default
- filters.add_filter_by('Date CF', 'is empty', nil, "customField#{custom_field_date.id}")
+ filters.add_filter_by("Date CF", "is empty", nil, "customField#{custom_field_date.id}")
wp_table.expect_work_package_listed work_package_without_dates
wp_table.ensure_work_package_not_listed! work_package_with_custom_date
diff --git a/spec/features/work_packages/table/queries/default_queries_spec.rb b/spec/features/work_packages/table/queries/default_queries_spec.rb
index f2e3053bf8e6..a8a04348ce4b 100644
--- a/spec/features/work_packages/table/queries/default_queries_spec.rb
+++ b/spec/features/work_packages/table/queries/default_queries_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Default work package queries', :js do
+RSpec.describe "Default work package queries", :js do
create_shared_association_defaults_for_work_package_factory
shared_let(:user) { create(:admin) }
@@ -36,21 +36,21 @@
let(:wp_table) { Pages::WorkPackagesTable.new(project_with_types) }
- describe 'Overdue' do
- let!(:work_package) { create(:work_package, subject: 'Not overdue', due_date: 5.days.from_now) }
- let!(:due_today_work_package) { create(:work_package, subject: 'Not overdue', due_date: Time.zone.today) }
- let!(:overdue_work_package_1_day_ago) { create(:work_package, subject: 'Overdue 1 day ago', due_date: 1.day.ago) }
- let!(:overdue_work_package_2_days_ago) { create(:work_package, subject: 'Overdue 2 days ago', due_date: 2.days.ago) }
+ describe "Overdue" do
+ let!(:work_package) { create(:work_package, subject: "Not overdue", due_date: 5.days.from_now) }
+ let!(:due_today_work_package) { create(:work_package, subject: "Not overdue", due_date: Time.zone.today) }
+ let!(:overdue_work_package_1_day_ago) { create(:work_package, subject: "Overdue 1 day ago", due_date: 1.day.ago) }
+ let!(:overdue_work_package_2_days_ago) { create(:work_package, subject: "Overdue 2 days ago", due_date: 2.days.ago) }
let!(:closed_status) { create(:closed_status) }
- let!(:closed_work_package) { create(:work_package, subject: 'Closed', status: closed_status, due_date: 10.days.ago) }
+ let!(:closed_work_package) { create(:work_package, subject: "Closed", status: closed_status, due_date: 10.days.ago) }
- it 'shows the overdue work package' do
+ it "shows the overdue work package" do
wp_table.visit!
wp_table.expect_work_package_listed work_package, due_today_work_package, overdue_work_package_1_day_ago,
overdue_work_package_2_days_ago
- click_link 'Overdue', wait: 10
+ click_link "Overdue", wait: 10
wp_table.expect_work_package_listed overdue_work_package_1_day_ago, overdue_work_package_2_days_ago
wp_table.ensure_work_package_not_listed! closed_work_package, work_package, due_today_work_package
diff --git a/spec/features/work_packages/table/queries/filter_pagination_spec.rb b/spec/features/work_packages/table/queries/filter_pagination_spec.rb
index 124acc8f64a3..54b34bc954d3 100644
--- a/spec/features/work_packages/table/queries/filter_pagination_spec.rb
+++ b/spec/features/work_packages/table/queries/filter_pagination_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'Filter updates pagination', :js do
+RSpec.describe "Filter updates pagination", :js do
let(:user) do
create(:user,
member_with_permissions: { project => %i[view_work_packages] })
@@ -44,7 +44,7 @@
let(:work_package_2) { create(:work_package, project:) }
before do
- allow(Setting).to receive(:per_page_options).and_return '1'
+ allow(Setting).to receive(:per_page_options).and_return "1"
work_package_1
work_package_2
@@ -53,34 +53,34 @@
wp_table.visit!
end
- it 'resets page to 1 if changing filter' do
+ it "resets page to 1 if changing filter" do
wp_table.expect_work_package_listed work_package_1
wp_table.ensure_work_package_not_listed! work_package_2
# Expect pagination to be correct
- expect(page).to have_css('.op-pagination--item_current', text: '1')
+ expect(page).to have_css(".op-pagination--item_current", text: "1")
# Go to second page
- within('.op-pagination--pages') do
- find('.op-pagination--item button', text: '2').click
+ within(".op-pagination--pages") do
+ find(".op-pagination--item button", text: "2").click
end
wp_table.expect_work_package_listed work_package_2
wp_table.ensure_work_package_not_listed! work_package_1
# Expect pagination to be correct
- expect(page).to have_css('.op-pagination--item_current', text: '2')
+ expect(page).to have_css(".op-pagination--item_current", text: "2")
# Change filter to assigned to
filters.expect_filter_count 1
filters.open
- filters.add_filter_by 'Assignee', 'is (OR)', user.name
+ filters.add_filter_by "Assignee", "is (OR)", user.name
filters.expect_filter_count 2
wp_table.expect_work_package_listed work_package_1
wp_table.ensure_work_package_not_listed! work_package_2
# Expect pagination to be back to 1
- expect(page).to have_css('.op-pagination--range', text: '1 - 1/1')
+ expect(page).to have_css(".op-pagination--range", text: "1 - 1/1")
end
end
diff --git a/spec/features/work_packages/table/queries/filter_spec.rb b/spec/features/work_packages/table/queries/filter_spec.rb
index 22c0155c451d..5627aadac993 100644
--- a/spec/features/work_packages/table/queries/filter_spec.rb
+++ b/spec/features/work_packages/table/queries/filter_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'filter work packages', :js do
- shared_let(:user) { create(:admin, preferences: { time_zone: 'Etc/UTC' }) }
+RSpec.describe "filter work packages", :js do
+ shared_let(:user) { create(:admin, preferences: { time_zone: "Etc/UTC" }) }
shared_let(:watcher) { create(:user) }
shared_let(:role) { create(:existing_project_role, permissions: [:view_work_packages]) }
shared_let(:project) { create(:project, members: { watcher => role }) }
@@ -38,7 +38,7 @@
current_user { user }
- context 'by watchers' do
+ context "by watchers" do
let(:work_package_with_watcher) do
wp = build(:work_package, project:)
wp.add_watcher watcher
@@ -56,11 +56,11 @@
end
# Regression test for bug #24114 (broken watcher filter)
- it 'onlies filter work packages by watcher' do
+ it "onlies filter work packages by watcher" do
filters.open
loading_indicator_saveguard
- filters.add_filter_by 'Watcher', 'is (OR)', watcher.name
+ filters.add_filter_by "Watcher", "is (OR)", watcher.name
loading_indicator_saveguard
wp_table.expect_work_package_listed work_package_with_watcher
@@ -68,12 +68,12 @@
end
end
- context 'by version in project' do
+ context "by version in project" do
let(:version) { create(:version, project:) }
let(:work_package_with_version) do
- create(:work_package, project:, subject: 'With version', version:)
+ create(:work_package, project:, subject: "With version", version:)
end
- let(:work_package_without_version) { create(:work_package, subject: 'Without version', project:) }
+ let(:work_package_without_version) { create(:work_package, subject: "Without version", project:) }
before do
work_package_with_version
@@ -82,18 +82,18 @@
wp_table.visit!
end
- it 'allows filtering, saving, retrieving and altering the saved filter' do
+ it "allows filtering, saving, retrieving and altering the saved filter" do
filters.open
- filters.add_filter_by('Version', 'is (OR)', version.name)
+ filters.add_filter_by("Version", "is (OR)", version.name)
loading_indicator_saveguard
wp_table.expect_work_package_listed work_package_with_version
wp_table.ensure_work_package_not_listed! work_package_without_version
- wp_table.save_as('Some query name')
+ wp_table.save_as("Some query name")
- filters.remove_filter 'version'
+ filters.remove_filter "version"
loading_indicator_saveguard
wp_table.expect_work_package_listed work_package_with_version, work_package_without_version
@@ -108,9 +108,9 @@
filters.open
- filters.expect_filter_by('Version', 'is (OR)', version.name)
+ filters.expect_filter_by("Version", "is (OR)", version.name)
- filters.set_operator 'Version', 'is not'
+ filters.set_operator "Version", "is not"
loading_indicator_saveguard
wp_table.expect_work_package_listed work_package_without_version
@@ -118,13 +118,13 @@
end
end
- context 'when filtering by status in project' do
- let(:status) { create(:status, name: 'Open status') }
- let(:closed_status) { create(:closed_status, name: 'Closed status') }
+ context "when filtering by status in project" do
+ let(:status) { create(:status, name: "Open status") }
+ let(:closed_status) { create(:closed_status, name: "Closed status") }
let(:work_package_with_status) do
- create(:work_package, project:, subject: 'With open status', status:)
+ create(:work_package, project:, subject: "With open status", status:)
end
- let(:work_package_without_status) { create(:work_package, subject: 'With closed status', project:, status: closed_status) }
+ let(:work_package_without_status) { create(:work_package, subject: "With closed status", project:, status: closed_status) }
before do
work_package_with_status
@@ -133,12 +133,12 @@
wp_table.visit!
end
- it 'allows filtering and matching the selected value' do
+ it "allows filtering and matching the selected value" do
filters.open
filters.remove_filter :status
filters.expect_no_filter_by :status
- filters.add_filter_by('Status', 'is (OR)', status.name)
+ filters.add_filter_by("Status", "is (OR)", status.name)
loading_indicator_saveguard
wp_table.expect_work_package_listed work_package_with_status
@@ -146,12 +146,12 @@
filters.open_autocompleter :status
- expect(page).to have_css('.ng-option', text: closed_status.name)
- expect(page).to have_no_css('.ng-option', text: status.name)
+ expect(page).to have_css(".ng-option", text: closed_status.name)
+ expect(page).to have_no_css(".ng-option", text: status.name)
end
end
- context 'by finish date outside of a project' do
+ context "by finish date outside of a project" do
let(:work_package_with_due_date) { create(:work_package, project:, due_date: Date.current) }
let(:work_package_without_due_date) { create(:work_package, project:, due_date: 5.days.from_now) }
let(:wp_table) { Pages::WorkPackagesTable.new }
@@ -163,21 +163,21 @@
wp_table.visit!
end
- it 'allows filtering, saving and retrieving and altering the saved filter' do
+ it "allows filtering, saving and retrieving and altering the saved filter" do
filters.open
- filters.add_filter_by('Finish date',
- 'between',
- [1.day.ago.strftime('%Y-%m-%d'), Date.current.strftime('%Y-%m-%d')],
- 'dueDate')
+ filters.add_filter_by("Finish date",
+ "between",
+ [1.day.ago.strftime("%Y-%m-%d"), Date.current.strftime("%Y-%m-%d")],
+ "dueDate")
loading_indicator_saveguard
wp_table.expect_work_package_listed work_package_with_due_date
wp_table.ensure_work_package_not_listed! work_package_without_due_date
- wp_table.save_as('Some query name')
+ wp_table.save_as("Some query name")
- filters.remove_filter 'dueDate'
+ filters.remove_filter "dueDate"
loading_indicator_saveguard
wp_table.expect_work_package_listed work_package_with_due_date, work_package_without_due_date
@@ -192,12 +192,12 @@
filters.open
- filters.expect_filter_by('Finish date',
- 'between',
- [1.day.ago.strftime('%Y-%m-%d'), Date.current.strftime('%Y-%m-%d')],
- 'dueDate')
+ filters.expect_filter_by("Finish date",
+ "between",
+ [1.day.ago.strftime("%Y-%m-%d"), Date.current.strftime("%Y-%m-%d")],
+ "dueDate")
- filters.set_filter 'Finish date', 'in more than', '1', 'dueDate'
+ filters.set_filter "Finish date", "in more than", "1", "dueDate"
loading_indicator_saveguard
wp_table.expect_work_package_listed work_package_without_due_date
@@ -205,7 +205,7 @@
end
end
- context 'by list cf inside a project' do
+ context "by list cf inside a project" do
let(:type) do
type = create(:type)
@@ -245,13 +245,13 @@
wp_table.visit!
end
- it 'allows filtering, saving and retrieving the saved filter' do
+ it "allows filtering, saving and retrieving the saved filter" do
# Wait for form to load
filters.expect_loaded
filters.open
filters.add_filter_by(list_cf.name,
- 'is not',
+ "is not",
list_cf.custom_options.last.value,
list_cf.attribute_name(:camel_case))
@@ -262,9 +262,9 @@
# Do not display already selected values in the autocompleter (Regression #46249)
filters.open_autocompleter list_cf.attribute_name(:camel_case)
- expect(page).to have_no_css('.ng-option', text: list_cf.custom_options.last.value)
+ expect(page).to have_no_css(".ng-option", text: list_cf.custom_options.last.value)
- wp_table.save_as('Some query name')
+ wp_table.save_as("Some query name")
filters.remove_filter list_cf.attribute_name(:camel_case)
@@ -282,13 +282,13 @@
filters.open
filters.expect_filter_by(list_cf.name,
- 'is not',
+ "is not",
list_cf.custom_options.last.value,
"customField#{list_cf.id}")
end
end
- context 'by string cf inside a project with url-query relevant chars' do
+ context "by string cf inside a project with url-query relevant chars" do
let(:type) do
type = create(:type)
@@ -299,14 +299,14 @@
let(:work_package_plus) do
wp = create(:work_package, project:, type:)
- wp.send(string_cf.attribute_setter, 'G+H')
+ wp.send(string_cf.attribute_setter, "G+H")
wp.save!
wp
end
let(:work_package_and) do
wp = create(:work_package, project:, type:)
- wp.send(string_cf.attribute_setter, 'A&B')
+ wp.send(string_cf.attribute_setter, "A&B")
wp.save!
wp
end
@@ -328,21 +328,21 @@
wp_table.visit!
end
- it 'allows filtering, saving and retrieving the saved filter' do
+ it "allows filtering, saving and retrieving the saved filter" do
# Wait for form to load
filters.expect_loaded
filters.open
filters.add_filter_by(string_cf.name,
- 'is',
- ['G+H'],
+ "is",
+ ["G+H"],
string_cf.attribute_name(:camel_case))
loading_indicator_saveguard
wp_table.expect_work_package_listed work_package_plus
wp_table.ensure_work_package_not_listed! work_package_and
- wp_table.save_as('Some query name')
+ wp_table.save_as("Some query name")
filters.remove_filter string_cf.attribute_name(:camel_case)
@@ -360,13 +360,13 @@
filters.open
filters.expect_filter_by(string_cf.name,
- 'is',
- ['G+H'],
+ "is",
+ ["G+H"],
"customField#{string_cf.id}")
filters.set_filter(string_cf,
- 'is',
- ['A&B'],
+ "is",
+ ["A&B"],
string_cf.attribute_name(:camel_case))
loading_indicator_saveguard
@@ -375,104 +375,104 @@
end
end
- context 'by attachment content' do
- let(:attachment_a) { build(:attachment, filename: 'attachment-first.pdf') }
- let(:attachment_b) { build(:attachment, filename: 'attachment-second.pdf') }
+ context "by attachment content" do
+ let(:attachment_a) { build(:attachment, filename: "attachment-first.pdf") }
+ let(:attachment_b) { build(:attachment, filename: "attachment-second.pdf") }
let(:wp_with_attachment_a) do
- create(:work_package, subject: 'WP attachment A', project:, attachments: [attachment_a])
+ create(:work_package, subject: "WP attachment A", project:, attachments: [attachment_a])
end
let(:wp_with_attachment_b) do
- create(:work_package, subject: 'WP attachment B', project:, attachments: [attachment_b])
+ create(:work_package, subject: "WP attachment B", project:, attachments: [attachment_b])
end
- let(:wp_without_attachment) { create(:work_package, subject: 'WP no attachment', project:) }
+ let(:wp_without_attachment) { create(:work_package, subject: "WP no attachment", project:) }
let(:wp_table) { Pages::WorkPackagesTable.new }
before do
- allow_any_instance_of(Plaintext::Resolver).to receive(:text).and_return('I am the first text $1.99.')
+ allow_any_instance_of(Plaintext::Resolver).to receive(:text).and_return("I am the first text $1.99.")
wp_with_attachment_a
Attachments::ExtractFulltextJob.perform_now(attachment_a.id)
- allow_any_instance_of(Plaintext::Resolver).to receive(:text).and_return('I am the second text.')
+ allow_any_instance_of(Plaintext::Resolver).to receive(:text).and_return("I am the second text.")
wp_with_attachment_b
Attachments::ExtractFulltextJob.perform_now(attachment_b.id)
wp_without_attachment
end
- context 'with full text search capabilities' do
+ context "with full text search capabilities" do
before do
skip("Database does not support full text search.") unless OpenProject::Database::allows_tsv?
end
- it 'allows filtering and retrieving and altering the saved filter' do
+ it "allows filtering and retrieving and altering the saved filter" do
wp_table.visit!
wp_table.expect_work_package_listed wp_with_attachment_a, wp_with_attachment_b
filters.open
# content contains with multiple hits
- filters.add_filter_by('Attachment content',
- 'contains',
- ['text'],
- 'attachmentContent')
+ filters.add_filter_by("Attachment content",
+ "contains",
+ ["text"],
+ "attachmentContent")
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_with_attachment_a, wp_with_attachment_b
wp_table.ensure_work_package_not_listed! wp_without_attachment
# content contains single hit with numbers
- filters.remove_filter 'attachmentContent'
+ filters.remove_filter "attachmentContent"
- filters.add_filter_by('Attachment content',
- 'contains',
- ['first 1.99'],
- 'attachmentContent')
+ filters.add_filter_by("Attachment content",
+ "contains",
+ ["first 1.99"],
+ "attachmentContent")
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_with_attachment_a
wp_table.ensure_work_package_not_listed! wp_without_attachment, wp_with_attachment_b
- filters.remove_filter 'attachmentContent'
+ filters.remove_filter "attachmentContent"
# content does not contain
- filters.add_filter_by('Attachment content',
- 'doesn\'t contain',
- ['first'],
- 'attachmentContent')
+ filters.add_filter_by("Attachment content",
+ "doesn't contain",
+ ["first"],
+ "attachmentContent")
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_with_attachment_b, wp_without_attachment
wp_table.ensure_work_package_not_listed! wp_with_attachment_a
- filters.remove_filter 'attachmentContent'
+ filters.remove_filter "attachmentContent"
# ignores special characters
- filters.add_filter_by('Attachment content',
- 'contains',
- ['! first:* \')'],
- 'attachmentContent')
+ filters.add_filter_by("Attachment content",
+ "contains",
+ ["! first:* ')"],
+ "attachmentContent")
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_with_attachment_a
wp_table.ensure_work_package_not_listed! wp_without_attachment, wp_with_attachment_b
- filters.remove_filter 'attachmentContent'
+ filters.remove_filter "attachmentContent"
# file name contains
- filters.add_filter_by('Attachment file name',
- 'contains',
- ['first'],
- 'attachmentFileName')
+ filters.add_filter_by("Attachment file name",
+ "contains",
+ ["first"],
+ "attachmentFileName")
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_with_attachment_a
wp_table.ensure_work_package_not_listed! wp_without_attachment, wp_with_attachment_b
- filters.remove_filter 'attachmentFileName'
+ filters.remove_filter "attachmentFileName"
# file name does not contain
- filters.add_filter_by('Attachment file name',
- 'doesn\'t contain',
- ['first'],
- 'attachmentFileName')
+ filters.add_filter_by("Attachment file name",
+ "doesn't contain",
+ ["first"],
+ "attachmentFileName")
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_with_attachment_b
@@ -481,50 +481,50 @@
end
end
- context 'DB does not offer TSVector support' do
+ context "DB does not offer TSVector support" do
before do
allow(OpenProject::Database).to receive(:allows_tsv?).and_return(false)
end
it "does not offer attachment filters" do
- expect(page).to have_no_select 'add_filter_select', with_options: ['Attachment content', 'Attachment file name']
+ expect(page).to have_no_select "add_filter_select", with_options: ["Attachment content", "Attachment file name"]
end
end
- describe 'datetime filters' do
+ describe "datetime filters" do
shared_let(:wp_updated_today) do
create(:work_package,
- subject: 'Created today',
+ subject: "Created today",
project:,
created_at: Time.current.change(hour: 12),
updated_at: Time.current.change(hour: 12))
end
shared_let(:wp_updated_3d_ago) do
create(:work_package,
- subject: 'Created 3d ago',
+ subject: "Created 3d ago",
project:,
created_at: 3.days.ago,
updated_at: 3.days.ago)
end
shared_let(:wp_updated_5d_ago) do
create(:work_package,
- subject: 'Created 5d ago',
+ subject: "Created 5d ago",
project:,
created_at: 5.days.ago,
updated_at: 5.days.ago)
end
- it 'filters on date by created_at (Regression #28459)' do
+ it "filters on date by created_at (Regression #28459)" do
wp_table.visit!
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_today, wp_updated_3d_ago, wp_updated_5d_ago
filters.open
- filters.add_filter_by 'Created on',
- 'on',
+ filters.add_filter_by "Created on",
+ "on",
[Date.current.iso8601],
- 'createdAt'
+ "createdAt"
loading_indicator_saveguard
@@ -532,17 +532,17 @@
wp_table.ensure_work_package_not_listed! wp_updated_3d_ago, wp_updated_5d_ago
end
- it 'filters on date by updated_at' do
+ it "filters on date by updated_at" do
wp_table.visit!
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_today, wp_updated_3d_ago, wp_updated_5d_ago
filters.open
- filters.add_filter_by 'Updated',
- 'on',
+ filters.add_filter_by "Updated",
+ "on",
[Date.current.iso8601],
- 'updatedAt'
+ "updatedAt"
loading_indicator_saveguard
@@ -550,17 +550,17 @@
wp_table.ensure_work_package_not_listed! wp_updated_3d_ago, wp_updated_5d_ago
end
- it 'filters between date by updated_at', :with_cuprite do
+ it "filters between date by updated_at", :with_cuprite do
wp_table.visit!
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_today, wp_updated_3d_ago, wp_updated_5d_ago
filters.open
- filters.add_filter_by 'Updated',
- 'between',
+ filters.add_filter_by "Updated",
+ "between",
[4.days.ago.to_date.iso8601, 2.days.ago.to_date.iso8601],
- 'updatedAt'
+ "updatedAt"
wait_for_reload
loading_indicator_saveguard
@@ -568,15 +568,15 @@
wp_table.expect_work_package_listed wp_updated_3d_ago
wp_table.ensure_work_package_not_listed! wp_updated_today, wp_updated_5d_ago
- wp_table.save_as('Some query name')
+ wp_table.save_as("Some query name")
- filters.remove_filter 'updatedAt'
+ filters.remove_filter "updatedAt"
wait_for_reload
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_today, wp_updated_3d_ago, wp_updated_5d_ago
- last_query = Query.where(name: 'Some query name').first
+ last_query = Query.where(name: "Some query name").first
date_filter = last_query.filters.last
# The frontend sends the date as a datetime string in utc where both bounds have the local offset deduced
@@ -594,45 +594,45 @@
filters.open
- filters.expect_filter_by 'Updated on',
- 'between',
+ filters.expect_filter_by "Updated on",
+ "between",
[4.days.ago.to_date.iso8601, 2.days.ago.to_date.iso8601],
- 'updatedAt'
+ "updatedAt"
end
- it 'filters between date by updated_at (lower boundary only)' do
+ it "filters between date by updated_at (lower boundary only)" do
wp_table.visit!
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_today, wp_updated_3d_ago, wp_updated_5d_ago
filters.open
- filters.add_filter_by 'Updated',
- 'between',
+ filters.add_filter_by "Updated",
+ "between",
[3.days.ago.to_date.iso8601],
- 'updatedAt'
+ "updatedAt"
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_3d_ago, wp_updated_today
wp_table.ensure_work_package_not_listed! wp_updated_5d_ago
- wp_table.save_as('Some query name')
+ wp_table.save_as("Some query name")
- filters.remove_filter 'updatedAt'
+ filters.remove_filter "updatedAt"
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_today, wp_updated_5d_ago
- filters.add_filter_by 'Updated',
- 'between',
+ filters.add_filter_by "Updated",
+ "between",
[6.days.ago.to_date.iso8601],
- 'updatedAt'
+ "updatedAt"
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_today, wp_updated_3d_ago, wp_updated_5d_ago
- last_query = Query.where(name: 'Some query name').first
+ last_query = Query.where(name: "Some query name").first
date_filter = last_query.filters.last
expect(date_filter.values)
.to eq [3.days.ago.utc.beginning_of_day.iso8601]
@@ -645,48 +645,48 @@
filters.open
- filters.expect_filter_by 'Updated on',
- 'between',
- [3.days.ago.to_date.iso8601, ''],
- 'updatedAt'
+ filters.expect_filter_by "Updated on",
+ "between",
+ [3.days.ago.to_date.iso8601, ""],
+ "updatedAt"
end
- it 'filters between date by updated_at (upper boundary only)' do
+ it "filters between date by updated_at (upper boundary only)" do
wp_table.visit!
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_today, wp_updated_3d_ago, wp_updated_5d_ago
filters.open
- filters.add_filter_by 'Updated',
- 'between',
+ filters.add_filter_by "Updated",
+ "between",
[nil, 4.days.ago.to_date.iso8601],
- 'updatedAt'
+ "updatedAt"
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_5d_ago
wp_table.ensure_work_package_not_listed! wp_updated_3d_ago, wp_updated_today
- wp_table.save_as('Some query name')
+ wp_table.save_as("Some query name")
- filters.remove_filter 'updatedAt'
+ filters.remove_filter "updatedAt"
loading_indicator_saveguard
wp_table.expect_work_package_listed wp_updated_today, wp_updated_3d_ago, wp_updated_5d_ago
- filters.add_filter_by 'Updated',
- 'between',
+ filters.add_filter_by "Updated",
+ "between",
[nil, 6.days.ago.to_date.iso8601],
- 'updatedAt'
+ "updatedAt"
loading_indicator_saveguard
wp_table.ensure_work_package_not_listed! wp_updated_5d_ago, wp_updated_3d_ago, wp_updated_today
- last_query = Query.where(name: 'Some query name').first
+ last_query = Query.where(name: "Some query name").first
date_filter = last_query.filters.last
expect(date_filter.values)
- .to eq ['', 4.days.ago.utc.end_of_day.iso8601]
+ .to eq ["", 4.days.ago.utc.end_of_day.iso8601]
wp_table.visit_query(last_query)
@@ -696,40 +696,40 @@
filters.open
- filters.expect_filter_by 'Updated on',
- 'between',
- ['', 4.days.ago.to_date.iso8601],
- 'updatedAt'
+ filters.expect_filter_by "Updated on",
+ "between",
+ ["", 4.days.ago.to_date.iso8601],
+ "updatedAt"
end
end
- describe 'keep the filter attribute order (Regression #33136)' do
- let(:version1) { create(:version, project:, name: 'Version 1', id: 1) }
- let(:version2) { create(:version, project:, name: 'Version 2', id: 2) }
+ describe "keep the filter attribute order (Regression #33136)" do
+ let(:version1) { create(:version, project:, name: "Version 1", id: 1) }
+ let(:version2) { create(:version, project:, name: "Version 2", id: 2) }
it do
wp_table.visit!
loading_indicator_saveguard
filters.open
- filters.add_filter_by 'Version', 'is (OR)', [version2.name, version1.name]
+ filters.add_filter_by "Version", "is (OR)", [version2.name, version1.name]
loading_indicator_saveguard
sleep(3)
- filters.expect_filter_by 'Version', 'is (OR)', [version1.name]
- filters.expect_filter_by 'Version', 'is (OR)', [version2.name]
+ filters.expect_filter_by "Version", "is (OR)", [version1.name]
+ filters.expect_filter_by "Version", "is (OR)", [version2.name]
# Order should stay unchanged
- filters.expect_filter_order('Version', [version2.name, version1.name])
+ filters.expect_filter_order("Version", [version2.name, version1.name])
end
end
- describe 'add parent WP filter' do
- let(:wp_parent) { create(:work_package, project:, subject: 'project') }
- let(:wp_child1) { create(:work_package, project:, subject: 'child 1', parent: wp_parent) }
- let(:wp_child2) { create(:work_package, project:, subject: 'child 2', parent: wp_parent) }
- let(:wp_default) { create(:work_package, project:, subject: 'default') }
+ describe "add parent WP filter" do
+ let(:wp_parent) { create(:work_package, project:, subject: "project") }
+ let(:wp_child1) { create(:work_package, project:, subject: "child 1", parent: wp_parent) }
+ let(:wp_child2) { create(:work_package, project:, subject: "child 2", parent: wp_parent) }
+ let(:wp_default) { create(:work_package, project:, subject: "default") }
it do
wp_parent
@@ -740,7 +740,7 @@
loading_indicator_saveguard
filters.expect_loaded
filters.open
- filters.add_filter_by 'Parent', 'is (OR)', [wp_parent.subject]
+ filters.add_filter_by "Parent", "is (OR)", [wp_parent.subject]
loading_indicator_saveguard
# It should show the children of the selected parent
diff --git a/spec/features/work_packages/table/queries/id_filter_spec.rb b/spec/features/work_packages/table/queries/id_filter_spec.rb
index ad5681f0c910..9700543ab4f1 100644
--- a/spec/features/work_packages/table/queries/id_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/id_filter_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package filtering by id', :js do
+RSpec.describe "Work package filtering by id", :js do
let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:filters) { Components::WorkPackages::Filters.new }
@@ -52,16 +52,16 @@
wp_table.expect_work_package_listed(work_package, other_work_package)
filters.open
- filters.add_filter_by('ID', 'is (OR)', [work_package.subject])
+ filters.add_filter_by("ID", "is (OR)", [work_package.subject])
end
- it 'shows the work package matching the id filter' do
+ it "shows the work package matching the id filter" do
wp_table.ensure_work_package_not_listed!(other_work_package)
wp_table.expect_work_package_listed(work_package)
- wp_table.save_as('Id query')
+ wp_table.save_as("Id query")
- wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_table.expect_and_dismiss_toaster(message: "Successful creation.")
# Revisit query
wp_table.visit_query Query.last
@@ -69,23 +69,23 @@
wp_table.expect_work_package_listed(work_package)
filters.open
- filters.expect_filter_by('ID', 'is (OR)', ["##{work_package.id} #{work_package.subject}"])
- filters.remove_filter 'id'
- filters.add_filter_by('ID', 'is not', [work_package.subject, other_work_package.subject])
+ filters.expect_filter_by("ID", "is (OR)", ["##{work_package.id} #{work_package.subject}"])
+ filters.remove_filter "id"
+ filters.add_filter_by("ID", "is not", [work_package.subject, other_work_package.subject])
wp_table.expect_no_work_package_listed
- filters.remove_filter 'id'
- filters.add_filter_by('ID', 'is (OR)', [work_package.id.to_s])
- filters.expect_filter_by('ID', 'is (OR)', ["##{work_package.id} #{work_package.subject}"])
+ filters.remove_filter "id"
+ filters.add_filter_by("ID", "is (OR)", [work_package.id.to_s])
+ filters.expect_filter_by("ID", "is (OR)", ["##{work_package.id} #{work_package.subject}"])
wp_table.expect_work_package_listed(work_package)
end
- it 'can still inline create a new work package (regression #41667)' do
+ it "can still inline create a new work package (regression #41667)" do
wp_table.click_inline_create
- expect(page).to have_css('.wp--row', count: 2)
+ expect(page).to have_css(".wp--row", count: 2)
- expect(page).to have_css('.wp-inline-create-row')
+ expect(page).to have_css(".wp-inline-create-row")
end
end
diff --git a/spec/features/work_packages/table/queries/me_filter_spec.rb b/spec/features/work_packages/table/queries/me_filter_spec.rb
index 4bf194817541..d6f3a5f732c3 100644
--- a/spec/features/work_packages/table/queries/me_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/me_filter_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'filter me value', :js do
+RSpec.describe "filter me value", :js do
let(:status) { create(:default_status) }
let!(:priority) { create(:default_priority) }
let(:project) do
@@ -49,33 +49,33 @@
end
let!(:role_anonymous) { create(:anonymous_role, permissions: [:view_work_packages]) }
- describe 'assignee' do
+ describe "assignee" do
let(:wp_admin) { create(:work_package, status:, project:, assigned_to: admin) }
let(:wp_user) { create(:work_package, status:, project:, assigned_to: user) }
- context 'as anonymous', with_settings: { login_required?: false } do
+ context "as anonymous", with_settings: { login_required?: false } do
current_user { User.anonymous }
let(:assignee_query) do
query = create(:query,
- name: 'Assignee Query',
+ name: "Assignee Query",
project:,
user:)
- query.add_filter('assigned_to_id', '=', ['me'])
+ query.add_filter("assigned_to_id", "=", ["me"])
query.save!(validate: false)
query
end
- it 'shows an error visiting a query with a me value' do
+ it "shows an error visiting a query with a me value" do
wp_table.visit_query assignee_query
wp_table.expect_toast(type: :error,
- message: I18n.t('js.work_packages.faulty_query.description'))
+ message: I18n.t("js.work_packages.faulty_query.description"))
end
end
- context 'logged in' do
+ context "logged in" do
current_user { admin }
before do
@@ -83,26 +83,26 @@
wp_user
end
- it 'shows the one work package filtering for myself' do
+ it "shows the one work package filtering for myself" do
wp_table.visit!
wp_table.expect_work_package_listed(wp_admin, wp_user)
# Add and save query with me filter
filters.open
- filters.remove_filter 'status'
- filters.add_filter_by('Assignee', 'is (OR)', 'me')
+ filters.remove_filter "status"
+ filters.add_filter_by("Assignee", "is (OR)", "me")
wp_table.ensure_work_package_not_listed!(wp_user)
wp_table.expect_work_package_listed(wp_admin)
- wp_table.save_as('Me query')
+ wp_table.save_as("Me query")
loading_indicator_saveguard
# Expect correct while saving
- wp_table.expect_title 'Me query'
+ wp_table.expect_title "Me query"
query = Query.last
- expect(query.filters.first.values).to eq ['me']
- filters.expect_filter_by('Assignee', 'is (OR)', 'me')
+ expect(query.filters.first.values).to eq ["me"]
+ filters.expect_filter_by("Assignee", "is (OR)", "me")
# Revisit query
wp_table.visit_query query
@@ -110,7 +110,7 @@
wp_table.expect_work_package_listed(wp_admin)
filters.open
- filters.expect_filter_by('Assignee', 'is (OR)', 'me')
+ filters.expect_filter_by("Assignee", "is (OR)", "me")
# Expect new work packages receive assignee
split_screen = wp_table.create_wp_by_button wp_user.type
@@ -119,10 +119,10 @@
sleep 2
subject = split_screen.edit_field :subject
- subject.set_value 'foobar'
+ subject.set_value "foobar"
subject.submit_by_enter
- split_screen.expect_and_dismiss_toaster message: 'Successful creation.'
+ split_screen.expect_and_dismiss_toaster message: "Successful creation."
wp = WorkPackage.last
expect(wp.assigned_to_id).to eq(admin.id)
@@ -130,11 +130,11 @@
end
end
- describe 'custom_field of type user' do
+ describe "custom_field of type user" do
let(:custom_field) do
create(
:user_wp_custom_field,
- name: 'CF user',
+ name: "CF user",
is_required: false
)
end
@@ -163,14 +163,14 @@
custom_field_values: { custom_field.id => user.id })
end
- context 'as anonymous', with_settings: { login_required?: false } do
+ context "as anonymous", with_settings: { login_required?: false } do
let(:assignee_query) do
query = create(:query,
- name: 'CF user Query',
+ name: "CF user Query",
project:,
user:)
- query.add_filter(cf_accessor, '=', ['me'])
+ query.add_filter(cf_accessor, "=", ["me"])
query.save!(validate: false)
query
@@ -178,14 +178,14 @@
current_user { User.anonymous }
- it 'shows an error visiting a query with a me value' do
+ it "shows an error visiting a query with a me value" do
wp_table.visit_query assignee_query
wp_table.expect_toast(type: :error,
- message: I18n.t('js.work_packages.faulty_query.description'))
+ message: I18n.t("js.work_packages.faulty_query.description"))
end
end
- context 'logged in' do
+ context "logged in" do
current_user { admin }
before do
@@ -193,26 +193,26 @@
wp_user
end
- it 'shows the one work package filtering for myself' do
+ it "shows the one work package filtering for myself" do
wp_table.visit!
wp_table.expect_work_package_listed(wp_admin, wp_user)
# Add and save query with me filter
filters.open
- filters.remove_filter 'status'
- filters.add_filter_by('CF user', 'is (OR)', 'me', cf_accessor_frontend)
+ filters.remove_filter "status"
+ filters.add_filter_by("CF user", "is (OR)", "me", cf_accessor_frontend)
wp_table.ensure_work_package_not_listed!(wp_user)
wp_table.expect_work_package_listed(wp_admin)
- wp_table.save_as('Me query')
+ wp_table.save_as("Me query")
loading_indicator_saveguard
# Expect correct while saving
- wp_table.expect_title 'Me query'
+ wp_table.expect_title "Me query"
query = Query.last
- expect(query.filters.first.values).to eq ['me']
- filters.expect_filter_by('CF user', 'is (OR)', 'me', cf_accessor_frontend)
+ expect(query.filters.first.values).to eq ["me"]
+ filters.expect_filter_by("CF user", "is (OR)", "me", cf_accessor_frontend)
# Revisit query
wp_table.visit_query query
@@ -220,7 +220,7 @@
wp_table.expect_work_package_listed(wp_admin)
filters.open
- filters.expect_filter_by('CF user', 'is (OR)', 'me', cf_accessor_frontend)
+ filters.expect_filter_by("CF user", "is (OR)", "me", cf_accessor_frontend)
end
end
end
diff --git a/spec/features/work_packages/table/queries/mobile_date_filter_spec.rb b/spec/features/work_packages/table/queries/mobile_date_filter_spec.rb
index 9d44493d1c24..f713d338d13a 100644
--- a/spec/features/work_packages/table/queries/mobile_date_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/mobile_date_filter_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'mobile date filter work packages', :js, :with_cuprite do
+RSpec.describe "mobile date filter work packages", :js, :with_cuprite do
shared_let(:user) { create(:admin) }
shared_let(:project) { create(:project) }
shared_let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -39,20 +39,20 @@
current_user { user }
- include_context 'with mobile screen size'
+ include_context "with mobile screen size"
before do
wp_table.visit!
end
- context 'when filtering between finish date' do
- it 'allows filtering, saving and retrieving and altering the saved filter' do
+ context "when filtering between finish date" do
+ it "allows filtering, saving and retrieving and altering the saved filter" do
filters.open
- filters.add_filter('Finish date')
- filters.set_operator('Finish date', 'between', 'dueDate')
+ filters.add_filter("Finish date")
+ filters.set_operator("Finish date", "between", "dueDate")
- start_field = find_test_selector('op-basic-range-date-picker-start')
- end_field = find_test_selector('op-basic-range-date-picker-end')
+ start_field = find_test_selector("op-basic-range-date-picker-start")
+ end_field = find_test_selector("op-basic-range-date-picker-end")
clear_input_field_contents(start_field)
clear_input_field_contents(end_field)
@@ -69,8 +69,8 @@
wp_cards.expect_work_package_listed work_package_with_due_date
wp_cards.expect_work_package_not_listed work_package_without_due_date
- wp_table.save_as('Some query name')
- wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_table.save_as("Some query name")
+ wp_table.expect_and_dismiss_toaster(message: "Successful creation.")
last_query = Query.last
date_filter = last_query.filters.last
@@ -78,14 +78,14 @@
end
end
- context 'when filtering on finish date' do
- it 'allows filtering, saving and retrieving and altering the saved filter' do
+ context "when filtering on finish date" do
+ it "allows filtering, saving and retrieving and altering the saved filter" do
filters.open
- filters.add_filter('Finish date')
- filters.set_operator('Finish date', 'on', 'dueDate')
+ filters.add_filter("Finish date")
+ filters.set_operator("Finish date", "on", "dueDate")
- date_field = find_field 'values-dueDate'
- expect(date_field['type']).to eq 'date'
+ date_field = find_field "values-dueDate"
+ expect(date_field["type"]).to eq "date"
clear_input_field_contents(date_field)
date_field.set Date.current
@@ -97,8 +97,8 @@
wp_cards.expect_work_package_listed work_package_with_due_date
wp_cards.expect_work_package_not_listed work_package_without_due_date
- wp_table.save_as('Some query name')
- wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_table.save_as("Some query name")
+ wp_table.expect_and_dismiss_toaster(message: "Successful creation.")
last_query = Query.last
date_filter = last_query.filters.last
diff --git a/spec/features/work_packages/table/queries/query_history_spec.rb b/spec/features/work_packages/table/queries/query_history_spec.rb
index 68aca098eac1..43eb03f071f9 100644
--- a/spec/features/work_packages/table/queries/query_history_spec.rb
+++ b/spec/features/work_packages/table/queries/query_history_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Going back and forth through the browser history', :js do
+RSpec.describe "Going back and forth through the browser history", :js do
let(:user) do
create(:user, member_with_roles: { project => role })
end
@@ -63,22 +63,22 @@
end
let(:assignee_query) do
query = create(:query,
- name: 'Assignee Query',
+ name: "Assignee Query",
project:,
user:)
- query.add_filter('assigned_to_id', '=', [user.id])
+ query.add_filter("assigned_to_id", "=", [user.id])
query.save!
query
end
let(:version_query) do
query = create(:query,
- name: 'Version Query',
+ name: "Version Query",
project:,
user:)
- query.add_filter('version_id', '=', [version.id])
+ query.add_filter("version_id", "=", [version.id])
query.save!
query
@@ -97,9 +97,9 @@
version_query
end
- it 'updates the filters and query results on history back and forth', retry: 1 do
+ it "updates the filters and query results on history back and forth", retry: 1 do
wp_table.visit!
- wp_table.expect_title('All open', editable: true)
+ wp_table.expect_title("All open", editable: true)
wp_table.visit_query(assignee_query)
wp_table.expect_title(assignee_query.name)
@@ -110,58 +110,58 @@
wp_table.expect_work_package_listed work_package_3
filters.open
- filters.add_filter_by('Assignee', 'is (OR)', user.name)
+ filters.add_filter_by("Assignee", "is (OR)", user.name)
filters.expect_filter_count 3
wp_table.expect_no_work_package_listed
- page.execute_script('window.history.back()')
+ page.execute_script("window.history.back()")
wp_table.expect_title(version_query.name)
wp_table.expect_work_package_listed work_package_3
filters.expect_filter_count 2
- filters.expect_filter_by('Status', 'open', nil)
- filters.expect_filter_by('Version', 'is (OR)', version.name)
+ filters.expect_filter_by("Status", "open", nil)
+ filters.expect_filter_by("Version", "is (OR)", version.name)
- page.execute_script('window.history.back()')
+ page.execute_script("window.history.back()")
wp_table.expect_title(assignee_query.name)
wp_table.expect_work_package_listed work_package_2
filters.open
- filters.expect_filter_by('Status', 'open', nil)
- filters.expect_filter_by('Assignee', 'is (OR)', user.name)
+ filters.expect_filter_by("Status", "open", nil)
+ filters.expect_filter_by("Assignee", "is (OR)", user.name)
- page.execute_script('window.history.back()')
+ page.execute_script("window.history.back()")
- wp_table.expect_title('All open', editable: true)
+ wp_table.expect_title("All open", editable: true)
wp_table.expect_work_package_listed work_package_1
wp_table.expect_work_package_listed work_package_2
wp_table.expect_work_package_listed work_package_3
filters.open
- filters.expect_filter_by('Status', 'open', nil)
+ filters.expect_filter_by("Status", "open", nil)
- page.execute_script('window.history.forward()')
+ page.execute_script("window.history.forward()")
wp_table.expect_title(assignee_query.name)
wp_table.expect_work_package_listed work_package_2
filters.open
- filters.expect_filter_by('Status', 'open', nil)
- filters.expect_filter_by('Assignee', 'is (OR)', user.name)
+ filters.expect_filter_by("Status", "open", nil)
+ filters.expect_filter_by("Assignee", "is (OR)", user.name)
- page.execute_script('window.history.forward()')
+ page.execute_script("window.history.forward()")
wp_table.expect_title(version_query.name)
wp_table.expect_work_package_listed work_package_3
filters.open
- filters.expect_filter_by('Status', 'open', nil)
- filters.expect_filter_by('Version', 'is (OR)', version.name)
+ filters.expect_filter_by("Status", "open", nil)
+ filters.expect_filter_by("Version", "is (OR)", version.name)
- page.execute_script('window.history.forward()')
+ page.execute_script("window.history.forward()")
wp_table.expect_title(version_query.name)
wp_table.expect_no_work_package_listed
filters.open
- filters.expect_filter_by('Status', 'open', nil)
- filters.expect_filter_by('Version', 'is (OR)', version.name)
- filters.expect_filter_by('Assignee', 'is (OR)', user.name)
+ filters.expect_filter_by("Status", "open", nil)
+ filters.expect_filter_by("Version", "is (OR)", version.name)
+ filters.expect_filter_by("Assignee", "is (OR)", user.name)
end
end
diff --git a/spec/features/work_packages/table/queries/query_menu_refresh_spec.rb b/spec/features/work_packages/table/queries/query_menu_refresh_spec.rb
index 628cb1680b7b..bccccfa2ad80 100644
--- a/spec/features/work_packages/table/queries/query_menu_refresh_spec.rb
+++ b/spec/features/work_packages/table/queries/query_menu_refresh_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Refreshing query menu item', :js do
+RSpec.describe "Refreshing query menu item", :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -42,17 +42,17 @@
wp_table.visit!
end
- it 'allows refreshing the current query (Bug #26921)' do
+ it "allows refreshing the current query (Bug #26921)" do
wp_table.expect_work_package_listed work_package
# Instantiate lazy let here
wp_table.ensure_work_package_not_listed! other_work_package
- wp_table.save_as('Some query name')
+ wp_table.save_as("Some query name")
# Publish query
- wp_table.click_setting_item I18n.t('js.toolbar.settings.visibility_settings')
- find_by_id('show-in-menu').set true
- find('.button', text: 'Save').click
+ wp_table.click_setting_item I18n.t("js.toolbar.settings.visibility_settings")
+ find_by_id("show-in-menu").set true
+ find(".button", text: "Save").click
last_query = Query.last
url = URI.parse(page.current_url).query
diff --git a/spec/features/work_packages/table/queries/query_menu_spec.rb b/spec/features/work_packages/table/queries/query_menu_spec.rb
index 32c64a99b021..542f6da8d910 100644
--- a/spec/features/work_packages/table/queries/query_menu_spec.rb
+++ b/spec/features/work_packages/table/queries/query_menu_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Query menu item', :js do
+RSpec.describe "Query menu item", :js do
let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:filters) { Components::WorkPackages::Filters.new }
@@ -36,36 +36,36 @@
current_user { create(:admin) }
- context 'when visiting the global work packages page' do
+ context "when visiting the global work packages page" do
let(:wp_table) { Pages::WorkPackagesTable.new }
let(:project) { nil }
let!(:global_public_view) do
create(:view,
- query: create(:query, project: nil, public: true, name: 'Global public'))
+ query: create(:query, project: nil, public: true, name: "Global public"))
end
let!(:global_my_view) do
create(:view,
- query: create(:query, project: nil, public: false, user: current_user, name: 'Global my view'))
+ query: create(:query, project: nil, public: false, user: current_user, name: "Global my view"))
end
let!(:global_other_view) do
create(:view,
- query: create(:query, project: nil, public: false, user: create(:user), name: 'Other user query'))
+ query: create(:query, project: nil, public: false, user: create(:user), name: "Other user query"))
end
let!(:project_view) do
create(:view,
- query: create(:query, project: create(:project), name: 'Project query'))
+ query: create(:query, project: create(:project), name: "Project query"))
end
- it 'shows the query menu with queries stored for the global page' do
+ it "shows the query menu with queries stored for the global page" do
wp_table.visit!
- expect(page).to have_css('.op-view-select--search-results')
- expect(page).to have_css('.op-sidemenu--item-action', wait: 20, minimum: 1)
+ expect(page).to have_css(".op-view-select--search-results")
+ expect(page).to have_css(".op-sidemenu--item-action", wait: 20, minimum: 1)
- within '.op-sidebar' do
+ within ".op-sidebar" do
expect(page)
.to have_content(global_my_view.query.name, wait: 10)
expect(page)
@@ -78,7 +78,7 @@
end
end
- context 'when filtering by version in project' do
+ context "when filtering by version in project" do
let(:version) { create(:version, project:) }
let(:work_package_with_version) { create(:work_package, project:, version:) }
let(:work_package_without_version) { create(:work_package, project:) }
@@ -90,46 +90,46 @@
wp_table.visit!
end
- it 'allows to save query as name with sharing options (Regression #27915)' do
+ it "allows to save query as name with sharing options (Regression #27915)" do
# Publish query
- wp_table.click_setting_item 'Save as'
+ wp_table.click_setting_item "Save as"
- fill_in 'save-query-name', with: 'Some query name'
- find_by_id('show-in-menu').set true
- find_by_id('show-public').set true
+ fill_in "save-query-name", with: "Some query name"
+ find_by_id("show-in-menu").set true
+ find_by_id("show-public").set true
- find('.button', text: 'Save').click
+ find(".button", text: "Save").click
- expect(page).to have_css('.op-sidemenu--item-action', text: 'Some query name', wait: 20)
+ expect(page).to have_css(".op-sidemenu--item-action", text: "Some query name", wait: 20)
last_query = Query.last
expect(last_query.public).to be_truthy
end
- it 'only saves a single query when saving through the title input (Regression #31095)' do
+ it "only saves a single query when saving through the title input (Regression #31095)" do
filters.open
- filters.remove_filter('status')
+ filters.remove_filter("status")
filters.expect_filter_count 0
query_title.expect_changed
query_title.input_field.click
- query_title.rename 'My special query!123'
+ query_title.rename "My special query!123"
- query_title.expect_title 'My special query!123'
- expect(page).to have_css('.op-sidemenu--item-action', text: 'My special query!123', wait: 20, count: 1)
+ query_title.expect_title "My special query!123"
+ expect(page).to have_css(".op-sidemenu--item-action", text: "My special query!123", wait: 20, count: 1)
end
- it 'allows filtering, saving, retrieving and altering the saved filter (Regression #25372)' do
+ it "allows filtering, saving, retrieving and altering the saved filter (Regression #25372)" do
filters.open
- filters.add_filter_by('Version', 'is (OR)', version.name)
+ filters.add_filter_by("Version", "is (OR)", version.name)
wp_table.expect_work_package_listed work_package_with_version
wp_table.ensure_work_package_not_listed! work_package_without_version
- wp_table.save_as('Some query name')
+ wp_table.save_as("Some query name")
- filters.remove_filter 'version'
+ filters.remove_filter "version"
filters.expect_filter_count 1
wp_table.expect_work_package_listed work_package_with_version, work_package_without_version
@@ -139,27 +139,27 @@
expect(URI.parse(page.current_url).query).to include("query_id=#{last_query.id}&query_props=")
# Publish query
- wp_table.click_setting_item I18n.t('js.label_visibility_settings')
- find_by_id('show-in-menu').set true
- find('.button', text: 'Save').click
+ wp_table.click_setting_item I18n.t("js.label_visibility_settings")
+ find_by_id("show-in-menu").set true
+ find(".button", text: "Save").click
wp_table.visit!
loading_indicator_saveguard
filters.open
- filters.remove_filter 'status'
+ filters.remove_filter "status"
filters.expect_filter_count 0
wp_table.expect_work_package_listed work_package_with_version, work_package_without_version
# Locate query
- query_item = page.find(".op-sidemenu--item-action", text: 'Some query name')
+ query_item = page.find(".op-sidemenu--item-action", text: "Some query name")
query_item.click
# Overrides the query_props
retry_block do
# Run in retry block because page.current_url is not synchronized
- raise 'query_props should not be in URL path' if page.current_url.include?('query_props')
+ raise "query_props should not be in URL path" if page.current_url.include?("query_props")
end
wp_table.expect_work_package_listed work_package_with_version
@@ -167,24 +167,24 @@
filters.expect_filter_count 2
filters.open
- filters.expect_filter_by('Version', 'is (OR)', version.name)
+ filters.expect_filter_by("Version", "is (OR)", version.name)
# Removing the filter and returning to query restores it
- filters.remove_filter 'version'
+ filters.remove_filter "version"
filters.expect_filter_count 1
- expect(page.current_url).to include('query_props')
+ expect(page.current_url).to include("query_props")
- query_item = page.find(".op-sidemenu--item-action", text: 'Some query name')
+ query_item = page.find(".op-sidemenu--item-action", text: "Some query name")
query_item.click
retry_block do
# Run in retry block because page.current_url is not synchronized
- raise 'query_props should not be in URL path' if page.current_url.include?('query_props')
+ raise "query_props should not be in URL path" if page.current_url.include?("query_props")
end
filters.expect_filter_count 2
filters.open
- filters.expect_filter_by('Version', 'is (OR)', version.name)
+ filters.expect_filter_by("Version", "is (OR)", version.name)
end
end
end
diff --git a/spec/features/work_packages/table/queries/query_name_inline_edit_spec.rb b/spec/features/work_packages/table/queries/query_name_inline_edit_spec.rb
index 0a6494aa5ca3..095d2e47754e 100644
--- a/spec/features/work_packages/table/queries/query_name_inline_edit_spec.rb
+++ b/spec/features/work_packages/table/queries/query_name_inline_edit_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Query name inline edit', :js do
+RSpec.describe "Query name inline edit", :js do
let(:user) do
create(:user, member_with_roles: { project => role })
end
@@ -49,11 +49,11 @@
let(:assignee_query) do
query = create(:query,
- name: 'Assignee Query',
+ name: "Assignee Query",
project:,
user:)
- query.add_filter('assigned_to_id', '=', [user.id])
+ query.add_filter("assigned_to_id", "=", [user.id])
query.save!
query
@@ -71,7 +71,7 @@
wp_table.visit_query assignee_query
end
- it 'allows renaming the query and shows changed state' do
+ it "allows renaming the query and shows changed state" do
wp_table.expect_work_package_listed work_package
query_title.expect_not_changed
@@ -90,7 +90,7 @@
# TODO: The notification should actually not be shown at all since no update
# has taken place
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
assignee_query.reload
expect(assignee_query.filters.count).to eq(1)
@@ -101,35 +101,35 @@
expect(url).not_to match(/query_props=.+/)
# Rename query
- query_title.rename 'Not my assignee query'
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ query_title.rename "Not my assignee query"
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
assignee_query.reload
- expect(assignee_query.name).to eq 'Not my assignee query'
+ expect(assignee_query.name).to eq "Not my assignee query"
# Rename query through context menu
- wp_table.click_setting_item 'Rename view'
+ wp_table.click_setting_item "Rename view"
- expect(page).to have_focus_on('.editable-toolbar-title--input')
- page.driver.browser.switch_to.active_element.send_keys('Some other name')
+ expect(page).to have_focus_on(".editable-toolbar-title--input")
+ page.driver.browser.switch_to.active_element.send_keys("Some other name")
page.driver.browser.switch_to.active_element.send_keys(:return)
- wp_table.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_table.expect_and_dismiss_toaster message: "Successful update."
assignee_query.reload
- expect(assignee_query.name).to eq 'Some other name'
+ expect(assignee_query.name).to eq "Some other name"
end
- it 'shows the save icon when changing the columns (Regression #32835)' do
+ it "shows the save icon when changing the columns (Regression #32835)" do
wp_table.expect_work_package_listed work_package
query_title.expect_not_changed
modal.open!
- modal.switch_to 'Columns'
+ modal.switch_to "Columns"
columns.assume_opened
columns.uncheck_all save_changes: false
- columns.add 'Subject', save_changes: true
+ columns.add "Subject", save_changes: true
query_title.expect_changed
end
diff --git a/spec/features/work_packages/table/queries/responsible_filter_spec.rb b/spec/features/work_packages/table/queries/responsible_filter_spec.rb
index 8f2b2b46f923..2e620d6806e1 100644
--- a/spec/features/work_packages/table/queries/responsible_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/responsible_filter_spec.rb
@@ -26,17 +26,17 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package filtering by responsible', :js do
+RSpec.describe "Work package filtering by responsible", :js do
let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:filters) { Components::WorkPackages::Filters.new }
let(:role) { create(:project_role, permissions: %i[view_work_packages save_queries]) }
let(:other_user) do
create(:user,
- firstname: 'Other',
- lastname: 'User',
+ firstname: "Other",
+ lastname: "User",
member_with_roles: { project => role })
end
let(:placeholder_user) do
@@ -59,19 +59,19 @@
create(:user, member_with_roles: { project => role })
end
- it 'shows the work package matching the responsible filter' do
+ it "shows the work package matching the responsible filter" do
wp_table.visit!
wp_table.expect_work_package_listed(work_package_user_responsible, work_package_placeholder_user_responsible)
filters.open
- filters.add_filter_by('Accountable', 'is (OR)', [other_user.name], 'responsible')
+ filters.add_filter_by("Accountable", "is (OR)", [other_user.name], "responsible")
wp_table.ensure_work_package_not_listed!(work_package_placeholder_user_responsible)
wp_table.expect_work_package_listed(work_package_user_responsible)
- wp_table.save_as('Responsible query')
+ wp_table.save_as("Responsible query")
- wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_table.expect_and_dismiss_toaster(message: "Successful creation.")
# Revisit query
wp_table.visit_query Query.last
@@ -79,9 +79,9 @@
wp_table.expect_work_package_listed(work_package_user_responsible)
filters.open
- filters.expect_filter_by('Accountable', 'is (OR)', [other_user.name], 'responsible')
- filters.remove_filter 'responsible'
- filters.add_filter_by('Accountable', 'is (OR)', [placeholder_user.name], 'responsible')
+ filters.expect_filter_by("Accountable", "is (OR)", [other_user.name], "responsible")
+ filters.remove_filter "responsible"
+ filters.add_filter_by("Accountable", "is (OR)", [placeholder_user.name], "responsible")
wp_table.ensure_work_package_not_listed!(work_package_user_responsible)
wp_table.expect_work_package_listed(work_package_placeholder_user_responsible)
diff --git a/spec/features/work_packages/table/queries/shared_with_user_filter_spec.rb b/spec/features/work_packages/table/queries/shared_with_user_filter_spec.rb
index 19a24079fa70..92bf7c46d68a 100644
--- a/spec/features/work_packages/table/queries/shared_with_user_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/shared_with_user_filter_spec.rb
@@ -28,10 +28,10 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package filtering',
- 'by shared with user',
+RSpec.describe "Work package filtering",
+ "by shared with user",
:js,
:with_cuprite do
shared_let(:visible_project) do
@@ -58,26 +58,26 @@
shared_let(:user_with_sufficient_permissions) do
create(:user,
- firstname: 'Bruce',
- lastname: 'Wayne',
+ firstname: "Bruce",
+ lastname: "Wayne",
member_with_roles: { visible_project => project_role_with_sufficient_permissions })
end
shared_let(:user_with_insufficient_permissions) do
create(:user,
- firstname: 'Alfred',
- lastname: 'Pennyworth',
+ firstname: "Alfred",
+ lastname: "Pennyworth",
member_with_roles: { visible_project => project_role_with_insufficient_permissions })
end
shared_let(:user_with_shared_work_package) do
create(:user,
- firstname: 'Clark',
- lastname: 'Kent',
+ firstname: "Clark",
+ lastname: "Kent",
member_with_roles: { visible_project => project_role_with_insufficient_permissions })
end
shared_let(:invisible_user) do
create(:user,
- firstname: 'Salvatore',
- lastname: 'Maroni',
+ firstname: "Salvatore",
+ lastname: "Maroni",
member_with_roles: { invisible_project => project_role_with_insufficient_permissions })
end
@@ -102,32 +102,32 @@
context 'when I have sufficient permissions for the "Shared with user" filter' do
current_user { user_with_sufficient_permissions }
- it 'filters work packages by their shared status' do
+ it "filters work packages by their shared status" do
wp_table.visit!
wp_table.expect_work_package_listed(shared_work_package, non_shared_work_package)
filters.open
aggregate_failures "Members of a Project I'm not a member of are invisible" do
- filters.expect_missing_filter_value_by('Shared with user',
- 'is (OR)',
+ filters.expect_missing_filter_value_by("Shared with user",
+ "is (OR)",
[invisible_user.name],
- 'sharedWithUser')
+ "sharedWithUser")
end
- aggregate_failures 'operator filtering' do
- filters.add_filter_by('Shared with user',
- 'is (OR)',
+ aggregate_failures "operator filtering" do
+ filters.add_filter_by("Shared with user",
+ "is (OR)",
[user_with_shared_work_package.name],
- 'sharedWithUser')
+ "sharedWithUser")
wp_table.ensure_work_package_not_listed!(non_shared_work_package)
wp_table.expect_work_package_listed(shared_work_package)
end
- aggregate_failures 'Filters persist on saved query' do
- wp_table.save_as('Non shared work packages')
+ aggregate_failures "Filters persist on saved query" do
+ wp_table.save_as("Non shared work packages")
- wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_table.expect_and_dismiss_toaster(message: "Successful creation.")
wp_table.visit_query Query.last
wp_table.ensure_work_package_not_listed!(non_shared_work_package)
@@ -143,7 +143,7 @@
wp_table.visit!
wp_table.expect_work_package_listed(shared_work_package, non_shared_work_package)
filters.open
- filters.expect_missing_filter('Shared with user')
+ filters.expect_missing_filter("Shared with user")
end
end
end
diff --git a/spec/features/work_packages/table/queries/subject_filter_spec.rb b/spec/features/work_packages/table/queries/subject_filter_spec.rb
index d752c73be0ab..15eebdf062ca 100644
--- a/spec/features/work_packages/table/queries/subject_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/subject_filter_spec.rb
@@ -26,41 +26,41 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package filtering by subject', :js do
+RSpec.describe "Work package filtering by subject", :js do
let(:project) { create(:project, public: true) }
let(:admin) { create(:admin) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:filters) { Components::WorkPackages::Filters.new }
- let!(:wp_match) { create(:work_package, project:, subject: 'R#1234 Foobar') }
- let!(:wp_nomatch) { create(:work_package, project:, subject: 'R!1234 Foobar') }
+ let!(:wp_match) { create(:work_package, project:, subject: "R#1234 Foobar") }
+ let!(:wp_nomatch) { create(:work_package, project:, subject: "R!1234 Foobar") }
before do
login_as admin
end
- it 'shows the one work package filtering for myself' do
+ it "shows the one work package filtering for myself" do
wp_table.visit!
wp_table.expect_work_package_listed(wp_match, wp_nomatch)
# Add and save query with me filter
filters.open
- filters.remove_filter 'status'
- filters.add_filter_by('Subject', 'contains', ['R#'])
+ filters.remove_filter "status"
+ filters.add_filter_by("Subject", "contains", ["R#"])
wp_table.ensure_work_package_not_listed!(wp_nomatch)
wp_table.expect_work_package_listed(wp_match)
- wp_table.save_as('Subject query')
+ wp_table.save_as("Subject query")
loading_indicator_saveguard
# Expect correct while saving
- wp_table.expect_title 'Subject query'
+ wp_table.expect_title "Subject query"
query = Query.last
- expect(query.filters.first.values).to eq ['R#']
- filters.expect_filter_by('Subject', 'contains', ['R#'])
+ expect(query.filters.first.values).to eq ["R#"]
+ filters.expect_filter_by("Subject", "contains", ["R#"])
# Revisit query
wp_table.visit_query query
@@ -68,6 +68,6 @@
wp_table.expect_work_package_listed(wp_match)
filters.open
- filters.expect_filter_by('Subject', 'contains', ['R#'])
+ filters.expect_filter_by("Subject", "contains", ["R#"])
end
end
diff --git a/spec/features/work_packages/table/queries/summary_spec.rb b/spec/features/work_packages/table/queries/summary_spec.rb
index 861f64f13a47..56bcbd4ac446 100644
--- a/spec/features/work_packages/table/queries/summary_spec.rb
+++ b/spec/features/work_packages/table/queries/summary_spec.rb
@@ -26,11 +26,11 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/work_packages/work_packages_page'
+require "spec_helper"
+require "features/work_packages/work_packages_page"
-RSpec.describe 'Work package query summary item', :js do
- let(:project) { create(:project, identifier: 'test_project', public: false) }
+RSpec.describe "Work package query summary item", :js do
+ let(:project) { create(:project, identifier: "test_project", public: false) }
let(:role) { create(:project_role, permissions: [:view_work_packages]) }
let(:work_package) { create(:work_package, project:) }
let(:wp_page) { Pages::WorkPackagesTable.new project }
@@ -43,9 +43,9 @@
wp_page.visit!
end
- it 'allows users to visit the summary page' do
- find('.op-sidemenu--item-action', text: 'Summary', wait: 10).click
- expect(page).to have_css('h2', text: 'Summary')
- expect(page).to have_css('td', text: work_package.type.name)
+ it "allows users to visit the summary page" do
+ find(".op-sidemenu--item-action", text: "Summary", wait: 10).click
+ expect(page).to have_css("h2", text: "Summary")
+ expect(page).to have_css("td", text: work_package.type.name)
end
end
diff --git a/spec/features/work_packages/table/queries/user_cf_filter_spec.rb b/spec/features/work_packages/table/queries/user_cf_filter_spec.rb
index d974c5ab2637..494544d4367a 100644
--- a/spec/features/work_packages/table/queries/user_cf_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/user_cf_filter_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work package filtering by user custom field', :js do
+RSpec.describe "Work package filtering by user custom field", :js do
let(:project) { create(:project) }
let(:type) { project.types.first }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -42,8 +42,8 @@
let(:role) { create(:project_role, permissions: %i[view_work_packages save_queries]) }
let!(:other_user) do
create(:user,
- firstname: 'Other',
- lastname: 'User',
+ firstname: "Other",
+ lastname: "User",
member_with_roles: { project => role })
end
let!(:placeholder_user) do
@@ -84,7 +84,7 @@
create(:user, member_with_roles: { project => role })
end
- it 'shows the work package matching the user cf filter' do
+ it "shows the work package matching the user cf filter" do
wp_table.visit!
wp_table.expect_work_package_listed(work_package_user, work_package_placeholder, work_package_group)
@@ -92,14 +92,14 @@
# Filtering by user
- filters.add_filter_by(user_cf.name, 'is (OR)', [other_user.name], user_cf.attribute_name(:camel_case))
+ filters.add_filter_by(user_cf.name, "is (OR)", [other_user.name], user_cf.attribute_name(:camel_case))
wp_table.ensure_work_package_not_listed!(work_package_placeholder, work_package_group)
wp_table.expect_work_package_listed(work_package_user)
- wp_table.save_as('Saved query')
+ wp_table.save_as("Saved query")
- wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')
+ wp_table.expect_and_dismiss_toaster(message: "Successful creation.")
# Revisit query
wp_table.visit_query Query.last
@@ -107,12 +107,12 @@
wp_table.expect_work_package_listed(work_package_user)
filters.open
- filters.expect_filter_by(user_cf.name, 'is (OR)', [other_user.name], "customField#{user_cf.id}")
+ filters.expect_filter_by(user_cf.name, "is (OR)", [other_user.name], "customField#{user_cf.id}")
# Filtering by placeholder
filters.remove_filter user_cf.attribute_name(:camel_case)
- filters.add_filter_by(user_cf.name, 'is (OR)', [placeholder_user.name], user_cf.attribute_name(:camel_case))
+ filters.add_filter_by(user_cf.name, "is (OR)", [placeholder_user.name], user_cf.attribute_name(:camel_case))
wp_table.ensure_work_package_not_listed!(work_package_user, work_package_group)
wp_table.expect_work_package_listed(work_package_placeholder)
@@ -120,7 +120,7 @@
# Filtering by group
filters.remove_filter user_cf.attribute_name(:camel_case)
- filters.add_filter_by(user_cf.name, 'is (OR)', [group.name], user_cf.attribute_name(:camel_case))
+ filters.add_filter_by(user_cf.name, "is (OR)", [group.name], user_cf.attribute_name(:camel_case))
wp_table.ensure_work_package_not_listed!(work_package_user, work_package_placeholder)
wp_table.expect_work_package_listed(work_package_group)
diff --git a/spec/features/work_packages/table/queries/version_cf_filter_spec.rb b/spec/features/work_packages/table/queries/version_cf_filter_spec.rb
index 939560142d79..027ee07e9820 100644
--- a/spec/features/work_packages/table/queries/version_cf_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/version_cf_filter_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
# This is not strictly version CF specific, but targets regression #53198.
-RSpec.describe 'Work package filtering by version custom field', :js do
+RSpec.describe "Work package filtering by version custom field", :js do
let!(:project) { create(:project) }
let!(:type) { project.types.first }
let!(:version_cf1) do
@@ -50,8 +50,8 @@
projects: [project]
)
end
- let!(:version_1) { create(:version, project:, name: 'Version 1') }
- let!(:version_2) { create(:version, project:, name: 'Version 2') }
+ let!(:version_1) { create(:version, project:, name: "Version 1") }
+ let!(:version_2) { create(:version, project:, name: "Version 2") }
let(:role) { create(:project_role, permissions: %i[view_work_packages save_queries]) }
@@ -101,14 +101,14 @@
# Filtering by cf1 "is (AND)"
- filters.add_filter_by(version_cf1.name, 'is (AND)', [version_1.name], version_cf1.attribute_name(:camel_case))
+ filters.add_filter_by(version_cf1.name, "is (AND)", [version_1.name], version_cf1.attribute_name(:camel_case))
wp_table.expect_work_package_listed(work_package_1_1, work_package_mix)
wp_table.ensure_work_package_not_listed!(work_package_2_1)
# Filtering by multiple cf1 values (nothing matches)
filters.remove_filter version_cf1.attribute_name(:camel_case)
- filters.add_filter_by(version_cf1.name, 'is (AND)', [version_1.name, version_2.name], version_cf1.attribute_name(:camel_case))
+ filters.add_filter_by(version_cf1.name, "is (AND)", [version_1.name, version_2.name], version_cf1.attribute_name(:camel_case))
wp_table.ensure_work_package_not_listed!(work_package_2_1, work_package_1_1, work_package_mix)
end
@@ -120,7 +120,7 @@
filters.open
# Filtering by cf1 "is not"
- filters.add_filter_by(version_cf2.name, 'is not', [version_1.name], version_cf2.attribute_name(:camel_case))
+ filters.add_filter_by(version_cf2.name, "is not", [version_1.name], version_cf2.attribute_name(:camel_case))
wp_table.expect_work_package_listed(work_package_mix, work_package_1_1)
wp_table.ensure_work_package_not_listed!(work_package_2_1)
diff --git a/spec/features/work_packages/table/relations_spec.rb b/spec/features/work_packages/table/relations_spec.rb
index eb071852840f..09cfa53da44b 100644
--- a/spec/features/work_packages/table/relations_spec.rb
+++ b/spec/features/work_packages/table/relations_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Package table relations', :js, with_ee: %i[work_package_query_relation_columns] do
+RSpec.describe "Work Package table relations", :js, with_ee: %i[work_package_query_relation_columns] do
let(:user) { create(:admin) }
let(:type) { create(:type) }
@@ -29,7 +29,7 @@
end
let!(:query) do
query = build(:query, user:, project:)
- query.column_names = ['subject']
+ query.column_names = ["subject"]
query.filters.clear
query.save!
@@ -37,14 +37,14 @@
end
let(:type_column_id) { "relationsToType#{type.id}" }
- let(:type_column_follows) { 'relationsOfTypeFollows' }
+ let(:type_column_follows) { "relationsOfTypeFollows" }
before do
login_as(user)
end
- describe 'with relation columns allowed by the enterprise token' do
- it 'displays expandable relation columns' do
+ describe "with relation columns allowed by the enterprise token" do
+ it "displays expandable relation columns" do
# Now visiting the query for category
wp_table.visit_query(query)
wp_table.expect_work_package_listed(wp_from, wp_to, wp_to2)
@@ -56,8 +56,8 @@
wp_from_to = wp_table.row(wp_to)
# Expect count for wp_from in both columns to be one
- expect(wp_from_row).to have_css(".#{type_column_id} .wp-table--relation-count", text: '2')
- expect(wp_from_row).to have_css(".#{type_column_follows} .wp-table--relation-count", text: '2')
+ expect(wp_from_row).to have_css(".#{type_column_id} .wp-table--relation-count", text: "2")
+ expect(wp_from_row).to have_css(".#{type_column_follows} .wp-table--relation-count", text: "2")
# Expect count for wp_to in both columns to be not rendered
expect(wp_from_to).to have_no_css(".#{type_column_id} .wp-table--relation-count")
@@ -67,7 +67,7 @@
wp_from_row.find(".#{type_column_id} .wp-table--relation-indicator").click
expect(page).to have_css(".__relations-expanded-from-#{wp_from.id}", count: 2)
related_row = page.first(".__relations-expanded-from-#{wp_from.id}")
- expect(related_row).to have_css('td.wp-table--relation-cell-td', text: "Precedes")
+ expect(related_row).to have_css("td.wp-table--relation-cell-td", text: "Precedes")
# Collapse
wp_from_row.find(".#{type_column_id} .wp-table--relation-indicator").click
@@ -77,16 +77,16 @@
wp_from_row.find(".#{type_column_follows} .wp-table--relation-indicator").click
expect(page).to have_css(".__relations-expanded-from-#{wp_from.id}", count: 2)
related_row = page.first(".__relations-expanded-from-#{wp_from.id}")
- expect(related_row).to have_css('.wp-table--relation-cell-td', text: wp_to.type)
+ expect(related_row).to have_css(".wp-table--relation-cell-td", text: wp_to.type)
end
end
- describe 'with relation columns disallowed by the enterprise token', with_ee: false do
- it 'has no relation columns available for selection' do
+ describe "with relation columns disallowed by the enterprise token", with_ee: false do
+ it "has no relation columns available for selection" do
# Now visiting the query for category
wp_table.visit_query(query)
- columns.expect_column_not_available 'follows relations'
+ columns.expect_column_not_available "follows relations"
columns.expect_column_not_available "Relations to #{type.name}"
end
end
diff --git a/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb b/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb
index 0e190e3806f9..206306393551 100644
--- a/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb
+++ b/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Manual scheduling', :js do
+RSpec.describe "Manual scheduling", :js do
let(:project) { create(:project, types: [type]) }
let(:type) { create(:type) }
@@ -10,7 +10,7 @@
create(:work_package,
project:,
type:,
- subject: 'Parent')
+ subject: "Parent")
end
let!(:child) do
@@ -18,7 +18,7 @@
project:,
parent:,
type:,
- subject: 'Child')
+ subject: "Child")
end
let!(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -39,10 +39,10 @@
wp_table.expect_work_package_listed parent, child
end
- context 'with a user allowed to edit dates' do
+ context "with a user allowed to edit dates" do
let(:role) { create(:project_role, permissions: %i[view_work_packages edit_work_packages]) }
- it 'allows to edit start and due date multiple times switching between scheduling modes' do
+ it "allows to edit start and due date multiple times switching between scheduling modes" do
start_date = wp_table.edit_field(parent, :startDate)
due_date = wp_table.edit_field(parent, :dueDate)
@@ -57,8 +57,8 @@
start_date.within_modal do
expect(page).to have_css('input[name="startDate"][disabled]')
expect(page).to have_css('input[name="endDate"][disabled]')
- expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Cancel')
- expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Save')
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: "Cancel")
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: "Save")
end
start_date.toggle_scheduling_mode
@@ -67,8 +67,8 @@
start_date.within_modal do
expect(page).to have_css('input[name="startDate"]:not([disabled])')
expect(page).to have_css('input[name="endDate"]:not([disabled])')
- expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Cancel')
- expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Save')
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: "Cancel")
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: "Save")
end
start_date.cancel_by_click
@@ -89,10 +89,10 @@
# Expect not editable
start_date.within_modal do
- expect(page).to have_css('input[name=startDate][disabled]')
- expect(page).to have_css('input[name=endDate][disabled]')
- expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Cancel')
- expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Save')
+ expect(page).to have_css("input[name=startDate][disabled]")
+ expect(page).to have_css("input[name=endDate][disabled]")
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: "Cancel")
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: "Save")
end
start_date.toggle_scheduling_mode
@@ -100,25 +100,25 @@
# Expect not editable
start_date.within_modal do
- fill_in 'startDate', with: '2020-07-20'
- fill_in 'endDate', with: '2020-07-25'
+ fill_in "startDate", with: "2020-07-20"
+ fill_in "endDate", with: "2020-07-25"
end
# Wait for the debounce to be done
sleep 1
start_date.save!
- start_date.expect_state_text '07/20/2020'
- due_date.expect_state_text '07/25/2020'
+ start_date.expect_state_text "07/20/2020"
+ due_date.expect_state_text "07/25/2020"
parent.reload
expect(parent).to be_schedule_manually
- expect(parent.start_date.iso8601).to eq('2020-07-20')
- expect(parent.due_date.iso8601).to eq('2020-07-25')
+ expect(parent.start_date.iso8601).to eq("2020-07-20")
+ expect(parent.due_date.iso8601).to eq("2020-07-25")
end
end
- context 'with a user allowed to view only' do
+ context "with a user allowed to view only" do
let(:role) { create(:project_role, permissions: %i[view_work_packages]) }
end
end
diff --git a/spec/features/work_packages/table/switch_types_spec.rb b/spec/features/work_packages/table/switch_types_spec.rb
index 7299e1af63cf..e565ae3ccbeb 100644
--- a/spec/features/work_packages/table/switch_types_spec.rb
+++ b/spec/features/work_packages/table/switch_types_spec.rb
@@ -1,14 +1,14 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Switching types in work package table', :js do
+RSpec.describe "Switching types in work package table", :js do
let(:user) { create(:admin) }
- describe 'switching to required CF' do
+ describe "switching to required CF" do
let(:cf_req_text) do
create(
:work_package_custom_field,
- field_format: 'string',
- name: 'Required CF',
+ field_format: "string",
+ name: "Required CF",
is_required: true,
is_for_all: false
)
@@ -16,7 +16,7 @@
let(:cf_text) do
create(
:work_package_custom_field,
- field_format: 'string',
+ field_format: "string",
is_required: false,
is_for_all: false
)
@@ -34,7 +34,7 @@
end
let(:work_package) do
create(:work_package,
- subject: 'Foobar',
+ subject: "Foobar",
type: type_task,
project:)
end
@@ -42,7 +42,7 @@
let(:query) do
query = build(:query, user:, project:)
- query.column_names = ['id', 'subject', 'type', cf_text.column_name]
+ query.column_names = ["id", "subject", "type", cf_text.column_name]
query.save!
query
@@ -71,16 +71,16 @@ def req_text_field
wp_table.expect_work_package_listed(work_package)
end
- it 'switches the types correctly' do
+ it "switches the types correctly" do
expect(text_field).to be_editable
# Set non-required CF
text_field.activate!
- text_field.set_value 'Foobar'
+ text_field.set_value "Foobar"
text_field.save!
wp_table.expect_and_dismiss_toaster(
- message: 'Successful update. Click here to open this work package in fullscreen view.'
+ message: "Successful update. Click here to open this work package in fullscreen view."
)
# Switch type
@@ -94,11 +94,11 @@ def req_text_field
# Required CF requires activation
req_text_field.activate!
- req_text_field.set_value 'Required'
+ req_text_field.set_value "Required"
req_text_field.save!
wp_table.expect_and_dismiss_toaster(
- message: 'Successful update. Click here to open this work package in fullscreen view.'
+ message: "Successful update. Click here to open this work package in fullscreen view."
)
expect { text_field.display_element }.to raise_error(Capybara::ElementNotFound)
@@ -107,14 +107,14 @@ def req_text_field
type_field.set_value type_task.name
wp_table.expect_and_dismiss_toaster(
- message: 'Successful update. Click here to open this work package in fullscreen view.'
+ message: "Successful update. Click here to open this work package in fullscreen view."
)
expect(page).to have_no_css "#{req_text_field.selector} #{req_text_field.display_selector}"
expect { req_text_field.display_element }.to raise_error(Capybara::ElementNotFound)
end
- it 'can switch back from an open required CF (Regression test #28099)' do
+ it "can switch back from an open required CF (Regression test #28099)" do
# Switch type
type_field.activate!
type_field.set_value type_bug.name
@@ -133,17 +133,17 @@ def req_text_field
type_field.set_value type_task.name
wp_table.expect_and_dismiss_toaster(
- message: 'Successful update. Click here to open this work package in fullscreen view.'
+ message: "Successful update. Click here to open this work package in fullscreen view."
)
end
- context 'switching to single view' do
+ context "switching to single view" do
let(:wp_split) { wp_table.open_split_view(work_package) }
let(:type_field) { wp_split.edit_field(:type) }
let(:text_field) { wp_split.edit_field(cf_text.attribute_name(:camel_case)) }
let(:req_text_field) { wp_split.edit_field(cf_req_text.attribute_name(:camel_case)) }
- it 'allows editing and cancelling the new required fields' do
+ it "allows editing and cancelling the new required fields" do
wp_split
# Switch type
@@ -161,25 +161,25 @@ def req_text_field
# Cancel edition now
SeleniumHubWaiter.wait
req_text_field.cancel_by_escape
- req_text_field.expect_state_text '-'
+ req_text_field.expect_state_text "-"
# Set the value now
- req_text_field.update 'foobar'
+ req_text_field.update "foobar"
wp_table.expect_and_dismiss_toaster(
- message: 'Successful update. Click here to open this work package in fullscreen view.'
+ message: "Successful update. Click here to open this work package in fullscreen view."
)
- req_text_field.expect_state_text 'foobar'
+ req_text_field.expect_state_text "foobar"
end
end
end
- describe 'switching to required bool CF with default value' do
+ describe "switching to required bool CF with default value" do
let(:cf_req_bool) do
create(
:work_package_custom_field,
- field_format: 'bool',
+ field_format: "bool",
is_required: true,
default_value: false
)
@@ -197,7 +197,7 @@ def req_text_field
end
let(:work_package) do
create(:work_package,
- subject: 'Foobar',
+ subject: "Foobar",
type: type_task,
project:)
end
@@ -210,11 +210,11 @@ def req_text_field
wp_page.ensure_page_loaded
end
- it 'can switch to the bug type without errors' do
+ it "can switch to the bug type without errors" do
type_field.expect_state_text type_task.name.upcase
type_field.update type_bug.name
- wp_page.expect_and_dismiss_toaster message: 'Successful update.'
+ wp_page.expect_and_dismiss_toaster message: "Successful update."
type_field.expect_state_text type_bug.name.upcase
@@ -224,7 +224,7 @@ def req_text_field
end
end
- describe 'switching to list CF' do
+ describe "switching to list CF" do
let!(:wp_page) { Pages::FullWorkPackageCreate.new }
let!(:type_with_cf) { create(:type_task, custom_fields: [custom_field]) }
let!(:type) { create(:type_bug) }
@@ -264,7 +264,7 @@ def req_text_field
let(:cf_edit_field) do
field = wp_page.edit_field custom_field.attribute_name(:camel_case)
- field.field_type = 'create-autocompleter'
+ field.field_type = "create-autocompleter"
field
end
@@ -277,10 +277,10 @@ def req_text_field
SeleniumHubWaiter.wait
end
- it 'can switch to the type with CF list' do
+ it "can switch to the type with CF list" do
# Set subject
subject = wp_page.edit_field :subject
- subject.set_value 'My subject'
+ subject.set_value "My subject"
# Switch type
type_field = wp_page.edit_field :type
@@ -297,11 +297,11 @@ def req_text_field
wp_page.save!
wp_page.expect_toast(
- message: 'Successful creation.'
+ message: "Successful creation."
)
new_wp = WorkPackage.last
- expect(new_wp.subject).to eq('My subject')
+ expect(new_wp.subject).to eq("My subject")
expect(new_wp.type_id).to eq(type_with_cf.id)
expect(new_wp.custom_value_for(custom_field.id).map(&:typed_value)).to match_array(%w(pineapple mushrooms))
end
diff --git a/spec/features/work_packages/table/work_packages_table_project_include_spec.rb b/spec/features/work_packages/table/work_packages_table_project_include_spec.rb
index 9a7f79725644..8d34bf2d826a 100644
--- a/spec/features/work_packages/table/work_packages_table_project_include_spec.rb
+++ b/spec/features/work_packages/table/work_packages_table_project_include_spec.rb
@@ -26,25 +26,25 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require_relative '../project_include/project_include_shared_examples'
+require "spec_helper"
+require_relative "../project_include/project_include_shared_examples"
-RSpec.describe 'Work package project include', :js do
+RSpec.describe "Work package project include", :js do
shared_let(:enabled_modules) { %w[work_package_tracking] }
shared_let(:status) { create(:default_status) }
shared_let(:priority) { create(:default_priority) }
shared_let(:permissions) { %i[view_work_packages edit_work_packages add_work_packages save_queries manage_public_queries] }
- it_behaves_like 'has a project include dropdown' do
+ it_behaves_like "has a project include dropdown" do
shared_let(:work_package_view) { Pages::WorkPackagesTable.new(project) }
- it 'correctly filters work packages by project' do
+ it "correctly filters work packages by project" do
dropdown.expect_count 1
# Make sure the filter gets set once
dropdown.toggle!
dropdown.expect_open
- dropdown.click_button 'Apply'
+ dropdown.click_button "Apply"
dropdown.expect_closed
work_package_view.expect_work_package_listed(task, other_task, sub_bug, sub_sub_bug)
@@ -52,7 +52,7 @@
dropdown.toggle!
dropdown.toggle_checkbox(sub_sub_sub_project.id)
- dropdown.click_button 'Apply'
+ dropdown.click_button "Apply"
dropdown.expect_count 1
work_package_view.expect_work_package_listed(task, other_task, sub_sub_bug, sub_bug)
@@ -60,7 +60,7 @@
dropdown.toggle!
dropdown.toggle_checkbox(other_project.id)
- dropdown.click_button 'Apply'
+ dropdown.click_button "Apply"
dropdown.expect_count 2
work_package_view.expect_work_package_listed(task, other_task, sub_sub_bug, sub_bug, other_other_task)
@@ -70,14 +70,14 @@
work_package_view.expect_work_package_listed(task, other_task, sub_bug, sub_sub_bug, other_other_task)
end
- it 'creates new work packages in the host project of the work package view (regression #42271)' do
+ it "creates new work packages in the host project of the work package view (regression #42271)" do
dropdown.expect_count 1
# Make sure the filter gets set once
dropdown.toggle!
dropdown.expect_open
dropdown.toggle_checkbox(other_sub_sub_project.id)
- dropdown.click_button 'Apply'
+ dropdown.click_button "Apply"
dropdown.expect_count 2
work_package_view.click_inline_create
@@ -85,14 +85,14 @@
subject_field.expect_active!
# Save the WP
- subject_field.set_value 'Foobar!'
+ subject_field.set_value "Foobar!"
subject_field.submit_by_enter
work_package_view.expect_and_dismiss_toaster(
- message: 'Successful creation. Click here to open this work package in fullscreen view.'
+ message: "Successful creation. Click here to open this work package in fullscreen view."
)
- work_package_view.expect_work_package_subject 'Foobar!'
+ work_package_view.expect_work_package_subject "Foobar!"
inline_created = WorkPackage.last
expect(inline_created.project).to eq(project)
diff --git a/spec/features/work_packages/tabs/activity_notifications_spec.rb b/spec/features/work_packages/tabs/activity_notifications_spec.rb
index 6b2152384430..80b45c45c492 100644
--- a/spec/features/work_packages/tabs/activity_notifications_spec.rb
+++ b/spec/features/work_packages/tabs/activity_notifications_spec.rb
@@ -1,23 +1,23 @@
-require 'spec_helper'
+require "spec_helper"
-require 'features/work_packages/work_packages_page'
-require 'support/edit_fields/edit_field'
+require "features/work_packages/work_packages_page"
+require "support/edit_fields/edit_field"
-RSpec.describe 'Activity tab notifications', :js, :selenium do
+RSpec.describe "Activity tab notifications", :js, :selenium do
shared_let(:project) { create(:project_with_types, public: true) }
shared_let(:work_package) do
create(:work_package,
project:,
journals: {
6.days.ago => {},
- 5.days.ago => { notes: 'First comment on this wp.' },
- 4.days.ago => { notes: 'Second comment on this wp.' },
- 3.days.ago => { notes: 'Third comment on this wp.' }
+ 5.days.ago => { notes: "First comment on this wp." },
+ 4.days.ago => { notes: "Second comment on this wp." },
+ 3.days.ago => { notes: "Third comment on this wp." }
})
end
shared_let(:admin) { create(:admin) }
- shared_examples_for 'when there are notifications for the work package' do
+ shared_examples_for "when there are notifications for the work package" do
shared_let(:notification) do
create(:notification,
recipient: admin,
@@ -25,79 +25,79 @@
resource: work_package,
journal: work_package.journals.last)
end
- it 'shows a notification bubble with the right number' do
- expect(page).to have_test_selector('tab-counter-Activity', text: '1')
+ it "shows a notification bubble with the right number" do
+ expect(page).to have_test_selector("tab-counter-Activity", text: "1")
end
- it 'shows a notification icon next to activities that have an unread notification' do
- expect(page).to have_test_selector('user-activity-bubble', count: 1)
+ it "shows a notification icon next to activities that have an unread notification" do
+ expect(page).to have_test_selector("user-activity-bubble", count: 1)
expect(page).to have_css("[data-qa-activity-number='4'] #{test_selector('user-activity-bubble')}")
end
- it 'shows a button to mark the notifications as read' do
- expect(page).to have_test_selector('mark-notification-read-button')
+ it "shows a button to mark the notifications as read" do
+ expect(page).to have_test_selector("mark-notification-read-button")
# A click marks the notification as read ...
- page.find_test_selector('mark-notification-read-button').click
+ page.find_test_selector("mark-notification-read-button").click
# ... and updates the view accordingly
- expect(page).not_to have_test_selector('mark-notification-read-button')
- expect(page).not_to have_test_selector('tab-counter-Activity')
- expect(page).not_to have_test_selector('user-activity-bubble')
+ expect(page).not_to have_test_selector("mark-notification-read-button")
+ expect(page).not_to have_test_selector("tab-counter-Activity")
+ expect(page).not_to have_test_selector("user-activity-bubble")
end
end
- shared_examples_for 'when there are no notifications for the work package' do
- it 'shows no notification bubble' do
- expect(page).not_to have_test_selector('tab-counter-Activity')
+ shared_examples_for "when there are no notifications for the work package" do
+ it "shows no notification bubble" do
+ expect(page).not_to have_test_selector("tab-counter-Activity")
end
- it 'does not show any notification icons next to activities' do
- expect(page).not_to have_test_selector('user-activity-bubble')
+ it "does not show any notification icons next to activities" do
+ expect(page).not_to have_test_selector("user-activity-bubble")
end
- it 'shows no button to mark the notifications as read' do
- expect(page).not_to have_test_selector('mark-notification-read-button')
+ it "shows no button to mark the notifications as read" do
+ expect(page).not_to have_test_selector("mark-notification-read-button")
end
end
- context 'when on full view' do
+ context "when on full view" do
shared_let(:full_view) { Pages::FullWorkPackage.new(work_package, project) }
before do
login_as(admin)
- full_view.visit_tab! 'activity'
+ full_view.visit_tab! "activity"
end
- it_behaves_like 'when there are notifications for the work package'
+ it_behaves_like "when there are notifications for the work package"
- it_behaves_like 'when there are no notifications for the work package'
+ it_behaves_like "when there are no notifications for the work package"
end
- context 'when on split view' do
+ context "when on split view" do
shared_let(:split_view) { Pages::SplitWorkPackage.new(work_package, project) }
before do
login_as(admin)
- split_view.visit_tab! 'activity'
+ split_view.visit_tab! "activity"
end
- it_behaves_like 'when there are notifications for the work package'
+ it_behaves_like "when there are notifications for the work package"
- it_behaves_like 'when there are no notifications for the work package'
+ it_behaves_like "when there are no notifications for the work package"
end
- context 'when visiting as an anonymous user', with_settings: { login_required?: false } do
+ context "when visiting as an anonymous user", with_settings: { login_required?: false } do
let(:full_view) { Pages::FullWorkPackage.new(work_package, project) }
let!(:anonymous_role) do
create(:anonymous_role, permissions: [:view_work_packages])
end
- it 'does not show an error' do
- full_view.visit_tab! 'activity'
+ it "does not show an error" do
+ full_view.visit_tab! "activity"
full_view.ensure_page_loaded
- full_view.expect_no_toaster type: :error, message: 'Http failure response for'
+ full_view.expect_no_toaster type: :error, message: "Http failure response for"
full_view.expect_no_toaster
end
end
diff --git a/spec/features/work_packages/tabs/activity_revisions_spec.rb b/spec/features/work_packages/tabs/activity_revisions_spec.rb
index 065fce237595..62a5da663f8e 100644
--- a/spec/features/work_packages/tabs/activity_revisions_spec.rb
+++ b/spec/features/work_packages/tabs/activity_revisions_spec.rb
@@ -1,9 +1,9 @@
-require 'spec_helper'
+require "spec_helper"
-require 'features/work_packages/work_packages_page'
-require 'support/edit_fields/edit_field'
+require "features/work_packages/work_packages_page"
+require "support/edit_fields/edit_field"
-RSpec.describe 'Activity tab', :js, :with_cuprite do
+RSpec.describe "Activity tab", :js, :with_cuprite do
let(:project) { create(:project_with_types, public: true) }
let(:creation_time) { 5.days.ago }
@@ -18,13 +18,13 @@
subject: initial_subject,
journals: {
creation_time => { notes: initial_comment },
- subject_change_time => { subject: 'New subject', description: 'Some not so long description.' },
- comment_time => { notes: 'A comment by a different user', user: create(:admin) }
+ subject_change_time => { subject: "New subject", description: "Some not so long description." },
+ comment_time => { notes: "A comment by a different user", user: create(:admin) }
})
end
- let(:initial_subject) { 'My Subject' }
- let(:initial_comment) { 'First comment on this wp.' }
+ let(:initial_subject) { "My Subject" }
+ let(:initial_comment) { "First comment on this wp." }
let(:comments_in_reverse) { false }
let(:activity_tab) { Components::WorkPackages::Activities.new(work_package) }
@@ -43,10 +43,10 @@
repo.save!
changeset = build(:changeset,
- comments: 'A comment on a changeset',
+ comments: "A comment on a changeset",
committed_on: revision_time,
repository: repo,
- committer: 'cool@person.org')
+ committer: "cool@person.org")
work_package.changesets << changeset
@@ -57,12 +57,12 @@
before do
allow(user.pref).to receive(:warn_on_leaving_unsaved?).and_return(false)
- allow(user.pref).to receive(:comments_sorting).and_return(comments_in_reverse ? 'desc' : 'asc')
+ allow(user.pref).to receive(:comments_sorting).and_return(comments_in_reverse ? "desc" : "asc")
allow(user.pref).to receive(:comments_in_reverse_order?).and_return(comments_in_reverse)
end
- shared_examples 'shows activities in order' do
- it 'shows activities in ascending order' do
+ shared_examples "shows activities in order" do
+ it "shows activities in ascending order" do
activities.each_with_index do |activity, idx|
actual_index =
if comments_in_reverse
@@ -86,15 +86,15 @@
activity = page.find("#activity-#{idx + 1}")
if activity.is_a?(Journal) && activity.id != subject_change_journal.id
- expect(activity).to have_css('.user', text: activity.user.name)
- expect(activity).to have_css('.user-comment > .message', text: activity.notes, visible: :all)
+ expect(activity).to have_css(".user", text: activity.user.name)
+ expect(activity).to have_css(".user-comment > .message", text: activity.notes, visible: :all)
elsif activity.is_a?(Changeset)
- expect(activity).to have_css('.user', text: User.find(activity.user_id).name)
- expect(activity).to have_css('.user-comment > .message', text: activity.notes, visible: :all)
+ expect(activity).to have_css(".user", text: User.find(activity.user_id).name)
+ expect(activity).to have_css(".user-comment > .message", text: activity.notes, visible: :all)
elsif activity == subject_change_journal
- expect(activity).to have_css('.work-package-details-activities-messages .message',
+ expect(activity).to have_css(".work-package-details-activities-messages .message",
count: 2)
- expect(activity).to have_css('.message',
+ expect(activity).to have_css(".message",
text: "Subject changed from #{initial_subject} " \
"to #{activity.data.subject}")
end
@@ -102,13 +102,13 @@
end
end
- shared_examples 'activity tab' do
+ shared_examples "activity tab" do
before do
- work_package_page.visit_tab! 'activity'
+ work_package_page.visit_tab! "activity"
work_package_page.ensure_page_loaded
end
- context 'with permission' do
+ context "with permission" do
let(:role) do
create(:project_role, permissions: %i[view_work_packages
view_changesets
@@ -122,63 +122,63 @@
[creation_journal, subject_change_journal, revision, comment_journal]
end
- context 'with ascending comments' do
+ context "with ascending comments" do
let(:comments_in_reverse) { false }
- it_behaves_like 'shows activities in order'
+ it_behaves_like "shows activities in order"
end
- context 'with reversed comments' do
+ context "with reversed comments" do
let(:comments_in_reverse) { true }
- it_behaves_like 'shows activities in order'
+ it_behaves_like "shows activities in order"
end
- it 'can toggle between activities and comments-only' do
- expect(page).to have_css('.work-package-details-activities-activity-contents', count: 4)
- expect(page).to have_css('.user-comment > .message', text: comment_journal.notes)
+ it "can toggle between activities and comments-only" do
+ expect(page).to have_css(".work-package-details-activities-activity-contents", count: 4)
+ expect(page).to have_css(".user-comment > .message", text: comment_journal.notes)
# Show only comments
- find('.activity-comments--toggler').click
+ find(".activity-comments--toggler").click
# It should remove the middle
- expect(page).to have_css('.work-package-details-activities-activity-contents', count: 2)
- expect(page).to have_css('.user-comment > .message', text: initial_comment)
- expect(page).to have_css('.user-comment > .message', text: comment_journal.notes)
+ expect(page).to have_css(".work-package-details-activities-activity-contents", count: 2)
+ expect(page).to have_css(".user-comment > .message", text: initial_comment)
+ expect(page).to have_css(".user-comment > .message", text: comment_journal.notes)
# Show all again
- find('.activity-comments--toggler').click
- expect(page).to have_css('.work-package-details-activities-activity-contents', count: 4)
+ find(".activity-comments--toggler").click
+ expect(page).to have_css(".work-package-details-activities-activity-contents", count: 4)
end
- it 'can quote a previous comment' do
- activity_tab.hover_action('1', :quote)
+ it "can quote a previous comment" do
+ activity_tab.hover_action("1", :quote)
field = TextEditorField.new work_package_page,
- 'comment',
- selector: '.work-packages--activity--add-comment'
+ "comment",
+ selector: ".work-packages--activity--add-comment"
expect(field.editing?).to be true
# Add our comment
- editor = find('.ck-content')
- expect(editor).to have_css('blockquote', text: initial_comment)
+ editor = find(".ck-content")
+ expect(editor).to have_css("blockquote", text: initial_comment)
editor.base.send_keys "\nthis is some remark under a quote"
field.submit_by_click
- expect(page).to have_css('.user-comment > .message', count: 3)
- expect(page).to have_css('.user-comment > .message blockquote')
+ expect(page).to have_css(".user-comment > .message", count: 3)
+ expect(page).to have_css(".user-comment > .message blockquote")
end
- it 'can reference a changeset (Regression #30415)' do
- work_package_page.visit_tab! 'activity'
+ it "can reference a changeset (Regression #30415)" do
+ work_package_page.visit_tab! "activity"
work_package_page.ensure_page_loaded
- expect(page).to have_css('.user-comment > .message', text: initial_comment)
+ expect(page).to have_css(".user-comment > .message", text: initial_comment)
comment_field = TextEditorField.new work_package_page,
- 'comment',
- selector: '.work-packages--activity--add-comment'
+ "comment",
+ selector: ".work-packages--activity--add-comment"
comment_field.activate!
comment_field.click_and_type_slowly "References r#{revision.revision}"
@@ -188,7 +188,7 @@
end
end
- context 'with no permission' do
+ context "with no permission" do
let(:role) do
create(:project_role, permissions: [:view_work_packages])
end
@@ -200,27 +200,27 @@
[creation_journal, subject_change_journal, comment_journal]
end
- context 'with ascending comments' do
+ context "with ascending comments" do
let(:comments_in_reverse) { false }
- it_behaves_like 'shows activities in order'
+ it_behaves_like "shows activities in order"
end
- it 'shows the activities, but does not allow commenting' do
- expect(page).to have_no_css('.work-packages--activity--add-comment', visible: :visible)
+ it "shows the activities, but does not allow commenting" do
+ expect(page).to have_no_css(".work-packages--activity--add-comment", visible: :visible)
end
end
end
- context 'when on the split screen' do
+ context "when on the split screen" do
let(:work_package_page) { Pages::SplitWorkPackage.new(work_package, project) }
- it_behaves_like 'activity tab'
+ it_behaves_like "activity tab"
end
- context 'when on the full screen' do
+ context "when on the full screen" do
let(:work_package_page) { Pages::FullWorkPackage.new(work_package) }
- it_behaves_like 'activity tab'
+ it_behaves_like "activity tab"
end
end
diff --git a/spec/features/work_packages/tabs/activity_tab_spec.rb b/spec/features/work_packages/tabs/activity_tab_spec.rb
index a56ad88a847f..71a7144745d6 100644
--- a/spec/features/work_packages/tabs/activity_tab_spec.rb
+++ b/spec/features/work_packages/tabs/activity_tab_spec.rb
@@ -26,12 +26,12 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-require 'features/work_packages/work_packages_page'
-require 'support/edit_fields/edit_field'
+require "features/work_packages/work_packages_page"
+require "support/edit_fields/edit_field"
-RSpec.describe 'Activity tab', :js, :with_cuprite do
+RSpec.describe "Activity tab", :js, :with_cuprite do
let(:project) do
create(:project_with_types,
types: [type_with_cf],
@@ -57,8 +57,8 @@
subject: initial_subject,
journals: {
creation_time => { notes: initial_comment },
- subject_change_time => { subject: 'New subject', description: 'Some not so long description.' },
- comment_time => { notes: 'A comment by a different user', user: create(:admin) }
+ subject_change_time => { subject: "New subject", description: "Some not so long description." },
+ comment_time => { notes: "A comment by a different user", user: create(:admin) }
}).tap do |wp|
Journal::CustomizableJournal.create!(journal: wp.journals[1],
custom_field_id: string_cf.id,
@@ -66,8 +66,8 @@
end
end
- let(:initial_subject) { 'My Subject' }
- let(:initial_comment) { 'First comment on this wp.' }
+ let(:initial_subject) { "My Subject" }
+ let(:initial_comment) { "First comment on this wp." }
let(:comments_in_reverse) { false }
let(:activity_tab) { Components::WorkPackages::Activities.new(work_package) }
@@ -81,18 +81,18 @@
before do
allow(user.pref).to receive(:warn_on_leaving_unsaved?).and_return(false)
- allow(user.pref).to receive(:comments_sorting).and_return(comments_in_reverse ? 'desc' : 'asc')
+ allow(user.pref).to receive(:comments_sorting).and_return(comments_in_reverse ? "desc" : "asc")
allow(user.pref).to receive(:comments_in_reverse_order?).and_return(comments_in_reverse)
end
- shared_examples 'shows activities in order' do
+ shared_examples "shows activities in order" do
let(:journals) do
journals = [creation_journal, subject_change_journal, comment_journal]
journals
end
- it 'shows activities in ascending order' do
+ it "shows activities in ascending order" do
journals.each_with_index do |journal, idx|
actual_index =
if comments_in_reverse
@@ -110,14 +110,14 @@
activity = page.find("#activity-#{idx + 1}")
if journal.id != subject_change_journal.id
- expect(activity).to have_css('.op-user-activity--user-line', text: journal.user.name)
- expect(activity).to have_css('.user-comment > .message', text: journal.notes, visible: :all)
+ expect(activity).to have_css(".op-user-activity--user-line", text: journal.user.name)
+ expect(activity).to have_css(".user-comment > .message", text: journal.notes, visible: :all)
end
if activity == subject_change_journal
- expect(activity).to have_css('.work-package-details-activities-messages .message',
+ expect(activity).to have_css(".work-package-details-activities-messages .message",
count: 2)
- expect(activity).to have_css('.message',
+ expect(activity).to have_css(".message",
text: "Subject changed from #{initial_subject} " \
"to #{journal.data.subject}")
end
@@ -125,15 +125,15 @@
end
end
- shared_examples 'activity tab' do
+ shared_examples "activity tab" do
before do
- work_package_page.visit_tab! 'activity'
+ work_package_page.visit_tab! "activity"
work_package_page.ensure_page_loaded
- expect(page).to have_css('.user-comment > .message',
+ expect(page).to have_css(".user-comment > .message",
text: initial_comment)
end
- context 'with permission' do
+ context "with permission" do
let(:role) do
create(:project_role, permissions: %i[view_work_packages add_work_package_notes])
end
@@ -142,51 +142,51 @@
member_with_roles: { project => role })
end
- context 'with ascending comments' do
+ context "with ascending comments" do
let(:comments_in_reverse) { false }
- it_behaves_like 'shows activities in order'
+ it_behaves_like "shows activities in order"
end
- context 'with reversed comments' do
+ context "with reversed comments" do
let(:comments_in_reverse) { true }
- it_behaves_like 'shows activities in order'
+ it_behaves_like "shows activities in order"
end
- it 'can deep link to an activity' do
+ it "can deep link to an activity" do
visit "/work_packages/#{work_package.id}/activity#activity-#{comment_journal.id}"
work_package_page.ensure_page_loaded
- expect(page).to have_css('.user-comment > .message',
+ expect(page).to have_css(".user-comment > .message",
text: initial_comment)
expect(page.current_url).to match /\/work_packages\/#{work_package.id}\/activity#activity-#{comment_journal.id}/
end
- it 'can toggle between activities and comments-only' do
- expect(page).to have_css('.work-package-details-activities-activity-contents', count: 3)
- expect(page).to have_css('.user-comment > .message', text: comment_journal.notes)
+ it "can toggle between activities and comments-only" do
+ expect(page).to have_css(".work-package-details-activities-activity-contents", count: 3)
+ expect(page).to have_css(".user-comment > .message", text: comment_journal.notes)
# Show only comments
- find('.activity-comments--toggler').click
+ find(".activity-comments--toggler").click
# It should remove the middle
- expect(page).to have_css('.work-package-details-activities-activity-contents', count: 2)
- expect(page).to have_css('.user-comment > .message', text: initial_comment)
- expect(page).to have_css('.user-comment > .message', text: comment_journal.notes)
+ expect(page).to have_css(".work-package-details-activities-activity-contents", count: 2)
+ expect(page).to have_css(".user-comment > .message", text: initial_comment)
+ expect(page).to have_css(".user-comment > .message", text: comment_journal.notes)
# Show all again
- find('.activity-comments--toggler').click
- expect(page).to have_css('.work-package-details-activities-activity-contents', count: 3)
+ find(".activity-comments--toggler").click
+ expect(page).to have_css(".work-package-details-activities-activity-contents", count: 3)
end
- it 'can quote a previous comment' do
- activity_tab.hover_action('1', :quote)
+ it "can quote a previous comment" do
+ activity_tab.hover_action("1", :quote)
field = TextEditorField.new work_package_page,
- 'comment',
- selector: '.work-packages--activity--add-comment'
+ "comment",
+ selector: ".work-packages--activity--add-comment"
field.expect_active!
@@ -196,21 +196,21 @@
field.input_element.base.send_keys "\nthis is some remark under a quote"
field.submit_by_click
- expect(page).to have_css('.user-comment > .message', count: 3)
- expect(page).to have_css('.user-comment > .message blockquote')
+ expect(page).to have_css(".user-comment > .message", count: 3)
+ expect(page).to have_css(".user-comment > .message blockquote")
end
- it 'can render checkboxes as part of the activity' do
+ it "can render checkboxes as part of the activity" do
task_list = page.all('[data-qa-activity-number="2"] ul.op-uc-list_task-list li.op-uc-list--item')
expect(task_list.size).to eq(2)
- expect(task_list[0]).to have_text('Task 1')
+ expect(task_list[0]).to have_text("Task 1")
expect(task_list[0]).to have_checked_field(disabled: true)
- expect(task_list[1]).to have_text('Task 2')
+ expect(task_list[1]).to have_text("Task 2")
expect(task_list[1]).to have_unchecked_field(disabled: true)
end
end
- context 'with no permission' do
+ context "with no permission" do
let(:role) do
create(:project_role, permissions: [:view_work_packages])
end
@@ -219,21 +219,21 @@
member_with_roles: { project => role })
end
- it 'shows the activities, but does not allow commenting' do
- expect(page).to have_no_css('.work-packages--activity--add-comment', visible: :visible)
+ it "shows the activities, but does not allow commenting" do
+ expect(page).to have_no_css(".work-packages--activity--add-comment", visible: :visible)
end
end
end
- context 'if on split screen' do
+ context "if on split screen" do
let(:work_package_page) { Pages::SplitWorkPackage.new(work_package, project) }
- it_behaves_like 'activity tab'
+ it_behaves_like "activity tab"
end
- context 'if on full screen' do
+ context "if on full screen" do
let(:work_package_page) { Pages::FullWorkPackage.new(work_package) }
- it_behaves_like 'activity tab'
+ it_behaves_like "activity tab"
end
end
diff --git a/spec/features/work_packages/tabs/keep_tab_spec.rb b/spec/features/work_packages/tabs/keep_tab_spec.rb
index d30cd8d60df2..20daf6e7c148 100644
--- a/spec/features/work_packages/tabs/keep_tab_spec.rb
+++ b/spec/features/work_packages/tabs/keep_tab_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Keep current details tab', :js, :selenium do
+RSpec.describe "Keep current details tab", :js, :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let!(:wp1) { create(:work_package, project:) }
@@ -42,7 +42,7 @@
wp_table.visit!
end
- it 'Remembers the tab while navigating the page' do
+ it "Remembers the tab while navigating the page" do
wp_table.expect_work_package_listed(wp1)
wp_table.expect_work_package_listed(wp2)
@@ -64,7 +64,7 @@
wp_full = wp_split1.switch_to_fullscreen
wp_full.expect_tab :activity
- page.execute_script('window.history.back()')
+ page.execute_script("window.history.back()")
wp_split1.expect_tab :activity
# Assert that overview tab is mapped to activity in show
diff --git a/spec/features/work_packages/tabs/watcher_tab_spec.rb b/spec/features/work_packages/tabs/watcher_tab_spec.rb
index cfb1aa0e6894..91a93e617c22 100644
--- a/spec/features/work_packages/tabs/watcher_tab_spec.rb
+++ b/spec/features/work_packages/tabs/watcher_tab_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Watcher tab', :js, :selenium do
+RSpec.describe "Watcher tab", :js, :selenium do
include Components::Autocompleter::NgSelectAutocompleteHelpers
let(:project) { create(:project) }
@@ -15,117 +15,117 @@
add_work_package_watchers)
end
- let(:watch_button) { find_by_id 'watch-button' }
- let(:watchers_tab) { find('.op-tab-row--link_selected', text: 'WATCHERS') }
+ let(:watch_button) { find_by_id "watch-button" }
+ let(:watchers_tab) { find(".op-tab-row--link_selected", text: "WATCHERS") }
def expect_button_is_watching
- title = I18n.t('js.label_unwatch_work_package')
+ title = I18n.t("js.label_unwatch_work_package")
expect(page).to have_css("#unwatch-button[title='#{title}']", wait: 10)
- expect(page).to have_css('#unwatch-button .button--icon.icon-watched', wait: 10)
+ expect(page).to have_css("#unwatch-button .button--icon.icon-watched", wait: 10)
end
def expect_button_is_not_watching
- title = I18n.t('js.label_watch_work_package')
+ title = I18n.t("js.label_watch_work_package")
expect(page).to have_css("#watch-button[title='#{title}']")
- expect(page).to have_css('#watch-button .button--icon.icon-unwatched')
+ expect(page).to have_css("#watch-button .button--icon.icon-unwatched")
end
- shared_examples 'watch and unwatch with button' do
- it 'watching the WP modifies the watcher list' do
+ shared_examples "watch and unwatch with button" do
+ it "watching the WP modifies the watcher list" do
# Expect WP watch button is in not-watched state
expect_button_is_not_watching
- expect(page).not_to have_test_selector('op-wp-watcher-name')
+ expect(page).not_to have_test_selector("op-wp-watcher-name")
watch_button.click
# Expect WP watch button causes watcher list to add user
expect_button_is_watching
- expect(page).to have_test_selector('op-wp-watcher-name', count: 1, text: user.name)
+ expect(page).to have_test_selector("op-wp-watcher-name", count: 1, text: user.name)
# Expect WP unwatch button causes watcher list to remove user
watch_button.click
expect_button_is_not_watching
- expect(page).not_to have_test_selector('op-wp-watcher-name')
+ expect(page).not_to have_test_selector("op-wp-watcher-name")
end
end
- shared_examples 'watchers tab' do
+ shared_examples "watchers tab" do
before do
login_as(user)
wp_page.visit_tab! :watchers
expect_angular_frontend_initialized
- expect(page).to have_css('.op-tab-row--link_selected', text: 'WATCHERS')
+ expect(page).to have_css(".op-tab-row--link_selected", text: "WATCHERS")
end
- it 'modifying the watcher list modifies the watch button' do
+ it "modifying the watcher list modifies the watch button" do
# Add user as watcher
- autocomplete = find('.wp-watcher--autocomplete ng-select')
+ autocomplete = find(".wp-watcher--autocomplete ng-select")
select_autocomplete autocomplete,
query: user.firstname,
select_text: user.name,
- results_selector: 'body'
+ results_selector: "body"
# Expect the addition of the user to toggle WP watch button
- expect(page).to have_test_selector('op-wp-watcher-name', count: 1, text: user.name)
+ expect(page).to have_test_selector("op-wp-watcher-name", count: 1, text: user.name)
expect_button_is_watching
# Expect watchers counter to increase
tabs.expect_counter(watchers_tab, 1)
# Remove watcher from list
- page.find_test_selector('op-wp-watcher-name', text: user.name).hover
- page.find('.form--selected-value--remover').click
+ page.find_test_selector("op-wp-watcher-name", text: user.name).hover
+ page.find(".form--selected-value--remover").click
# Watchers counter should not be displayed
tabs.expect_no_counter(watchers_tab)
# Expect the removal of the user to toggle WP watch button
- expect(page).not_to have_test_selector('op-wp-watcher-name')
+ expect(page).not_to have_test_selector("op-wp-watcher-name")
expect_button_is_not_watching
end
- context 'with a user with arbitrary characters' do
+ context "with a user with arbitrary characters" do
let!(:html_user) do
create(:user,
:skip_validations,
- firstname: '
foo',
+ firstname: "
foo",
member_with_roles: { project => role })
end
- it 'escapes the user name' do
- autocomplete = find('.wp-watcher--autocomplete ng-select')
+ it "escapes the user name" do
+ autocomplete = find(".wp-watcher--autocomplete ng-select")
target_dropdown = search_autocomplete autocomplete,
- query: 'foo',
- results_selector: 'body'
+ query: "foo",
+ results_selector: "body"
expect(target_dropdown).to have_css(".ng-option", text: html_user.firstname)
expect(target_dropdown).to have_no_css(".ng-option em")
end
end
- context 'with all permissions' do
- it_behaves_like 'watch and unwatch with button'
+ context "with all permissions" do
+ it_behaves_like "watch and unwatch with button"
end
- context 'without watchers permission' do
+ context "without watchers permission" do
let(:permissions) { %i(view_work_packages view_work_package_watchers) }
- it_behaves_like 'watch and unwatch with button'
+ it_behaves_like "watch and unwatch with button"
end
end
- context 'split screen' do
+ context "split screen" do
let(:wp_page) { Pages::SplitWorkPackage.new(work_package) }
- it_behaves_like 'watchers tab'
+ it_behaves_like "watchers tab"
end
- context 'full screen' do
+ context "full screen" do
let(:wp_page) { Pages::FullWorkPackage.new(work_package) }
- it_behaves_like 'watchers tab'
+ it_behaves_like "watchers tab"
end
- context 'when the work package has a watcher' do
+ context "when the work package has a watcher" do
let(:watchers) { create(:watcher, watchable: work_package, user:) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -136,14 +136,14 @@ def expect_button_is_not_watching
wp_table.expect_work_package_listed work_package
end
- it 'shows the number of watchers [#33685]' do
+ it "shows the number of watchers [#33685]" do
wp_table.open_full_screen_by_doubleclick(work_package)
- expect(page).to have_test_selector('tab-count', text: "(1)")
+ expect(page).to have_test_selector("tab-count", text: "(1)")
end
end
- context 'with a placeholder user in the project' do
- let!(:placeholder) { create(:placeholder_user, name: 'PLACEHOLDER') }
+ context "with a placeholder user in the project" do
+ let!(:placeholder) { create(:placeholder_user, name: "PLACEHOLDER") }
let(:wp_page) { Pages::FullWorkPackage.new(work_package) }
before do
@@ -151,11 +151,11 @@ def expect_button_is_not_watching
wp_page.visit_tab! :watchers
end
- it 'does not show the placeholder user as an option' do
- autocomplete = find('.wp-watcher--autocomplete ng-select')
+ it "does not show the placeholder user as an option" do
+ autocomplete = find(".wp-watcher--autocomplete ng-select")
target_dropdown = search_autocomplete autocomplete,
- query: '',
- results_selector: 'body'
+ query: "",
+ results_selector: "body"
expect(target_dropdown).to have_css(".ng-option", text: user.name)
expect(target_dropdown).to have_no_css(".ng-option", text: placeholder.name)
diff --git a/spec/features/work_packages/update_ancestors_spec.rb b/spec/features/work_packages/update_ancestors_spec.rb
index b888af574ffa..cbb4932a5823 100644
--- a/spec/features/work_packages/update_ancestors_spec.rb
+++ b/spec/features/work_packages/update_ancestors_spec.rb
@@ -28,13 +28,13 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Update ancestors', :js, :with_cuprite do
+RSpec.describe "Update ancestors", :js, :with_cuprite do
shared_let(:user) { create(:admin) }
shared_let(:priority) { create(:default_priority) }
- shared_let(:new_status) { create(:default_status, name: 'New') }
- shared_let(:closed_status) { create(:closed_status, name: 'Closed') }
+ shared_let(:new_status) { create(:default_status, name: "New") }
+ shared_let(:closed_status) { create(:closed_status, name: "Closed") }
shared_let(:type) { create(:type_task) }
shared_let(:project_role) { create(:project_role) }
shared_let(:project) { create(:project, types: [type]) }
@@ -63,14 +63,14 @@
shared_let(:parent) do
create(:work_package,
- subject: 'parent',
+ subject: "parent",
estimated_hours: 2,
remaining_hours: 1)
end
shared_let(:child) do
create(:work_package,
parent:,
- subject: 'child',
+ subject: "child",
estimated_hours: 6,
remaining_hours: 3,
done_ratio: 50)
@@ -78,7 +78,7 @@
shared_let(:second_child) do
create(:work_package,
parent:,
- subject: 'second child',
+ subject: "second child",
estimated_hours: 3,
remaining_hours: 3,
done_ratio: 0)
@@ -101,7 +101,7 @@
wp_table.visit_query query
end
- context 'when changing a child work and remaining work values', retry: 2 do
+ context "when changing a child work and remaining work values", retry: 2 do
it "updates the derived parent work, remaining work, and % complete values" do
expect do
wp_table.update_work_package_attributes(child, estimatedTime: child.estimated_hours + 1)
@@ -115,8 +115,8 @@
end
end
- context 'when changing a child % complete value' do
- it 'updates the derived parent % complete value' do
+ context "when changing a child % complete value" do
+ it "updates the derived parent % complete value" do
expect do
wp_table.update_work_package_attributes(child, percentageDone: 100)
parent.reload
@@ -124,17 +124,17 @@
end
end
- context 'when setting a child status to closed' do
- it 'considers child % complete to be 100% and updates the derived parent % complete value accordingly' do
+ context "when setting a child status to closed" do
+ it "considers child % complete to be 100% and updates the derived parent % complete value accordingly" do
expect do
- wp_table.update_work_package_attributes(child, status: 'Closed')
+ wp_table.update_work_package_attributes(child, status: "Closed")
parent.reload
end.to change(parent, :derived_done_ratio).to(67) # 6h at 100% and 3h at 0% => 67% complete for 9h
end
end
- context 'when deleting a child' do
- it 'updates the derived parent work, remaining work, and % complete values' do
+ context "when deleting a child" do
+ it "updates the derived parent work, remaining work, and % complete values" do
context_menu = wp_table.open_context_menu_for(second_child)
context_menu.choose_delete_and_confirm_deletion
@@ -145,15 +145,15 @@
end
end
- context 'when adding a new child' do
- it 'updates the derived parent work, remaining work, and % complete values' do
+ context "when adding a new child" do
+ it "updates the derived parent work, remaining work, and % complete values" do
context_menu = wp_table.open_context_menu_for(parent)
- context_menu.choose(I18n.t('js.relation_buttons.add_new_child'))
+ context_menu.choose(I18n.t("js.relation_buttons.add_new_child"))
split_view_create = Pages::SplitWorkPackageCreate.new(project:)
- split_view_create.set_attributes({ subject: 'new child', estimatedTime: 1, remainingTime: 3 })
+ split_view_create.set_attributes({ subject: "new child", estimatedTime: 1, remainingTime: 3 })
split_view_create.save!
- split_view_create.expect_and_dismiss_toaster message: 'Successful creation'
+ split_view_create.expect_and_dismiss_toaster message: "Successful creation"
parent.reload
new_child = WorkPackage.last
@@ -165,11 +165,11 @@
end
end
- context 'when outdenting and indenting hierarchy of a child' do
- it 'updates the parent work and remaining work values' do
+ context "when outdenting and indenting hierarchy of a child" do
+ it "updates the parent work and remaining work values" do
context_menu = wp_table.open_context_menu_for(second_child)
- context_menu.choose(I18n.t('js.relation_buttons.hierarchy_outdent'))
- wp_table.expect_and_dismiss_toaster message: 'Successful update'
+ context_menu.choose(I18n.t("js.relation_buttons.hierarchy_outdent"))
+ wp_table.expect_and_dismiss_toaster message: "Successful update"
parent.reload
expect(parent.derived_estimated_hours).to eq([parent, child].pluck(:estimated_hours).sum)
@@ -177,8 +177,8 @@
expect(parent.derived_done_ratio).to eq(child.done_ratio)
context_menu = wp_table.open_context_menu_for(second_child)
- context_menu.choose(I18n.t('js.relation_buttons.hierarchy_indent'))
- wp_table.expect_and_dismiss_toaster message: 'Successful update'
+ context_menu.choose(I18n.t("js.relation_buttons.hierarchy_indent"))
+ wp_table.expect_and_dismiss_toaster message: "Successful update"
parent.reload
expect(parent.derived_estimated_hours).to eq([parent, child, second_child].pluck(:estimated_hours).sum)
diff --git a/spec/features/work_packages/work_package_index_spec.rb b/spec/features/work_packages/work_package_index_spec.rb
index bb4523db326d..14f9bd54160c 100644
--- a/spec/features/work_packages/work_package_index_spec.rb
+++ b/spec/features/work_packages/work_package_index_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Work Packages', 'index view', :js, :with_cuprite do
+RSpec.describe "Work Packages", "index view", :js, :with_cuprite do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[work_package_tracking]) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -37,42 +37,42 @@
login_as(user)
end
- context 'within a global context' do
+ context "within a global context" do
before do
visit root_path
end
- it 'is reachable by clicking the global menu item' do
- within('#main-menu') do
- click_link 'Work packages'
+ it "is reachable by clicking the global menu item" do
+ within("#main-menu") do
+ click_link "Work packages"
end
expect(page).to have_current_path(work_packages_path)
- within('#content') do
- wp_table.expect_title('All open', editable: true)
- expect(page).to have_content('No work packages to display')
+ within("#content") do
+ wp_table.expect_title("All open", editable: true)
+ expect(page).to have_content("No work packages to display")
end
end
end
- context 'within a project-specific context' do
- it 'is reachable by clicking the sidebar menu item' do
+ context "within a project-specific context" do
+ it "is reachable by clicking the sidebar menu item" do
visit project_path(project)
- within('#content') do
- expect(page).to have_content('Overview')
+ within("#content") do
+ expect(page).to have_content("Overview")
end
- within('#main-menu') do
- click_link 'Work packages'
+ within("#main-menu") do
+ click_link "Work packages"
end
expect(page).to have_current_path(project_work_packages_path(project))
- within('#content') do
- wp_table.expect_title('All open', editable: true)
- expect(page).to have_content('No work packages to display')
+ within("#content") do
+ wp_table.expect_title("All open", editable: true)
+ expect(page).to have_content("No work packages to display")
end
end
end
diff --git a/spec/features/work_packages/work_package_workflow_form_spec.rb b/spec/features/work_packages/work_package_workflow_form_spec.rb
index 7fa55e6d1743..ccf8f18a0eb2 100644
--- a/spec/features/work_packages/work_package_workflow_form_spec.rb
+++ b/spec/features/work_packages/work_package_workflow_form_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'features/page_objects/notification'
+require "spec_helper"
+require "features/page_objects/notification"
-RSpec.describe 'Work package transitive status workflows', :js do
+RSpec.describe "Work package transitive status workflows", :js do
let(:dev_role) do
create(:project_role,
permissions: %i[view_work_packages
@@ -37,8 +37,8 @@
end
let(:dev) do
create(:user,
- firstname: 'Dev',
- lastname: 'Guy',
+ firstname: "Dev",
+ lastname: "Guy",
member_with_roles: { project => dev_role })
end
@@ -89,7 +89,7 @@
##
# Regression test for #24129
- it 'allows to move to the final status as defined in the workflow' do
+ it "allows to move to the final status as defined in the workflow" do
wp_page.update_attributes status: status_intermediate.name
wp_page.expect_attributes status: status_intermediate.name
diff --git a/spec/features/work_packages/work_packages_page.rb b/spec/features/work_packages/work_packages_page.rb
index ad379239792c..6e2271455448 100644
--- a/spec/features/work_packages/work_packages_page.rb
+++ b/spec/features/work_packages/work_packages_page.rb
@@ -55,24 +55,24 @@ def visit_edit(id)
end
def visit_calendar
- visit index_path + '/calendar'
+ visit index_path + "/calendar"
end
def open_settings!
- click_on 'work-packages-settings-button'
+ click_on "work-packages-settings-button"
end
def click_work_packages_menu_item
- find('#main-menu .work-packages').click
+ find("#main-menu .work-packages").click
end
def click_toolbar_button(button)
close_toasters
- find('.toolbar-container', wait: 5).click_button button
+ find(".toolbar-container", wait: 5).click_button button
end
def close_toasters
- page.all(:css, '.op-toast--close').each(&:click)
+ page.all(:css, ".op-toast--close").each(&:click)
end
def select_query(query)
@@ -83,9 +83,9 @@ def select_query(query)
def find_subject_field(text = nil)
if text
- find_by_id('inplace-edit--write-value--subject', text:)
+ find_by_id("inplace-edit--write-value--subject", text:)
else
- find_by_id('inplace-edit--write-value--subject')
+ find_by_id("inplace-edit--write-value--subject")
end
end
@@ -107,7 +107,7 @@ def query_path(query)
def ensure_index_page_loaded
if Capybara.current_driver == Capybara.javascript_driver
- expect(page).to have_css('.work-packages--filters-optional-container.-loaded', visible: :all, wait: 20)
+ expect(page).to have_css(".work-packages--filters-optional-container.-loaded", visible: :all, wait: 20)
end
end
end
diff --git a/spec/features/work_packages/zen_mode_spec.rb b/spec/features/work_packages/zen_mode_spec.rb
index 99a02e65e5d4..3fc223e22dca 100644
--- a/spec/features/work_packages/zen_mode_spec.rb
+++ b/spec/features/work_packages/zen_mode_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Zen mode', :js do
+RSpec.describe "Zen mode", :js do
let(:dev_role) do
create(:project_role,
permissions: %i[view_work_packages
@@ -8,8 +8,8 @@
end
let(:dev) do
create(:user,
- firstname: 'Dev',
- lastname: 'Guy',
+ firstname: "Dev",
+ lastname: "Guy",
member_with_roles: { project => dev_role })
end
@@ -34,13 +34,13 @@
wp_page.ensure_page_loaded
end
- it 'hides menus' do
+ it "hides menus" do
wp_page.expect_no_zen_mode
- wp_page.page.find_by_id('work-packages-zen-mode-toggle-button').click
+ wp_page.page.find_by_id("work-packages-zen-mode-toggle-button").click
wp_page.expect_zen_mode
wp_page.go_back
wp_page.expect_zen_mode
- wp_page.page.find_by_id('work-packages-zen-mode-toggle-button').click
+ wp_page.page.find_by_id("work-packages-zen-mode-toggle-button").click
wp_page.expect_no_zen_mode
end
end
diff --git a/spec/features/workflows/copy_spec.rb b/spec/features/workflows/copy_spec.rb
index 848ff35900a0..38a3fc072be4 100644
--- a/spec/features/workflows/copy_spec.rb
+++ b/spec/features/workflows/copy_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Workflow copy' do
+RSpec.describe "Workflow copy" do
let(:role) { create(:project_role) }
let(:type) { create(:type) }
let(:admin) { create(:admin) }
@@ -45,16 +45,16 @@
current_user { admin }
before do
- visit url_for(controller: '/workflows', action: :copy)
+ visit url_for(controller: "/workflows", action: :copy)
end
- it 'shows existing types and roles' do
+ it "shows existing types and roles" do
select(role.name, from: :source_role_id)
- within('#source_role_id') do
+ within("#source_role_id") do
expect(page).to have_content(role.name)
expect(page).to have_content("--- #{I18n.t(:actionview_instancetag_blank_option)} ---")
end
- within('#source_type_id') do
+ within("#source_type_id") do
expect(page).to have_content(type.name)
expect(page).to have_content("--- #{I18n.t(:actionview_instancetag_blank_option)} ---")
end
diff --git a/spec/features/workflows/missing_for_sharing_wp_spec.rb b/spec/features/workflows/missing_for_sharing_wp_spec.rb
index 0af19fb1e91c..242f36d729b9 100644
--- a/spec/features/workflows/missing_for_sharing_wp_spec.rb
+++ b/spec/features/workflows/missing_for_sharing_wp_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Configuring the workflow for work package sharing',
+RSpec.describe "Configuring the workflow for work package sharing",
with_config: { show_warning_bars: true },
with_ee: %i[work_package_sharing] do
let!(:role) { create(:project_role) }
@@ -52,9 +52,9 @@
visit home_url
end
- it 'shows a warning until a workflow is configured for the work package edit role' do
+ it "shows a warning until a workflow is configured for the work package edit role" do
# There is a warning bar at the bottom informing of the missing workflow
- within '.warning-bar--item' do
+ within ".warning-bar--item" do
expect(page)
.to have_content("No workflow is configured for the '#{work_package_role.name}' role. " \
"Without a workflow, the shared with user cannot alter the status of the work package.")
@@ -63,16 +63,16 @@
end
# On the copy workflow form, select the already existing workflow for copying
- select type.name, from: 'source_type_id'
- select role.name, from: 'source_role_id'
- select type.name, from: 'target_type_ids'
- select work_package_role.name, from: 'target_role_ids'
+ select type.name, from: "source_type_id"
+ select role.name, from: "source_role_id"
+ select type.name, from: "target_type_ids"
+ select work_package_role.name, from: "target_role_ids"
- click_button 'Copy'
+ click_button "Copy"
# Copying succeeds which results in the edit role having a workflow and the warning disappearing.
expect(page)
- .to have_content 'Successful update'
+ .to have_content "Successful update"
expect(Workflow.where(role_id: work_package_role.id,
type_id: type.id,
@@ -82,6 +82,6 @@
assignee: false).count).to eq(1)
expect(page)
- .to have_no_css('.warning-bar--item')
+ .to have_no_css(".warning-bar--item")
end
end
diff --git a/spec/features/wysiwyg/bold_behavior_spec.rb b/spec/features/wysiwyg/bold_behavior_spec.rb
index 21ce519e9dea..1f4021a44acf 100644
--- a/spec/features/wysiwyg/bold_behavior_spec.rb
+++ b/spec/features/wysiwyg/bold_behavior_spec.rb
@@ -26,45 +26,45 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg bold behavior', :js, :with_cuprite do
+RSpec.describe "Wysiwyg bold behavior", :js, :with_cuprite do
current_user { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:editor) { Components::WysiwygEditor.new }
def mac_osx?
- RUBY_PLATFORM.include?('darwin')
+ RUBY_PLATFORM.include?("darwin")
end
def bold_keystroke
if mac_osx?
- [:meta, 'b']
+ [:meta, "b"]
else
- [:ctrl, 'b']
+ [:ctrl, "b"]
end
end
- describe 'in wikis' do
- describe 'creating a wiki page' do
+ describe "in wikis" do
+ describe "creating a wiki page" do
before do
visit project_wiki_path(project, :wiki)
end
- it 'can insert strong formatting with nbsp' do
- editor.click_and_type_slowly 'some text ', bold_keystroke, 'with bold'
+ it "can insert strong formatting with nbsp" do
+ editor.click_and_type_slowly "some text ", bold_keystroke, "with bold"
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
- expect(page).to have_css('p') { |node|
- node.text.include?('some text') && node.text.include?('with bold')
+ within("#content") do
+ expect(page).to have_css("p") { |node|
+ node.text.include?("some text") && node.text.include?("with bold")
}
- expect(page).to have_css('strong', text: 'with bold')
+ expect(page).to have_css("strong", text: "with bold")
end
end
end
diff --git a/spec/features/wysiwyg/custom_css_classes_spec.rb b/spec/features/wysiwyg/custom_css_classes_spec.rb
index 3b94f2db08ca..8108bce93e92 100644
--- a/spec/features/wysiwyg/custom_css_classes_spec.rb
+++ b/spec/features/wysiwyg/custom_css_classes_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg paragraphs in lists behavior (Regression #28765)', :js do
+RSpec.describe "Wysiwyg paragraphs in lists behavior (Regression #28765)", :js do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:editor) { Components::WysiwygEditor.new }
@@ -114,61 +114,61 @@
visit edit_project_wiki_path(project, wiki_page.slug)
end
- it 'custom classes are placed correctly' do
+ it "custom classes are placed correctly" do
editor.in_editor do |_container, editable|
- expect(editable).to have_css('p.op-uc-p', count: 6)
- expect(editable).to have_css('h1.op-uc-h1', count: 1)
- expect(editable).to have_css('h2.op-uc-h2', count: 1)
- expect(editable).to have_css('h3.op-uc-h3', count: 1)
- expect(editable).to have_css('h4.op-uc-h4', count: 1)
- expect(editable).to have_css('h5.op-uc-h5', count: 1)
- expect(editable).to have_css('blockquote.op-uc-blockquote', count: 1)
- expect(editable).to have_css('figure.op-uc-figure', count: 1)
- expect(editable).to have_css('figure.op-uc-figure.op-uc-figure_align-center table.op-uc-table', count: 1)
- expect(editable).to have_css('table.op-uc-table thead.op-uc-table--head', count: 1)
- expect(editable).to have_css('table.op-uc-table tr.op-uc-table--row', count: 2)
- expect(editable).to have_css('table.op-uc-table td.op-uc-table--cell', count: 2)
- expect(editable).to have_css('table.op-uc-table th.op-uc-table--cell.op-uc-table--cell_head', count: 4)
- expect(editable).to have_css('ul.op-uc-list', count: 2)
- expect(editable).to have_css('ol.op-uc-list', count: 1)
- expect(editable).to have_css('ul.op-uc-list_task-list', count: 1)
- expect(editable).to have_css('ul.op-uc-list li.op-uc-list--item', count: 2)
- expect(editable).to have_css('ol.op-uc-list li.op-uc-list--item', count: 1)
- expect(editable).to have_css('ul.op-uc-list.op-uc-list_task-list li.op-uc-list--item', count: 1)
- expect(editable).to have_css('pre.op-uc-code-block', count: 1)
- expect(editable).to have_css('code.op-uc-code', count: 1)
- expect(editable).to have_css('a.op-uc-link', count: 1)
- expect(editable).to have_css('div.op-uc-placeholder', count: 3)
- expect(editable).to have_css('span.op-uc-placeholder', count: 1)
+ expect(editable).to have_css("p.op-uc-p", count: 6)
+ expect(editable).to have_css("h1.op-uc-h1", count: 1)
+ expect(editable).to have_css("h2.op-uc-h2", count: 1)
+ expect(editable).to have_css("h3.op-uc-h3", count: 1)
+ expect(editable).to have_css("h4.op-uc-h4", count: 1)
+ expect(editable).to have_css("h5.op-uc-h5", count: 1)
+ expect(editable).to have_css("blockquote.op-uc-blockquote", count: 1)
+ expect(editable).to have_css("figure.op-uc-figure", count: 1)
+ expect(editable).to have_css("figure.op-uc-figure.op-uc-figure_align-center table.op-uc-table", count: 1)
+ expect(editable).to have_css("table.op-uc-table thead.op-uc-table--head", count: 1)
+ expect(editable).to have_css("table.op-uc-table tr.op-uc-table--row", count: 2)
+ expect(editable).to have_css("table.op-uc-table td.op-uc-table--cell", count: 2)
+ expect(editable).to have_css("table.op-uc-table th.op-uc-table--cell.op-uc-table--cell_head", count: 4)
+ expect(editable).to have_css("ul.op-uc-list", count: 2)
+ expect(editable).to have_css("ol.op-uc-list", count: 1)
+ expect(editable).to have_css("ul.op-uc-list_task-list", count: 1)
+ expect(editable).to have_css("ul.op-uc-list li.op-uc-list--item", count: 2)
+ expect(editable).to have_css("ol.op-uc-list li.op-uc-list--item", count: 1)
+ expect(editable).to have_css("ul.op-uc-list.op-uc-list_task-list li.op-uc-list--item", count: 1)
+ expect(editable).to have_css("pre.op-uc-code-block", count: 1)
+ expect(editable).to have_css("code.op-uc-code", count: 1)
+ expect(editable).to have_css("a.op-uc-link", count: 1)
+ expect(editable).to have_css("div.op-uc-placeholder", count: 3)
+ expect(editable).to have_css("span.op-uc-placeholder", count: 1)
end
end
- it 'custom align classes are placed correctly' do
+ it "custom align classes are placed correctly" do
editor.in_editor do |container, editable|
# strangely, we need visible: :all here
- editor.click_toolbar_button 'Insert table'
+ editor.click_toolbar_button "Insert table"
# 2x2
- container.find('.ck-insert-table-dropdown-grid-box:nth-of-type(12)').click
+ container.find(".ck-insert-table-dropdown-grid-box:nth-of-type(12)").click
sleep(0.1)
# There are already multiple tables on the page.
# To avoid mixing them up, we need to select the appropriate one
- table = container.find('.op-uc-figure:first-of-type .op-uc-table')
+ table = container.find(".op-uc-figure:first-of-type .op-uc-table")
- editor.align_table_by_label(editor, table, 'Align table to the left')
+ editor.align_table_by_label(editor, table, "Align table to the left")
# Table figure should now has the proper alignment class
- expect(editable).to have_css('figure.op-uc-figure_align-start')
+ expect(editable).to have_css("figure.op-uc-figure_align-start")
- editor.align_table_by_label(editor, table, 'Align table to the right')
+ editor.align_table_by_label(editor, table, "Align table to the right")
# Table figure should now has the proper alignment class
- expect(editable).to have_css('figure.op-uc-figure_align-end')
+ expect(editable).to have_css("figure.op-uc-figure_align-end")
- editor.align_table_by_label(editor, table, 'Center table')
+ editor.align_table_by_label(editor, table, "Center table")
# Table figure should now has the proper alignment class
- expect(editable).to have_css('figure.op-uc-figure_align-center')
+ expect(editable).to have_css("figure.op-uc-figure_align-center")
end
end
end
diff --git a/spec/features/wysiwyg/html_encoding_spec.rb b/spec/features/wysiwyg/html_encoding_spec.rb
index 26c1786d9ec4..4fd85a110314 100644
--- a/spec/features/wysiwyg/html_encoding_spec.rb
+++ b/spec/features/wysiwyg/html_encoding_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg escaping HTML entities (Regression #28906)', :js do
+RSpec.describe "Wysiwyg escaping HTML entities (Regression #28906)", :js do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:editor) { Components::WysiwygEditor.new }
@@ -38,31 +38,31 @@
visit project_wiki_path(project, :wiki)
end
- it 'shows the list correctly' do
+ it "shows the list correctly" do
editor.in_editor do |_, editable|
editor.click_and_type_slowly '
',
:enter,
'\
foo\'
- expect(editable).to have_no_css('node')
- expect(editable).to have_no_css('u')
+ expect(editable).to have_no_css("node")
+ expect(editable).to have_no_css("u")
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
- expect(page).to have_css('p', text: '
')
- expect(page).to have_no_css('u')
- expect(page).to have_no_css('node')
+ within("#content") do
+ expect(page).to have_css("p", text: '
')
+ expect(page).to have_no_css("u")
+ expect(page).to have_no_css("node")
end
text = WikiPage.last.text
expect(text).to include "<node foo="bar" />"
expect(text).to include "\\\\<u>foo\\\\</u>"
- expect(text).not_to include '
'
- expect(text).not_to include ''
+ expect(text).not_to include ""
+ expect(text).not_to include ""
end
end
diff --git a/spec/features/wysiwyg/linking_spec.rb b/spec/features/wysiwyg/linking_spec.rb
index 4d8265091e88..277a5d4ef2c2 100644
--- a/spec/features/wysiwyg/linking_spec.rb
+++ b/spec/features/wysiwyg/linking_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg linking', :js do
+RSpec.describe "Wysiwyg linking", :js do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki work_package_tracking]) }
let(:editor) { Components::WysiwygEditor.new }
@@ -37,19 +37,19 @@
login_as(user)
end
- describe 'creating a wiki page' do
+ describe "creating a wiki page" do
before do
visit project_wiki_path(project, :wiki)
end
- it 'can create links with spaces (Regression #29742)' do
+ it "can create links with spaces (Regression #29742)" do
# single hash autocomplete
- editor.insert_link 'http://example.org/link with spaces'
+ editor.insert_link "http://example.org/link with spaces"
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
wiki_page = project.wiki.pages.first.reload
diff --git a/spec/features/wysiwyg/macros/attribute_macros_spec.rb b/spec/features/wysiwyg/macros/attribute_macros_spec.rb
index 0a054b9f4e57..5bb7d11c4fe9 100644
--- a/spec/features/wysiwyg/macros/attribute_macros_spec.rb
+++ b/spec/features/wysiwyg/macros/attribute_macros_spec.rb
@@ -26,12 +26,12 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg attribute macros', :js do
+RSpec.describe "Wysiwyg attribute macros", :js do
shared_let(:admin) { create(:admin) }
let(:user) { admin }
- let!(:project) { create(:project, identifier: 'some-project', enabled_module_names: %w[wiki work_package_tracking]) }
+ let!(:project) { create(:project, identifier: "some-project", enabled_module_names: %w[wiki work_package_tracking]) }
let!(:work_package) { create(:work_package, subject: "Foo Bar", project:) }
let(:editor) { Components::WysiwygEditor.new }
@@ -68,41 +68,41 @@
login_as(user)
end
- describe 'creating a wiki page' do
+ describe "creating a wiki page" do
before do
visit project_wiki_path(project, :wiki)
end
- it 'can add and save multiple code blocks (Regression #28350)' do
+ it "can add and save multiple code blocks (Regression #28350)" do
editor.in_editor do |container,|
editor.set_markdown markdown
expect(container).to have_table
end
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
# Expect output widget
- within('#content') do
- expect(page).to have_css('td', text: 'Subject')
- expect(page).to have_css('td', text: 'Foo Bar')
- expect(page).to have_css('td', text: 'Identifier')
- expect(page).to have_css('td', text: 'some-project')
-
- expect(page).to have_css('td', text: 'invalid subject Cannot expand macro: Requested resource could not be found')
- expect(page).to have_css('td', text: 'invalid project Cannot expand macro: Requested resource could not be found')
+ within("#content") do
+ expect(page).to have_css("td", text: "Subject")
+ expect(page).to have_css("td", text: "Foo Bar")
+ expect(page).to have_css("td", text: "Identifier")
+ expect(page).to have_css("td", text: "some-project")
+
+ expect(page).to have_css("td", text: "invalid subject Cannot expand macro: Requested resource could not be found")
+ expect(page).to have_css("td", text: "invalid project Cannot expand macro: Requested resource could not be found")
end
# Edit page again
- click_on 'Edit'
+ click_on "Edit"
editor.in_editor do |container,|
- expect(container).to have_css('tbody td', count: 6)
+ expect(container).to have_css("tbody td", count: 6)
end
end
- context 'with a multi-select CF' do
+ context "with a multi-select CF" do
let!(:type) { create(:type, projects: [project]) }
let!(:custom_field) do
create(
@@ -126,18 +126,18 @@
wp
end
- it 'expands all custom values (Regression #45538)' do
+ it "expands all custom values (Regression #45538)" do
editor.in_editor do |container,|
editor.set_markdown 'workPackageValue:"Foo Bar":Ingredients'
- expect(container).to have_text 'workPackageValue'
+ expect(container).to have_text "workPackageValue"
end
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
- expect(page).to have_css('.custom-option', count: 6)
+ within("#content") do
+ expect(page).to have_css(".custom-option", count: 6)
end
end
end
diff --git a/spec/features/wysiwyg/macros/child_pages_spec.rb b/spec/features/wysiwyg/macros/child_pages_spec.rb
index e3b0fcc56fdd..6aa740e07b79 100644
--- a/spec/features/wysiwyg/macros/child_pages_spec.rb
+++ b/spec/features/wysiwyg/macros/child_pages_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg child pages spec', :js do
+RSpec.describe "Wysiwyg child pages spec", :js do
let(:project) do
create(:project,
enabled_module_names: %w[wiki])
@@ -41,20 +41,20 @@
let(:wiki_page) do
create(:wiki_page,
- title: 'Test',
- text: '# My page')
+ title: "Test",
+ text: "# My page")
end
let(:parent_page) do
create(:wiki_page,
- title: 'Parent page',
- text: '# parent page')
+ title: "Parent page",
+ text: "# parent page")
end
let(:child_page) do
create(:wiki_page,
- title: 'Child page',
- text: '# child page')
+ title: "Child page",
+ text: "# child page")
end
before do
@@ -69,92 +69,92 @@
login_as(user)
end
- describe 'in wikis' do
- describe 'creating a wiki page' do
+ describe "in wikis" do
+ describe "creating a wiki page" do
before do
visit edit_project_wiki_path(project, :test)
end
- it 'can add and edit an child pages widget' do
+ it "can add and edit an child pages widget" do
editor.in_editor do |_container, editable|
- expect(editable).to have_css('h1', text: 'My page')
+ expect(editable).to have_css("h1", text: "My page")
- editor.insert_macro 'Links to child pages'
+ editor.insert_macro "Links to child pages"
# Find widget, click to show toolbar
- placeholder = find('.op-uc-placeholder', text: 'Links to child pages')
+ placeholder = find(".op-uc-placeholder", text: "Links to child pages")
# Placeholder states `this page` and no `Include parent`
- expect(placeholder).to have_text('this page')
- expect(placeholder).to have_no_text('Include parent')
+ expect(placeholder).to have_text("this page")
+ expect(placeholder).to have_no_text("Include parent")
# Edit widget and cancel again
placeholder.click
- page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click
- expect(page).to have_css('.spot-modal')
- expect(page).to have_field('selected-page', with: '')
- find('.spot-modal--cancel-button').click
+ page.find(".ck-balloon-panel .ck-button", visible: :all, text: "Edit").click
+ expect(page).to have_css(".spot-modal")
+ expect(page).to have_field("selected-page", with: "")
+ find(".spot-modal--cancel-button").click
# Edit widget and save
placeholder.click
- page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click
- expect(page).to have_css('.spot-modal')
- fill_in 'selected-page', with: 'parent-page'
+ page.find(".ck-balloon-panel .ck-button", visible: :all, text: "Edit").click
+ expect(page).to have_css(".spot-modal")
+ fill_in "selected-page", with: "parent-page"
# Save widget
- find('.spot-modal--submit-button').click
+ find(".spot-modal--submit-button").click
# Placeholder states `parent-page` and no `Include parent`
- expect(placeholder).to have_text('parent-page')
- expect(placeholder).to have_no_text('Include parent')
+ expect(placeholder).to have_text("parent-page")
+ expect(placeholder).to have_no_text("Include parent")
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
- expect(page).to have_css('.pages-hierarchy')
- expect(page).to have_css('.pages-hierarchy', text: 'Child page')
- expect(page).to have_no_css('.pages-hierarchy', text: 'Parent page')
- expect(page).to have_css('h1', text: 'My page')
+ within("#content") do
+ expect(page).to have_css(".pages-hierarchy")
+ expect(page).to have_css(".pages-hierarchy", text: "Child page")
+ expect(page).to have_no_css(".pages-hierarchy", text: "Parent page")
+ expect(page).to have_css("h1", text: "My page")
SeleniumHubWaiter.wait
- find('.toolbar .icon-edit').click
+ find(".toolbar .icon-edit").click
end
editor.in_editor do |_container, _editable|
# Find widget, click to show toolbar
- placeholder = find('.op-uc-placeholder', text: 'Links to child pages')
+ placeholder = find(".op-uc-placeholder", text: "Links to child pages")
# Edit widget and save
placeholder.click
- page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click
- expect(page).to have_css('.spot-modal')
- page.check 'include-parent'
+ page.find(".ck-balloon-panel .ck-button", visible: :all, text: "Edit").click
+ expect(page).to have_css(".spot-modal")
+ page.check "include-parent"
# Save widget
- find('.spot-modal--submit-button').click
+ find(".spot-modal--submit-button").click
# Placeholder states `parent-page` and `Include parent`
- expect(placeholder).to have_text('parent-page')
- expect(placeholder).to have_text('Include parent')
+ expect(placeholder).to have_text("parent-page")
+ expect(placeholder).to have_text("Include parent")
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
- expect(page).to have_css('.pages-hierarchy')
- expect(page).to have_css('.pages-hierarchy', text: 'Child page')
- expect(page).to have_css('.pages-hierarchy', text: 'Parent page')
- expect(page).to have_css('h1', text: 'My page')
+ within("#content") do
+ expect(page).to have_css(".pages-hierarchy")
+ expect(page).to have_css(".pages-hierarchy", text: "Child page")
+ expect(page).to have_css(".pages-hierarchy", text: "Parent page")
+ expect(page).to have_css("h1", text: "My page")
SeleniumHubWaiter.wait
- find('.toolbar .icon-edit').click
+ find(".toolbar .icon-edit").click
end
end
end
diff --git a/spec/features/wysiwyg/macros/code_block_macro_spec.rb b/spec/features/wysiwyg/macros/code_block_macro_spec.rb
index 3decdad4dbd2..0f7383f75d4b 100644
--- a/spec/features/wysiwyg/macros/code_block_macro_spec.rb
+++ b/spec/features/wysiwyg/macros/code_block_macro_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg code block macro', :js do
+RSpec.describe "Wysiwyg code block macro", :js do
shared_let(:admin) { create(:admin) }
let(:user) { admin }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
@@ -54,72 +54,72 @@ def foobar
login_as(user)
end
- describe 'in wikis' do
- describe 'creating a wiki page' do
+ describe "in wikis" do
+ describe "creating a wiki page" do
before do
visit project_wiki_path(project, :wiki)
end
- it 'can add and save multiple code blocks (Regression #28350)' do
+ it "can add and save multiple code blocks (Regression #28350)" do
editor.in_editor do |container,|
editor.set_markdown expected
# Expect first macro saved to editor
- expect(container).to have_css('.op-uc-code-block', text: snippet)
- expect(container).to have_css('.op-uc-code-block--language', text: 'ruby')
+ expect(container).to have_css(".op-uc-code-block", text: snippet)
+ expect(container).to have_css(".op-uc-code-block--language", text: "ruby")
editor.set_markdown "#{expected}\n#{expected}"
- expect(container).to have_css('.op-uc-code-block', text: snippet, count: 2)
- expect(container).to have_css('.op-uc-code-block--language', text: 'ruby', count: 2)
+ expect(container).to have_css(".op-uc-code-block", text: snippet, count: 2)
+ expect(container).to have_css(".op-uc-code-block--language", text: "ruby", count: 2)
end
- click_on 'Save'
- expect(page).to have_css('.op-toast.-success')
+ click_on "Save"
+ expect(page).to have_css(".op-toast.-success")
# Expect output widget
- within('#content') do
- expect(page).to have_css('pre.highlight-ruby', count: 2)
+ within("#content") do
+ expect(page).to have_css("pre.highlight-ruby", count: 2)
end
SeleniumHubWaiter.wait
# Edit page again, expect widget
- click_on 'Edit'
+ click_on "Edit"
# SeleniumHubWaiter.wait
editor.in_editor do |container,|
- expect(container).to have_css('.op-uc-code-block', text: snippet, count: 2)
- expect(container).to have_css('.op-uc-code-block--language', text: 'ruby', count: 2)
+ expect(container).to have_css(".op-uc-code-block", text: snippet, count: 2)
+ expect(container).to have_css(".op-uc-code-block--language", text: "ruby", count: 2)
end
end
- it 'respects the inserted whitespace' do
+ it "respects the inserted whitespace" do
editor.in_editor do |container,|
- editor.click_toolbar_button 'Insert code snippet'
+ editor.click_toolbar_button "Insert code snippet"
- expect(page).to have_css('.spot-modal')
+ expect(page).to have_css(".spot-modal")
# CM wraps an accessor to the editor instance on the outer container
- cm = page.find('.CodeMirror')
- page.execute_script('arguments[0].CodeMirror.setValue(arguments[1]);', cm.native, 'asdf')
- find('.spot-modal--submit-button').click
+ cm = page.find(".CodeMirror")
+ page.execute_script("arguments[0].CodeMirror.setValue(arguments[1]);", cm.native, "asdf")
+ find(".spot-modal--submit-button").click
- expect(container).to have_css('.op-uc-code-block', text: 'asdf')
+ expect(container).to have_css(".op-uc-code-block", text: "asdf")
- click_on 'Save'
- expect(page).to have_css('.op-toast.-success')
+ click_on "Save"
+ expect(page).to have_css(".op-toast.-success")
wp = WikiPage.last
expect(wp.text.gsub("\r\n", "\n")).to eq("```text\nasdf\n```")
SeleniumHubWaiter.wait
- click_on 'Edit'
+ click_on "Edit"
editor.in_editor do |container,|
- expect(container).to have_css('.op-uc-code-block', text: 'asdf')
+ expect(container).to have_css(".op-uc-code-block", text: "asdf")
end
- click_on 'Save'
- expect(page).to have_css('.op-toast.-success')
+ click_on "Save"
+ expect(page).to have_css(".op-toast.-success")
wp.reload
# Regression added two newlines before fence here
@@ -127,58 +127,58 @@ def foobar
end
end
- it 'can add and edit a code block widget' do
+ it "can add and edit a code block widget" do
editor.in_editor do |container,|
- editor.click_toolbar_button 'Insert code snippet'
+ editor.click_toolbar_button "Insert code snippet"
- expect(page).to have_css('.spot-modal')
+ expect(page).to have_css(".spot-modal")
# CM wraps an accessor to the editor instance on the outer container
- cm = page.find('.CodeMirror')
- page.execute_script('arguments[0].CodeMirror.setValue(arguments[1]);', cm.native, snippet)
+ cm = page.find(".CodeMirror")
+ page.execute_script("arguments[0].CodeMirror.setValue(arguments[1]);", cm.native, snippet)
- fill_in 'selected-language', with: 'ruby'
+ fill_in "selected-language", with: "ruby"
# Expect some highlighting classes
- expect(page).to have_css('.cm-keyword', text: 'def')
- expect(page).to have_css('.cm-def', text: 'foobar')
+ expect(page).to have_css(".cm-keyword", text: "def")
+ expect(page).to have_css(".cm-def", text: "foobar")
- find('.spot-modal--submit-button').click
+ find(".spot-modal--submit-button").click
# Expect macro saved to editor
- expect(container).to have_css('.op-uc-code-block', text: snippet)
- expect(container).to have_css('.op-uc-code-block--language', text: 'ruby')
+ expect(container).to have_css(".op-uc-code-block", text: snippet)
+ expect(container).to have_css(".op-uc-code-block--language", text: "ruby")
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- wiki_page = project.wiki.find_page('wiki')
+ wiki_page = project.wiki.find_page("wiki")
text = wiki_page.text.gsub(/\r\n?/, "\n")
expect(text.strip).to eq(expected.strip)
# Expect output widget
- within('#content') do
- expect(page).to have_css('pre.highlight-ruby')
+ within("#content") do
+ expect(page).to have_css("pre.highlight-ruby")
end
# Edit page again, expect widget
SeleniumHubWaiter.wait
- click_on 'Edit'
+ click_on "Edit"
editor.in_editor do |container,|
- expect(container).to have_css('.op-uc-code-block', text: snippet)
- expect(container).to have_css('.op-uc-code-block--language', text: 'ruby')
+ expect(container).to have_css(".op-uc-code-block", text: snippet)
+ expect(container).to have_css(".op-uc-code-block--language", text: "ruby")
- widget = container.find('.op-uc-code-block')
+ widget = container.find(".op-uc-code-block")
page.driver.browser.action.double_click(widget.native).perform
- expect(page).to have_css('.spot-modal')
+ expect(page).to have_css(".spot-modal")
- expect(page).to have_css('.op-uc-code-block--language', text: 'ruby')
- expect(page).to have_css('.cm-keyword', text: 'def')
- expect(page).to have_css('.cm-def', text: 'foobar')
+ expect(page).to have_css(".op-uc-code-block--language", text: "ruby")
+ expect(page).to have_css(".cm-keyword", text: "def")
+ expect(page).to have_css(".cm-def", text: "foobar")
end
end
end
diff --git a/spec/features/wysiwyg/macros/embedded_tables_spec.rb b/spec/features/wysiwyg/macros/embedded_tables_spec.rb
index f02d503dad44..8408db12c87b 100644
--- a/spec/features/wysiwyg/macros/embedded_tables_spec.rb
+++ b/spec/features/wysiwyg/macros/embedded_tables_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg embedded work package tables', :js do
+RSpec.describe "Wysiwyg embedded work package tables", :js do
shared_let(:admin) { create(:admin) }
shared_let(:type_task) { create(:type_task) }
shared_let(:type_bug) { create(:type_bug) }
@@ -49,49 +49,49 @@
login_as(user)
end
- describe 'in wikis' do
- describe 'creating a wiki page' do
+ describe "in wikis" do
+ describe "creating a wiki page" do
before do
visit project_wiki_path(project, :wiki)
end
- it 'can add and edit an embedded table widget' do
+ it "can add and edit an embedded table widget" do
editor.in_editor do |_container, editable|
- editor.insert_macro 'Embed work package table'
+ editor.insert_macro "Embed work package table"
modal.expect_open
- modal.switch_to 'Filters'
+ modal.switch_to "Filters"
filters.expect_filter_count 2
- filters.add_filter_by('Type', 'is (OR)', type_task.name)
+ filters.add_filter_by("Type", "is (OR)", type_task.name)
- modal.switch_to 'Columns'
+ modal.switch_to "Columns"
columns.assume_opened
columns.uncheck_all save_changes: false
- columns.add 'ID', save_changes: false
- columns.add 'Subject', save_changes: false
- columns.add 'Type', save_changes: false
- columns.expect_checked 'ID'
- columns.expect_checked 'Subject'
- columns.expect_checked 'Type'
+ columns.add "ID", save_changes: false
+ columns.add "Subject", save_changes: false
+ columns.add "Type", save_changes: false
+ columns.expect_checked "ID"
+ columns.expect_checked "Subject"
+ columns.expect_checked "Type"
# Save widget
modal.save
# Find widget, click to show toolbar
- macro = editable.find('.ck-widget.op-uc-placeholder')
+ macro = editable.find(".ck-widget.op-uc-placeholder")
macro.click
# Edit widget again
- page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click
+ page.find(".ck-balloon-panel .ck-button", visible: :all, text: "Edit").click
modal.expect_open
- modal.switch_to 'Filters'
+ modal.switch_to "Filters"
filters.expect_filter_count 3
- modal.switch_to 'Columns'
+ modal.switch_to "Columns"
columns.assume_opened
- columns.expect_checked 'ID'
- columns.expect_checked 'Subject'
- columns.expect_checked 'Type'
+ columns.expect_checked "ID"
+ columns.expect_checked "Subject"
+ columns.expect_checked "Type"
modal.cancel
# Expect we can preview the table within ckeditor-augmented-textarea
@@ -103,11 +103,11 @@
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- embedded_table = Pages::EmbeddedWorkPackagesTable.new find('.wiki-content')
+ embedded_table = Pages::EmbeddedWorkPackagesTable.new find(".wiki-content")
embedded_table.expect_work_package_listed wp_task
embedded_table.ensure_work_package_not_listed! wp_bug
@@ -116,57 +116,57 @@
full_view.ensure_page_loaded
end
- context 'with a subproject that gets deleted' do
+ context "with a subproject that gets deleted" do
let!(:subproject) do
create(:project, parent: project, enabled_module_names: %w[wiki])
end
- it 'can still edit the embedded table widget' do
+ it "can still edit the embedded table widget" do
editor.in_editor do |_container, editable|
- editor.insert_macro 'Embed work package table'
+ editor.insert_macro "Embed work package table"
modal.expect_open
- modal.switch_to 'Filters'
+ modal.switch_to "Filters"
filters.expect_filter_count 2
- filters.add_filter_by('Including subproject', 'is (OR)', subproject.name, 'subprojectId')
+ filters.add_filter_by("Including subproject", "is (OR)", subproject.name, "subprojectId")
# Save widget
modal.save
# Find widget, click to show toolbar
- macro = editable.find('.ck-widget.op-uc-placeholder')
+ macro = editable.find(".ck-widget.op-uc-placeholder")
macro.click
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
# Embedded queries
wikipage = project.wiki.pages.last
- expect(wikipage.text).to include('subprojectId')
+ expect(wikipage.text).to include("subprojectId")
# Delete the project
subproject.destroy!
- click_on 'Edit'
+ click_on "Edit"
# Find widget, click to show toolbar
editor.in_editor do |_container, editable|
- macro = editable.find('.ck-widget.op-uc-placeholder')
+ macro = editable.find(".ck-widget.op-uc-placeholder")
macro.click
end
# Edit widget again
- page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click
+ page.find(".ck-balloon-panel .ck-button", visible: :all, text: "Edit").click
modal.expect_open
- modal.switch_to 'Filters'
+ modal.switch_to "Filters"
# Subproject filter is gone
filters.expect_filter_count 2
- expect(page).to have_no_text 'Subproject'
+ expect(page).to have_no_text "Subproject"
end
end
end
diff --git a/spec/features/wysiwyg/macros/quicklink_macros_spec.rb b/spec/features/wysiwyg/macros/quicklink_macros_spec.rb
index 58919f33de3e..a9b4d44cae72 100644
--- a/spec/features/wysiwyg/macros/quicklink_macros_spec.rb
+++ b/spec/features/wysiwyg/macros/quicklink_macros_spec.rb
@@ -26,16 +26,16 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg work package quicklink macros', :js do
+RSpec.describe "Wysiwyg work package quicklink macros", :js do
shared_let(:user) { create(:admin) }
shared_let(:project) { create(:project_with_types) }
let(:work_package) do
create(:work_package,
subject: "My subject",
- start_date: Date.parse('2020-01-01'),
- due_date: Date.parse('2020-02-01'))
+ start_date: Date.parse("2020-01-01"),
+ due_date: Date.parse("2020-02-01"))
end
let(:editor) { Components::WysiwygEditor.new }
@@ -46,72 +46,72 @@
visit project_wiki_path(project, :wiki)
end
- it 'renders work package quicklink macro # with id linking to work package' do
+ it "renders work package quicklink macro # with id linking to work package" do
editor.set_markdown "##{work_package.id}"
- click_on 'Save'
+ click_on "Save"
# Expect output widget
- within('#content') do
+ within("#content") do
expect(page).to have_link("##{work_package.id}")
- expect(page).to have_no_css('.work-package--quickinfo.preview-trigger')
+ expect(page).to have_no_css(".work-package--quickinfo.preview-trigger")
end
# Edit page again
- click_on 'Edit'
+ click_on "Edit"
editor.in_editor do |container,|
- expect(container).to have_css('p', text: "##{work_package.id}")
+ expect(container).to have_css("p", text: "##{work_package.id}")
end
end
- it 'renders work package quicklink macro ## with id link, subject and type' do
+ it "renders work package quicklink macro ## with id link, subject and type" do
editor.set_markdown "###{work_package.id}"
- click_on 'Save'
+ click_on "Save"
# Expect output widget
- within('#content') do
+ within("#content") do
expected_macro_text = "#{work_package.type.name.upcase} ##{work_package.id}: My subject"
- expect(page).to have_css('opce-macro-wp-quickinfo', text: expected_macro_text)
- expect(page).to have_css('span', text: work_package.type.name.upcase)
- expect(page).to have_css('.work-package--quickinfo.preview-trigger', text: "##{work_package.id}")
- expect(page).to have_css('span', text: 'My subject')
+ expect(page).to have_css("opce-macro-wp-quickinfo", text: expected_macro_text)
+ expect(page).to have_css("span", text: work_package.type.name.upcase)
+ expect(page).to have_css(".work-package--quickinfo.preview-trigger", text: "##{work_package.id}")
+ expect(page).to have_css("span", text: "My subject")
end
# Edit page again
- click_on 'Edit'
+ click_on "Edit"
editor.in_editor do |container,|
- expect(container).to have_css('p', text: "###{work_package.id}")
+ expect(container).to have_css("p", text: "###{work_package.id}")
end
end
- it 'renders work package quicklink macro ### with id link, subject, type, status, and dates' do
+ it "renders work package quicklink macro ### with id link, subject, type, status, and dates" do
editor.set_markdown "####{work_package.id}"
- click_on 'Save'
+ click_on "Save"
# Expect output widget
- within('#content') do
+ within("#content") do
expected_macro_text = "#{work_package.status.name}#{work_package.type.name.upcase} " \
"##{work_package.id}: My subject (01/01/2020 - 02/01/2020)"
- expect(page).to have_css('opce-macro-wp-quickinfo', text: expected_macro_text)
- expect(page).to have_css('span', text: work_package.status.name)
- expect(page).to have_css('span', text: work_package.type.name.upcase)
- expect(page).to have_css('.work-package--quickinfo.preview-trigger', text: "##{work_package.id}")
- expect(page).to have_css('span', text: 'My subject')
+ expect(page).to have_css("opce-macro-wp-quickinfo", text: expected_macro_text)
+ expect(page).to have_css("span", text: work_package.status.name)
+ expect(page).to have_css("span", text: work_package.type.name.upcase)
+ expect(page).to have_css(".work-package--quickinfo.preview-trigger", text: "##{work_package.id}")
+ expect(page).to have_css("span", text: "My subject")
# Dates are being rendered in two nested spans
- expect(page).to have_css('span', text: '01/01/2020', count: 2)
- expect(page).to have_css('span', text: '02/01/2020', count: 2)
+ expect(page).to have_css("span", text: "01/01/2020", count: 2)
+ expect(page).to have_css("span", text: "02/01/2020", count: 2)
end
# Edit page again
- click_on 'Edit'
+ click_on "Edit"
editor.in_editor do |container,|
- expect(container).to have_css('p', text: "####{work_package.id}")
+ expect(container).to have_css("p", text: "####{work_package.id}")
end
end
- it 'displays dates with work package detailed link macro only if a date is present' do
+ it "displays dates with work package detailed link macro only if a date is present" do
wp_no_dates =
create(:work_package,
subject: "No dates",
@@ -120,24 +120,24 @@
wp_start_date_only =
create(:work_package,
subject: "Start date only",
- start_date: Date.parse('2020-01-01'),
+ start_date: Date.parse("2020-01-01"),
due_date: nil)
wp_end_date_only =
create(:work_package,
subject: "End date only",
start_date: nil,
- due_date: Date.parse('2020-12-31'))
+ due_date: Date.parse("2020-12-31"))
wp_both_dates =
create(:work_package,
subject: "Both dates",
- start_date: Date.parse('2020-01-01'),
- due_date: Date.parse('2020-12-31'))
+ start_date: Date.parse("2020-01-01"),
+ due_date: Date.parse("2020-12-31"))
wp_milestone_with_date =
create(:work_package,
:is_milestone,
subject: "Milestone with date",
- start_date: Date.parse('2020-01-01'),
- due_date: Date.parse('2020-01-01'))
+ start_date: Date.parse("2020-01-01"),
+ due_date: Date.parse("2020-01-01"))
wp_milestone_without_date =
create(:work_package,
:is_milestone,
@@ -159,15 +159,15 @@
####{wp_milestone_without_date.id}
MD
- click_on 'Save'
+ click_on "Save"
- within('#content') do
- expect(page).to have_css('opce-macro-wp-quickinfo', text: /No dates$/)
- expect(page).to have_css('opce-macro-wp-quickinfo', text: 'Start date only (01/01/2020 - no finish date)')
- expect(page).to have_css('opce-macro-wp-quickinfo', text: 'End date only (no start date - 12/31/2020)')
- expect(page).to have_css('opce-macro-wp-quickinfo', text: 'Both dates (01/01/2020 - 12/31/2020)')
- expect(page).to have_css('opce-macro-wp-quickinfo', text: 'Milestone with date (01/01/2020)')
- expect(page).to have_css('opce-macro-wp-quickinfo', text: /Milestone without date$/)
+ within("#content") do
+ expect(page).to have_css("opce-macro-wp-quickinfo", text: /No dates$/)
+ expect(page).to have_css("opce-macro-wp-quickinfo", text: "Start date only (01/01/2020 - no finish date)")
+ expect(page).to have_css("opce-macro-wp-quickinfo", text: "End date only (no start date - 12/31/2020)")
+ expect(page).to have_css("opce-macro-wp-quickinfo", text: "Both dates (01/01/2020 - 12/31/2020)")
+ expect(page).to have_css("opce-macro-wp-quickinfo", text: "Milestone with date (01/01/2020)")
+ expect(page).to have_css("opce-macro-wp-quickinfo", text: /Milestone without date$/)
end
end
end
diff --git a/spec/features/wysiwyg/macros/work_package_button_spec.rb b/spec/features/wysiwyg/macros/work_package_button_spec.rb
index d8d601041d76..a57249f675e6 100644
--- a/spec/features/wysiwyg/macros/work_package_button_spec.rb
+++ b/spec/features/wysiwyg/macros/work_package_button_spec.rb
@@ -26,18 +26,18 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg work package button spec', :js do
+RSpec.describe "Wysiwyg work package button spec", :js do
shared_let(:admin) { create(:admin) }
let(:user) { admin }
- let!(:type) { create(:type, name: 'MyTaskName') }
+ let!(:type) { create(:type, name: "MyTaskName") }
let(:project) do
create(:valid_project,
- identifier: 'my-project',
+ identifier: "my-project",
enabled_module_names: %w[wiki work_package_tracking],
- name: 'My project name',
+ name: "My project name",
types: [type])
end
@@ -47,47 +47,47 @@
login_as(user)
end
- describe 'in wikis' do
- describe 'creating a wiki page' do
+ describe "in wikis" do
+ describe "creating a wiki page" do
before do
visit project_wiki_path(project, :wiki)
end
- it 'can add and edit an embedded table widget' do
+ it "can add and edit an embedded table widget" do
editor.in_editor do |_container, editable|
- editor.insert_macro 'Insert create work package button'
+ editor.insert_macro "Insert create work package button"
- expect(page).to have_css('.spot-modal')
- select 'MyTaskName', from: 'selected-type'
+ expect(page).to have_css(".spot-modal")
+ select "MyTaskName", from: "selected-type"
# Cancel editing
- find('.spot-modal--cancel-button').click
- expect(editable).to have_no_css('.macro.-create_work_package_link')
+ find(".spot-modal--cancel-button").click
+ expect(editable).to have_no_css(".macro.-create_work_package_link")
- editor.insert_macro 'Insert create work package button'
- select 'MyTaskName', from: 'selected-type'
- check 'button_style'
+ editor.insert_macro "Insert create work package button"
+ select "MyTaskName", from: "selected-type"
+ check "button_style"
# Save widget
- find('.spot-modal--submit-button').click
+ find(".spot-modal--submit-button").click
# Find widget, click to show toolbar
- modal = find('.button.op-uc-placeholder', text: 'Create work package')
+ modal = find(".button.op-uc-placeholder", text: "Create work package")
# Edit widget again
modal.click
- page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click
- expect(page).to have_checked_field('wp_button_macro_style')
- expect(page).to have_select('selected-type', selected: 'MyTaskName')
- find('.spot-modal--cancel-button').click
+ page.find(".ck-balloon-panel .ck-button", visible: :all, text: "Edit").click
+ expect(page).to have_checked_field("wp_button_macro_style")
+ expect(page).to have_select("selected-type", selected: "MyTaskName")
+ find(".spot-modal--cancel-button").click
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
+ within("#content") do
expect(page).to have_css("a[href=\"/projects/my-project/work_packages/new?type=#{type.id}\"]")
end
end
diff --git a/spec/features/wysiwyg/mentions_spec.rb b/spec/features/wysiwyg/mentions_spec.rb
index 4836f3617c04..e202759fd8e0 100644
--- a/spec/features/wysiwyg/mentions_spec.rb
+++ b/spec/features/wysiwyg/mentions_spec.rb
@@ -26,17 +26,17 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg work package mentions',
+RSpec.describe "Wysiwyg work package mentions",
:js,
:with_cuprite do
let!(:user) do
- create(:admin, firstname: 'MeMyself', lastname: 'AndI',
+ create(:admin, firstname: "MeMyself", lastname: "AndI",
member_with_permissions: { project => %i[view_work_packages edit_work_packages] })
end
let!(:user2) do
- create(:user, firstname: 'Foo', lastname: 'Bar',
+ create(:user, firstname: "Foo", lastname: "Bar",
member_with_permissions: { project => %i[view_work_packages edit_work_packages] })
end
let!(:edit_work_package_role) { create(:edit_work_package_role) }
@@ -44,19 +44,19 @@
let!(:view_work_package_role) { create(:view_work_package_role) }
let!(:work_package_editor) do
- create(:user, firstname: 'Bertram', lastname: 'Gilfoyle',
+ create(:user, firstname: "Bertram", lastname: "Gilfoyle",
member_with_roles: { work_package => edit_work_package_role })
end
let!(:work_package_commenter) do
- create(:user, firstname: 'Dinesh', lastname: 'Chugtai',
+ create(:user, firstname: "Dinesh", lastname: "Chugtai",
member_with_roles: { work_package => comment_work_package_role })
end
let!(:work_package_viewer) do
- create(:user, firstname: 'Richard', lastname: 'Hendricks',
+ create(:user, firstname: "Richard", lastname: "Hendricks",
member_with_roles: { work_package => view_work_package_role })
end
- let!(:group) { create(:group, firstname: 'Foogroup', lastname: 'Foogroup') }
+ let!(:group) { create(:group, firstname: "Foogroup", lastname: "Foogroup") }
let!(:group_role) { create(:project_role) }
let!(:group_member) do
create(:member,
@@ -67,17 +67,17 @@
let(:project) { create(:project, enabled_module_names: %w[work_package_tracking]) }
let!(:work_package) do
User.execute_as user do
- create(:work_package, subject: 'Foobar', project:)
+ create(:work_package, subject: "Foobar", project:)
end
end
let(:wp_page) { Pages::FullWorkPackage.new work_package, project }
let(:editor) { Components::WysiwygEditor.new }
- let(:selector) { '.work-packages--activity--add-comment' }
+ let(:selector) { ".work-packages--activity--add-comment" }
let(:comment_field) do
TextEditorField.new wp_page,
- 'comment',
+ "comment",
selector:
end
@@ -88,45 +88,45 @@
expect_angular_frontend_initialized
end
- it 'can autocomplete users, groups and emojis' do
+ it "can autocomplete users, groups and emojis" do
# Mentioning a user works
comment_field.activate!
comment_field.clear with_backspace: true
comment_field.input_element.send_keys("@Foo")
- expect(page).to have_css('.mention-list-item', text: user2.name)
- expect(page).to have_css('.mention-list-item', text: group.name)
+ expect(page).to have_css(".mention-list-item", text: user2.name)
+ expect(page).to have_css(".mention-list-item", text: group.name)
- page.find('.mention-list-item', text: user2.name).click
+ page.find(".mention-list-item", text: user2.name).click
expect(page)
- .to have_css('a.mention', text: '@Foo Bar')
+ .to have_css("a.mention", text: "@Foo Bar")
comment_field.submit_by_click if comment_field.active?
wp_page.expect_and_dismiss_toaster message: "The comment was successfully added."
expect(page)
- .to have_css('a.user-mention', text: 'Foo Bar')
+ .to have_css("a.user-mention", text: "Foo Bar")
# Mentioning myself works
comment_field.activate!
comment_field.clear with_backspace: true
comment_field.input_element.send_keys("@MeMyself")
- expect(page).to have_css('.mention-list-item', text: user.name)
+ expect(page).to have_css(".mention-list-item", text: user.name)
- page.find('.mention-list-item', text: user.name).click
+ page.find(".mention-list-item", text: user.name).click
expect(page)
- .to have_css('a.mention', text: '@MeMyself AndI')
+ .to have_css("a.mention", text: "@MeMyself AndI")
comment_field.submit_by_click if comment_field.active?
wp_page.expect_and_dismiss_toaster message: "The comment was successfully added."
expect(page)
- .to have_css('a.user-mention', text: 'MeMyself AndI')
+ .to have_css("a.user-mention", text: "MeMyself AndI")
# Mentioning a work package editor or commenter works
#
@@ -137,12 +137,12 @@
comment_field.input_element.send_keys("@Bertram Gilfoyle")
page.find(".mention-list-item", text: work_package_editor.name).click
expect(page)
- .to have_css('a.mention', text: "@Bertram Gilfoyle")
+ .to have_css("a.mention", text: "@Bertram Gilfoyle")
comment_field.submit_by_click if comment_field.active?
wp_page.expect_and_dismiss_toaster message: "The comment was successfully added."
expect(page)
- .to have_css('a.user-mention', text: 'Bertram Gilfoyle')
+ .to have_css("a.user-mention", text: "Bertram Gilfoyle")
#
# Commenter
#
@@ -151,12 +151,12 @@
comment_field.input_element.send_keys("@Dinesh Chugtai")
page.find(".mention-list-item", text: work_package_commenter.name).click
expect(page)
- .to have_css('a.mention', text: "@Dinesh Chugtai")
+ .to have_css("a.mention", text: "@Dinesh Chugtai")
comment_field.submit_by_click if comment_field.active?
wp_page.expect_and_dismiss_toaster message: "The comment was successfully added."
expect(page)
- .to have_css('a.user-mention', text: 'Dinesh Chugtai')
+ .to have_css("a.user-mention", text: "Dinesh Chugtai")
# Work Package viewers aren't mentionable
comment_field.activate!
@@ -171,41 +171,41 @@
comment_field.activate!
comment_field.clear with_backspace: true
comment_field.input_element.send_keys(" @Foo")
- expect(page).to have_css('.mention-list-item', text: user2.name)
- expect(page).to have_css('.mention-list-item', text: group.name)
+ expect(page).to have_css(".mention-list-item", text: user2.name)
+ expect(page).to have_css(".mention-list-item", text: group.name)
- page.find('.mention-list-item', text: group.name).click
+ page.find(".mention-list-item", text: group.name).click
expect(page)
- .to have_css('a.mention', text: '@Foogroup')
+ .to have_css("a.mention", text: "@Foogroup")
comment_field.submit_by_click if comment_field.active?
wp_page.expect_and_dismiss_toaster message: "The comment was successfully added."
expect(page)
- .to have_css('a.user-mention', text: 'Foogroup')
+ .to have_css("a.user-mention", text: "Foogroup")
# The mention is still displayed as such when reentering the comment field
- find('#activity-1 .op-user-activity')
+ find("#activity-1 .op-user-activity")
.hover
- within('#activity-1') do
+ within("#activity-1") do
click_button("Edit this comment")
end
expect(page)
- .to have_css('a.mention', text: '@Foo Bar')
+ .to have_css("a.mention", text: "@Foo Bar")
# Mentioning an emoji works
comment_field.activate!
comment_field.clear with_backspace: true
comment_field.input_element.send_keys(":thumbs")
- expect(page).to have_css('.mention-list-item', text: '👍 thumbs_up')
- expect(page).to have_css('.mention-list-item', text: '👎 thumbs_down')
+ expect(page).to have_css(".mention-list-item", text: "👍 thumbs_up")
+ expect(page).to have_css(".mention-list-item", text: "👎 thumbs_down")
- page.find('.mention-list-item', text: '👍 thumbs_up').click
+ page.find(".mention-list-item", text: "👍 thumbs_up").click
- expect(page).to have_css('span', text: '👍')
+ expect(page).to have_css("span", text: "👍")
end
end
diff --git a/spec/features/wysiwyg/paragraphs_in_lists_spec.rb b/spec/features/wysiwyg/paragraphs_in_lists_spec.rb
index d808753f6aa6..94024dfa181d 100644
--- a/spec/features/wysiwyg/paragraphs_in_lists_spec.rb
+++ b/spec/features/wysiwyg/paragraphs_in_lists_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg paragraphs in lists behavior (Regression #28765)', :js do
+RSpec.describe "Wysiwyg paragraphs in lists behavior (Regression #28765)", :js do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:editor) { Components::WysiwygEditor.new }
@@ -57,10 +57,10 @@
visit edit_project_wiki_path(project, wiki_page.slug)
end
- it 'shows the list correctly' do
+ it "shows the list correctly" do
editor.in_editor do |_container, editable|
- expect(editable).to have_css('ol li', count: 3)
- expect(editable).to have_no_css('ol li p')
+ expect(editable).to have_css("ol li", count: 3)
+ expect(editable).to have_no_css("ol li p")
end
end
end
diff --git a/spec/features/wysiwyg/tables_spec.rb b/spec/features/wysiwyg/tables_spec.rb
index 1dd848d0af61..8f927d97dff6 100644
--- a/spec/features/wysiwyg/tables_spec.rb
+++ b/spec/features/wysiwyg/tables_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg tables', :js do
+RSpec.describe "Wysiwyg tables", :js do
shared_let(:admin) { create(:admin) }
let(:user) { admin }
@@ -39,21 +39,21 @@
login_as(user)
end
- describe 'in wikis' do
- describe 'creating a wiki page' do
+ describe "in wikis" do
+ describe "creating a wiki page" do
before do
visit project_wiki_path(project, :wiki)
end
- it 'can add tables without headers' do
+ it "can add tables without headers" do
editor.in_editor do |container, editable|
# strangely, we need visible: :all here
- container.find('.ck-button', visible: :all, text: 'Insert table').click
+ container.find(".ck-button", visible: :all, text: "Insert table").click
# 2x2
- container.find('.ck-insert-table-dropdown-grid-box:nth-of-type(12)').click
+ container.find(".ck-insert-table-dropdown-grid-box:nth-of-type(12)").click
# Edit table
- tds = editable.all('.op-uc-table .op-uc-table--cell')
+ tds = editable.all(".op-uc-table .op-uc-table--cell")
expect(tds.length).to eq(4)
values = %w(h1 h&2 c1 c&2)
@@ -65,26 +65,26 @@
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
- expect(page).to have_css('table td', text: 'h1')
- expect(page).to have_css('table td', text: 'h&2')
- expect(page).to have_css('table td', text: 'c1')
- expect(page).to have_css('table td', text: 'c&2')
+ within("#content") do
+ expect(page).to have_css("table td", text: "h1")
+ expect(page).to have_css("table td", text: "h&2")
+ expect(page).to have_css("table td", text: "c1")
+ expect(page).to have_css("table td", text: "c&2")
end
end
- it 'can add tables with headers' do
+ it "can add tables with headers" do
editor.in_editor do |container, editable|
- editor.click_toolbar_button 'Insert table'
+ editor.click_toolbar_button "Insert table"
# 2x2
- container.find('.ck-insert-table-dropdown-grid-box:nth-of-type(12)').click
+ container.find(".ck-insert-table-dropdown-grid-box:nth-of-type(12)").click
# Edit table
- tds = editable.all('.op-uc-table .op-uc-table--cell')
+ tds = editable.all(".op-uc-table .op-uc-table--cell")
values = %w(h1 h2 a)
expect(tds.length).to eq(4)
@@ -99,55 +99,55 @@
tds.first.send_keys :tab
# Click row toolbar
- editor.click_hover_toolbar_button 'Row'
+ editor.click_hover_toolbar_button "Row"
# Enable header row
- header_button = find('.ck-switchbutton', text: 'Header row')
- header_button.find('.ck-button__toggle').click
+ header_button = find(".ck-switchbutton", text: "Header row")
+ header_button.find(".ck-button__toggle").click
# Table should now have header
- expect(editable).to have_css('th', count: 2)
- expect(editable).to have_css('td', count: 2)
- expect(editable).to have_css('th', text: 'h1')
- expect(editable).to have_css('th', text: 'h2')
- expect(editable).to have_css('td', text: 'a')
+ expect(editable).to have_css("th", count: 2)
+ expect(editable).to have_css("td", count: 2)
+ expect(editable).to have_css("th", text: "h1")
+ expect(editable).to have_css("th", text: "h2")
+ expect(editable).to have_css("td", text: "a")
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
- expect(page).to have_css('table th', text: 'h1')
- expect(page).to have_css('table th', text: 'h2')
- expect(page).to have_css('table td', count: 2)
- expect(page).to have_css('td', text: 'a')
+ within("#content") do
+ expect(page).to have_css("table th", text: "h1")
+ expect(page).to have_css("table th", text: "h2")
+ expect(page).to have_css("table td", count: 2)
+ expect(page).to have_css("td", text: "a")
end
SeleniumHubWaiter.wait
# Edit again
- click_on 'Edit'
+ click_on "Edit"
editor.in_editor do |_container, editable|
# Table should still have header
- expect(editable).to have_css('th', count: 2)
- expect(editable).to have_css('td', count: 2)
- expect(editable).to have_css('th', text: 'h1')
- expect(editable).to have_css('th', text: 'h2')
- expect(editable).to have_css('td', text: 'a')
+ expect(editable).to have_css("th", count: 2)
+ expect(editable).to have_css("td", count: 2)
+ expect(editable).to have_css("th", text: "h1")
+ expect(editable).to have_css("th", text: "h2")
+ expect(editable).to have_css("td", text: "a")
end
end
- it 'can add styled tables' do
+ it "can add styled tables" do
editor.in_editor do |container, editable|
# strangely, we need visible: :all here
- editor.click_toolbar_button 'Insert table'
+ editor.click_toolbar_button "Insert table"
# 2x2
- container.find('.ck-insert-table-dropdown-grid-box:nth-of-type(12)').click
+ container.find(".ck-insert-table-dropdown-grid-box:nth-of-type(12)").click
# Edit table
- tds = editable.all('.op-uc-table .op-uc-table--cell')
+ tds = editable.all(".op-uc-table .op-uc-table--cell")
expect(tds.length).to eq(4)
values = %w(h1 h2 a)
@@ -161,16 +161,16 @@
tds.first.click
# Click row toolbar
- editor.click_hover_toolbar_button 'Cell properties'
+ editor.click_hover_toolbar_button "Cell properties"
# Enable header row
- expect(page).to have_css('.ck-input-color input', count: 2)
+ expect(page).to have_css(".ck-input-color input", count: 2)
# Pick the latter one, it's the background color
- page.all('.ck-input-color input').last.set '#123456'
+ page.all(".ck-input-color input").last.set "#123456"
# Set vertical center / horizontal top
- editor.click_hover_toolbar_button 'Align cell text to the center'
- editor.click_hover_toolbar_button 'Align cell text to the top'
- find('.ck-button-save').click
+ editor.click_hover_toolbar_button "Align cell text to the center"
+ editor.click_hover_toolbar_button "Align cell text to the top"
+ find(".ck-button-save").click
# Table should now have header
expect(editable).to have_css('td[style*="background-color:#123456"]')
@@ -179,11 +179,11 @@
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
+ within("#content") do
expect(page).to have_css('td[style*="background-color:#123456"]')
expect(page).to have_css('td[style*="text-align:center"]')
expect(page).to have_css('td[style*="vertical-align:top"]')
@@ -191,33 +191,33 @@
SeleniumHubWaiter.wait
# Edit again
- click_on 'Edit'
+ click_on "Edit"
editor.in_editor do |_container, editable|
expect(editable).to have_css('td[style*="background-color:#123456"]')
# Change table styles
- tds = editable.all('.op-uc-table .op-uc-table--cell')
+ tds = editable.all(".op-uc-table .op-uc-table--cell")
# For some reason, the entire table is still selected so use tab to move to the next cell
tds[0].click
tds[0].send_keys :tab
- editor.click_hover_toolbar_button 'Table properties'
+ editor.click_hover_toolbar_button "Table properties"
# Set style to dotted
- page.find('.ck-table-form__border-style').click
- page.find('.ck-button_with-text', text: 'Dotted').click
- page.find('.ck-table-form__border-row .ck-input-color').set 'black'
- page.find('.ck-table-form__border-width .ck-input-text').set '10px'
+ page.find(".ck-table-form__border-style").click
+ page.find(".ck-button_with-text", text: "Dotted").click
+ page.find(".ck-table-form__border-row .ck-input-color").set "black"
+ page.find(".ck-table-form__border-width .ck-input-text").set "10px"
# background
- page.find('.ck-table-properties-form__background .ck-input-text').set 'red'
+ page.find(".ck-table-properties-form__background .ck-input-text").set "red"
# width, height
- page.find('.ck-table-form__dimensions-row__width .ck-input-text').set '500px'
- page.find('.ck-table-form__dimensions-row__height .ck-input-text').set '500px'
- find('.ck-button-save').click
+ page.find(".ck-table-form__dimensions-row__width .ck-input-text").set "500px"
+ page.find(".ck-table-form__dimensions-row__height .ck-input-text").set "500px"
+ find(".ck-button-save").click
# table height and width is set on figure
expect(editable).to have_css('figure[style*="width:500px"]')
@@ -230,11 +230,11 @@
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
+ within("#content") do
# table height and width is set on figure
expect(page).to have_css('figure[style*="width:500px"]')
expect(page).to have_css('figure[style*="height:500px"]')
@@ -246,7 +246,7 @@
end
# Edit again
- click_on 'Edit'
+ click_on "Edit"
# Expect all previous changes to be there
editor.in_editor do |_container, editable|
@@ -263,15 +263,15 @@
end
end
- it 'can restrict table cell width' do
+ it "can restrict table cell width" do
editor.in_editor do |container, editable|
# strangely, we need visible: :all here
- editor.click_toolbar_button 'Insert table'
+ editor.click_toolbar_button "Insert table"
# 2x2
- container.find('.ck-insert-table-dropdown-grid-box:nth-of-type(12)').click
+ container.find(".ck-insert-table-dropdown-grid-box:nth-of-type(12)").click
# Edit table
- tds = editable.all('.op-uc-table .op-uc-table--cell')
+ tds = editable.all(".op-uc-table .op-uc-table--cell")
expect(tds.length).to eq(4)
values = %w(h1 h2 a)
@@ -285,27 +285,27 @@
tds.first.click
# Click row toolbar
- editor.click_hover_toolbar_button 'Cell properties'
+ editor.click_hover_toolbar_button "Cell properties"
# Enable header row
- find('.ck-table-form__dimensions-row__width input').set '250px'
- find('.ck-button-save').click
+ find(".ck-table-form__dimensions-row__width input").set "250px"
+ find(".ck-button-save").click
expect(editable).to have_css('td[style*="width:250px"]')
end
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
+ within("#content") do
expect(page).to have_css('td[style*="width:250px"]')
end
SeleniumHubWaiter.wait
# Edit again
- click_on 'Edit'
+ click_on "Edit"
editor.in_editor do |_container, editable|
expect(editable).to have_css('td[style*="width:250px"]')
@@ -313,10 +313,10 @@
end
end
- describe 'editing a wiki page with tables' do
+ describe "editing a wiki page with tables" do
let(:wiki_page) do
page = build(:wiki_page,
- title: 'Wiki page with titles')
+ title: "Wiki page with titles")
page.text = <<~MARKDOWN
## This is markdown!
@@ -351,31 +351,31 @@
visit project_wiki_path(project, wiki_page.slug)
end
- it 'can show the table with header' do
- within('#content') do
- expect(page).to have_css('h2', text: 'This is markdown')
+ it "can show the table with header" do
+ within("#content") do
+ expect(page).to have_css("h2", text: "This is markdown")
- expect(page).to have_css('table thead th', text: 'A')
- expect(page).to have_css('table thead th', text: 'B')
- expect(page).to have_css('table td', text: 'c1')
- expect(page).to have_css('table td', text: 'c2')
- expect(page).to have_css('table td', text: 'c3')
- expect(page).to have_css('table td', text: 'c4')
+ expect(page).to have_css("table thead th", text: "A")
+ expect(page).to have_css("table thead th", text: "B")
+ expect(page).to have_css("table td", text: "c1")
+ expect(page).to have_css("table td", text: "c2")
+ expect(page).to have_css("table td", text: "c3")
+ expect(page).to have_css("table td", text: "c4")
end
# Edit the table
- click_on 'Edit'
+ click_on "Edit"
# Expect wysiwyg to render table
editor.in_editor do |_, editable|
- expect(editable).to have_css('h2', text: 'This is markdown')
-
- expect(editable).to have_css('table thead th', text: 'A')
- expect(editable).to have_css('table thead th', text: 'B')
- expect(editable).to have_css('table td', text: 'c1')
- expect(editable).to have_css('table td', text: 'c2')
- expect(editable).to have_css('table td', text: 'c3')
- expect(editable).to have_css('table td', text: 'c4')
+ expect(editable).to have_css("h2", text: "This is markdown")
+
+ expect(editable).to have_css("table thead th", text: "A")
+ expect(editable).to have_css("table thead th", text: "B")
+ expect(editable).to have_css("table td", text: "c1")
+ expect(editable).to have_css("table td", text: "c2")
+ expect(editable).to have_css("table td", text: "c3")
+ expect(editable).to have_css("table td", text: "c4")
end
end
end
diff --git a/spec/features/wysiwyg/ui_localization_spec.rb b/spec/features/wysiwyg/ui_localization_spec.rb
index 1c0756ad0e72..f6ede3559ce1 100644
--- a/spec/features/wysiwyg/ui_localization_spec.rb
+++ b/spec/features/wysiwyg/ui_localization_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'WYSIWYG UI localization', :js do
+RSpec.describe "WYSIWYG UI localization", :js do
let(:user) { create(:admin, language:) }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:editor) { Components::WysiwygEditor.new }
@@ -52,19 +52,19 @@
visit edit_project_wiki_path(project, wiki_page.slug)
end
- context 'with german locale' do
+ context "with german locale" do
let(:language) { :de }
- it 'renders the UI in German' do
- expect(page).to have_css('.ck-button__label', text: 'Absatz')
+ it "renders the UI in German" do
+ expect(page).to have_css(".ck-button__label", text: "Absatz")
end
end
- context 'with english locale' do
+ context "with english locale" do
let(:language) { :en }
- it 'renders the UI in English' do
- expect(page).to have_css('.ck-button__label', text: 'Paragraph')
+ it "renders the UI in English" do
+ expect(page).to have_css(".ck-button__label", text: "Paragraph")
end
end
end
diff --git a/spec/features/wysiwyg/work_package_linking_spec.rb b/spec/features/wysiwyg/work_package_linking_spec.rb
index 97bbc66084df..fbd2f3f133de 100644
--- a/spec/features/wysiwyg/work_package_linking_spec.rb
+++ b/spec/features/wysiwyg/work_package_linking_spec.rb
@@ -26,37 +26,37 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'Wysiwyg work package linking', :js do
+RSpec.describe "Wysiwyg work package linking", :js do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki work_package_tracking]) }
- let(:work_package) { create(:work_package, subject: 'Foobar', project:) }
+ let(:work_package) { create(:work_package, subject: "Foobar", project:) }
let(:editor) { Components::WysiwygEditor.new }
before do
login_as(user)
end
- describe 'creating a wiki page' do
+ describe "creating a wiki page" do
before do
visit project_wiki_path(project, :wiki)
end
- it 'can reference work packages' do
+ it "can reference work packages" do
# single hash autocomplete
editor.click_and_type_slowly "##{work_package.id}"
editor.click_autocomplete work_package.subject
- expect(editor.editor_element).to have_css('a.mention', text: "##{work_package.id}")
+ expect(editor.editor_element).to have_css("a.mention", text: "##{work_package.id}")
# Save wiki page
- click_on 'Save'
+ click_on "Save"
- expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_css(".op-toast.-success")
- within('#content') do
- expect(page).to have_css('a.issue', count: 1)
+ within("#content") do
+ expect(page).to have_css("a.issue", count: 1)
end
end
end
diff --git a/spec/helpers/additional_url_helper_spec.rb b/spec/helpers/additional_url_helper_spec.rb
index 3106ed0e7d0b..8fe015d39c5a 100644
--- a/spec/helpers/additional_url_helper_spec.rb
+++ b/spec/helpers/additional_url_helper_spec.rb
@@ -26,21 +26,21 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe AdditionalUrlHelpers do
- describe '#configurable_home_url' do
+ describe "#configurable_home_url" do
subject { helper.send :configurable_home_url }
- context 'when home_url is defined', with_settings: { home_url: 'https://example.com/foo/bar' } do
- it 'outputs that' do
- expect(subject).to eq 'https://example.com/foo/bar'
+ context "when home_url is defined", with_settings: { home_url: "https://example.com/foo/bar" } do
+ it "outputs that" do
+ expect(subject).to eq "https://example.com/foo/bar"
end
end
- context 'when home_url is not defined', with_settings: { home_url: nil } do
- it 'falls back to the default' do
- expect(subject).to eq 'http://test.host/'
+ context "when home_url is not defined", with_settings: { home_url: nil } do
+ it "falls back to the default" do
+ expect(subject).to eq "http://test.host/"
end
end
end
diff --git a/spec/helpers/angular_helper_spec.rb b/spec/helpers/angular_helper_spec.rb
index ae0127ccf993..44df8dd34468 100644
--- a/spec/helpers/angular_helper_spec.rb
+++ b/spec/helpers/angular_helper_spec.rb
@@ -26,32 +26,32 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe AngularHelper do
- let(:tag_name) { 'op-test' }
+ let(:tag_name) { "op-test" }
let(:options) do
{
- class: 'op-classname',
+ class: "op-classname",
inputs:,
data:
}
end
let(:data) do
{
- 'test-selector': 'foo'
+ "test-selector": "foo"
}
end
subject { helper.angular_component_tag tag_name, options }
- describe 'inputs transformations' do
+ describe "inputs transformations" do
let(:inputs) do
{
- key: 'value',
+ key: "value",
number: 1,
anArray: [1, 2, 3],
- someRandomObject: { complex: true, foo: 'bar' }
+ someRandomObject: { complex: true, foo: "bar" }
}
end
@@ -68,7 +68,7 @@
HTML
end
- it 'converts the inputs' do
+ it "converts the inputs" do
expect(subject).to be_html_eql(expected)
end
end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 60661df54c3d..a0aff1dc44e0 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe ApplicationHelper do
- describe '.link_to_if_authorized' do
+ describe ".link_to_if_authorized" do
let(:project) { create(:valid_project) }
let(:project_member) do
create(:user,
@@ -43,15 +43,15 @@
type: project.types.first)
end
- context 'if user is authorized' do
+ context "if user is authorized" do
before do
expect(self).to receive(:authorize_for).and_return(true)
- @response = link_to_if_authorized('link_content', {
- controller: 'work_packages',
- action: 'show',
+ @response = link_to_if_authorized("link_content", {
+ controller: "work_packages",
+ action: "show",
id: issue
},
- class: 'fancy_css_class')
+ class: "fancy_css_class")
end
subject { @response }
@@ -61,15 +61,15 @@
it { is_expected.to match /fancy_css_class/ }
end
- context 'if user is unauthorized' do
+ context "if user is unauthorized" do
before do
expect(self).to receive(:authorize_for).and_return(false)
- @response = link_to_if_authorized('link_content', {
- controller: 'work_packages',
- action: 'show',
+ @response = link_to_if_authorized("link_content", {
+ controller: "work_packages",
+ action: "show",
id: issue
},
- class: 'fancy_css_class')
+ class: "fancy_css_class")
end
subject { @response }
@@ -77,12 +77,12 @@
it { is_expected.to be_nil }
end
- context 'allow using the :controller and :action for the target link' do
+ context "allow using the :controller and :action for the target link" do
before do
expect(self).to receive(:authorize_for).and_return(true)
- @response = link_to_if_authorized('By controller/action',
- controller: 'work_packages',
- action: 'show',
+ @response = link_to_if_authorized("By controller/action",
+ controller: "work_packages",
+ action: "show",
id: issue.id)
end
@@ -92,10 +92,10 @@
end
end
- describe 'other_formats_links' do
- context 'link given' do
+ describe "other_formats_links" do
+ context "link given" do
before do
- @links = other_formats_links { |f| f.link_to 'Atom', url: { controller: :projects, action: :index } }
+ @links = other_formats_links { |f| f.link_to "Atom", url: { controller: :projects, action: :index } }
end
it {
@@ -103,29 +103,29 @@
}
end
- context 'link given but disabled' do
+ context "link given but disabled" do
before do
allow(Setting).to receive(:feeds_enabled?).and_return(false)
- @links = other_formats_links { |f| f.link_to 'Atom', url: { controller: :projects, action: :index } }
+ @links = other_formats_links { |f| f.link_to "Atom", url: { controller: :projects, action: :index } }
end
it { expect(@links).to be_nil }
end
end
- describe 'time_tag' do
+ describe "time_tag" do
around do |example|
I18n.with_locale(:en) { example.run }
end
subject { time_tag(time) }
- context 'with project' do
+ context "with project" do
before do
@project = build(:project)
end
- context 'right now' do
+ context "right now" do
let(:time) { Time.now }
it { is_expected.to match /^Hello', lastname: 'world')
+ describe ".authoring_at" do
+ it "escapes html from author name" do
+ created = "2023-06-02"
+ author = build(:user, firstname: "Hello", lastname: "world")
author.save! validate: false
expect(authoring_at(created, author))
.to eq("Added by <b>Hello</b> world at 2023-06-02")
end
end
- describe '.all_lang_options_for_select' do
+ describe ".all_lang_options_for_select" do
it 'has all languages translated ("English" should appear only once)' do
impostor_locales =
all_lang_options_for_select
- .reject { |_lang, locale| locale == 'en' }
+ .reject { |_lang, locale| locale == "en" }
.select { |lang, _locale| lang == "English" }
.map { |_lang, locale| locale }
expect(impostor_locales.count).to eq(0), <<~ERR
@@ -202,7 +202,7 @@
ERR
end
- it 'has distinct languages translation' do
+ it "has distinct languages translation" do
duplicate_langs =
all_lang_options_for_select
.map { |lang, _locale| lang }
diff --git a/spec/helpers/archived_projects_helper_spec.rb b/spec/helpers/archived_projects_helper_spec.rb
index a11256ffceae..f799ae256e98 100644
--- a/spec/helpers/archived_projects_helper_spec.rb
+++ b/spec/helpers/archived_projects_helper_spec.rb
@@ -26,10 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe ArchivedProjectsHelper do
- describe '#archived_projects_urls_for' do
+ describe "#archived_projects_urls_for" do
subject { helper.archived_projects_urls_for([archived_project, other_archived_project]) }
shared_let(:archived_project) { create(:project, :archived) }
@@ -43,7 +43,7 @@
"{\"name_and_identifier\":{\"operator\":\"=\",\"values\":[\"#{other_archived_project.name}\"]}}]"
end
- it 'returns a comma-separated list of anchor tags for each archived project' do
+ it "returns a comma-separated list of anchor tags for each archived project" do
expect(subject)
.to eq(
"" \
diff --git a/spec/helpers/custom_styles_helper_spec.rb b/spec/helpers/custom_styles_helper_spec.rb
index f9a5d5a25754..4ed937c4dcf3 100644
--- a/spec/helpers/custom_styles_helper_spec.rb
+++ b/spec/helpers/custom_styles_helper_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe CustomStylesHelper do
let(:current_theme) { nil }
@@ -37,45 +37,45 @@
allow(OpenProject::Configuration).to receive(:bim?).and_return(bim_edition?)
end
- describe '.apply_custom_styles?' do
+ describe ".apply_custom_styles?" do
subject { helper.apply_custom_styles? }
- context 'no CustomStyle present' do
- it 'is falsey' do
+ context "no CustomStyle present" do
+ it "is falsey" do
expect(subject).to be_falsey
end
end
- context 'CustomStyle present' do
+ context "CustomStyle present" do
let(:current_theme) { build_stubbed(:custom_style) }
- context 'without EE', with_ee: false do
- context 'no BIM edition' do
- it 'is falsey' do
+ context "without EE", with_ee: false do
+ context "no BIM edition" do
+ it "is falsey" do
expect(subject).to be_falsey
end
end
- context 'BIM edition' do
+ context "BIM edition" do
let(:bim_edition?) { true }
- it 'is truthy' do
+ it "is truthy" do
expect(subject).to be_truthy
end
end
end
- context 'with EE', with_ee: %i[define_custom_style] do
- context 'no BIM edition' do
- it 'is truthy' do
+ context "with EE", with_ee: %i[define_custom_style] do
+ context "no BIM edition" do
+ it "is truthy" do
expect(subject).to be_truthy
end
end
- context 'BIM edition' do
+ context "BIM edition" do
let(:bim_edition?) { true }
- it 'is truthy' do
+ it "is truthy" do
expect(subject).to be_truthy
end
end
@@ -83,14 +83,14 @@
end
end
- shared_examples('apply when ee present') do
- context 'no CustomStyle present' do
- it 'is falsey' do
+ shared_examples("apply when ee present") do
+ context "no CustomStyle present" do
+ it "is falsey" do
expect(subject).to be_falsey
end
end
- context 'CustomStyle present' do
+ context "CustomStyle present" do
let(:current_theme) { build_stubbed(:custom_style) }
before do
@@ -98,29 +98,29 @@
allow(current_theme).to receive(:touch_icon).and_return(true)
end
- context 'without EE', with_ee: false do
- it 'is falsey' do
+ context "without EE", with_ee: false do
+ it "is falsey" do
expect(subject).to be_falsey
end
end
- context 'with EE', with_ee: %i[define_custom_style] do
- it 'is truthy' do
+ context "with EE", with_ee: %i[define_custom_style] do
+ it "is truthy" do
expect(subject).to be_truthy
end
end
end
end
- describe '.apply_custom_favicon?' do
+ describe ".apply_custom_favicon?" do
subject { helper.apply_custom_favicon? }
- it_behaves_like 'apply when ee present'
+ it_behaves_like "apply when ee present"
end
- describe '.apply_custom_touch_icon?' do
+ describe ".apply_custom_touch_icon?" do
subject { helper.apply_custom_touch_icon? }
- it_behaves_like 'apply when ee present'
+ it_behaves_like "apply when ee present"
end
end
diff --git a/spec/helpers/error_message_helper_spec.rb b/spec/helpers/error_message_helper_spec.rb
index 27f5ba39649e..fc4eb7043db1 100644
--- a/spec/helpers/error_message_helper_spec.rb
+++ b/spec/helpers/error_message_helper_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe ErrorMessageHelper do
let(:model) { WikiPage.new }
@@ -35,55 +35,55 @@ def escape_html(array)
array.map { CGI.escapeHTML _1 }
end
- shared_examples 'error messages rendering' do
- context 'when no errors' do
- it { expect(rendered).to eq('') }
+ shared_examples "error messages rendering" do
+ context "when no errors" do
+ it { expect(rendered).to eq("") }
end
- context 'with one field error' do
+ context "with one field error" do
before do
errors.add(:title, :blank)
end
- it { expect(rendered).to include(t('activerecord.errors.template.header', model: 'Wiki page', count: 1)) }
- it { expect(rendered).to include(t('errors.header_invalid_fields', count: 1)) }
+ it { expect(rendered).to include(t("activerecord.errors.template.header", model: "Wiki page", count: 1)) }
+ it { expect(rendered).to include(t("errors.header_invalid_fields", count: 1)) }
it { expect(rendered).to include(*escape_html(errors.full_messages)) }
end
- context 'with two field errors' do
+ context "with two field errors" do
before do
errors.add(:title, :blank)
errors.add(:author, :blank)
end
- it { expect(rendered).to include(t('activerecord.errors.template.header', model: 'Wiki page', count: 2)) }
- it { expect(rendered).to include(t('errors.header_invalid_fields', count: 2)) }
+ it { expect(rendered).to include(t("activerecord.errors.template.header", model: "Wiki page", count: 2)) }
+ it { expect(rendered).to include(t("errors.header_invalid_fields", count: 2)) }
it { expect(rendered).to include(*escape_html(errors.full_messages)) }
end
- context 'with one base error' do
+ context "with one base error" do
before do
errors.add(:base, :error_unauthorized)
end
- it { expect(rendered).to include(t('activerecord.errors.template.header', model: 'Wiki page', count: 1)) }
- it { expect(rendered).not_to include(t('errors.header_invalid_fields', count: 1)) }
- it { expect(rendered).not_to include(t('errors.header_additional_invalid_fields', count: 1)) }
+ it { expect(rendered).to include(t("activerecord.errors.template.header", model: "Wiki page", count: 1)) }
+ it { expect(rendered).not_to include(t("errors.header_invalid_fields", count: 1)) }
+ it { expect(rendered).not_to include(t("errors.header_additional_invalid_fields", count: 1)) }
it { expect(rendered).to include(*escape_html(errors.full_messages)) }
end
- context 'with one base error and one field error' do
+ context "with one base error and one field error" do
before do
errors.add(:base, :error_unauthorized)
errors.add(:title, :blank)
end
- it { expect(rendered).to include(t('activerecord.errors.template.header', model: 'Wiki page', count: 2)) }
- it { expect(rendered).to include(t('errors.header_additional_invalid_fields', count: 1)) }
+ it { expect(rendered).to include(t("activerecord.errors.template.header", model: "Wiki page", count: 2)) }
+ it { expect(rendered).to include(t("errors.header_additional_invalid_fields", count: 1)) }
it { expect(rendered).to include(*escape_html(errors.full_messages)) }
end
- context 'with two base errors and two field errors' do
+ context "with two base errors and two field errors" do
before do
errors.add(:base, :error_unauthorized)
errors.add(:title, :blank)
@@ -91,29 +91,29 @@ def escape_html(array)
errors.add(:author, :blank)
end
- it { expect(rendered).to include(t('activerecord.errors.template.header', model: 'Wiki page', count: 4)) }
- it { expect(rendered).to include(t('errors.header_additional_invalid_fields', count: 2)) }
+ it { expect(rendered).to include(t("activerecord.errors.template.header", model: "Wiki page", count: 4)) }
+ it { expect(rendered).to include(t("errors.header_additional_invalid_fields", count: 2)) }
it { expect(rendered).to include(*escape_html(errors.full_messages)) }
end
end
- describe '#error_messages_for' do
+ describe "#error_messages_for" do
let(:errors) { model.errors }
subject(:rendered) { helper.error_messages_for(model) }
- it 'accesses the model from instance variables if a name is given' do
+ it "accesses the model from instance variables if a name is given" do
helper.instance_variable_set(:@wiki_page, model)
model.errors.add(:base, :error_conflict)
- expect(helper.error_messages_for('wiki_page')).to include(*escape_html(errors.full_messages))
+ expect(helper.error_messages_for("wiki_page")).to include(*escape_html(errors.full_messages))
end
- it 'renders nothing if there is no instance variable with the given name' do
+ it "renders nothing if there is no instance variable with the given name" do
helper.instance_variable_set(:@wiki_page, model)
model.errors.add(:base, :error_conflict)
- expect(helper.error_messages_for('work_package')).to be_nil
+ expect(helper.error_messages_for("work_package")).to be_nil
end
- include_examples 'error messages rendering'
+ include_examples "error messages rendering"
end
end
diff --git a/spec/helpers/frontend_asset_helper_spec.rb b/spec/helpers/frontend_asset_helper_spec.rb
index d38d20346658..0ac08a05ff76 100644
--- a/spec/helpers/frontend_asset_helper_spec.rb
+++ b/spec/helpers/frontend_asset_helper_spec.rb
@@ -26,46 +26,46 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe FrontendAssetHelper do
- describe '#include_frontend_assets' do
- context 'when in development or test',
- with_env: { 'OPENPROJECT_DISABLE_DEV_ASSET_PROXY' => '' } do
+ describe "#include_frontend_assets" do
+ context "when in development or test",
+ with_env: { "OPENPROJECT_DISABLE_DEV_ASSET_PROXY" => "" } do
before do
allow(Rails.env).to receive(:production?).and_return(false)
end
- it 'returns the proxied frontend server' do
+ it "returns the proxied frontend server" do
expect(helper.include_frontend_assets).to match(%r{script src="http://localhost:4200/assets/frontend/main(.*).js"})
end
end
- context 'when in production' do
+ context "when in production" do
before do
allow(Rails.env).to receive(:production?).and_return(true)
end
- it 'returns the path to the asset' do
+ it "returns the path to the asset" do
expect(helper.include_frontend_assets).to match(%r{script src="/assets/frontend/main(.*).js"})
end
- context 'when using relative_url_root' do
+ context "when using relative_url_root" do
before do
controller.config.relative_url_root = "/openproject"
end
- it 'prepends it to the asset path' do
+ it "prepends it to the asset path" do
expect(helper.include_frontend_assets).to match(%r{script src="/openproject/assets/frontend/main(.*).js"})
end
end
- context 'when using relative_url_root ending with a slash' do
+ context "when using relative_url_root ending with a slash" do
before do
controller.config.relative_url_root = "/openproject/"
end
- it 'prepends it to the asset path only once (bug #41428)' do
+ it "prepends it to the asset path only once (bug #41428)" do
expect(helper.include_frontend_assets).to match(%r{script src="/openproject/assets/frontend/main(.*).js"})
end
end
diff --git a/spec/helpers/hook_helper_spec.rb b/spec/helpers/hook_helper_spec.rb
index e7966cf54e75..c0ac787826f7 100644
--- a/spec/helpers/hook_helper_spec.rb
+++ b/spec/helpers/hook_helper_spec.rb
@@ -25,11 +25,11 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe HookHelper do
- describe '#call_hook' do
- context 'when called within a controller' do
+ describe "#call_hook" do
+ context "when called within a controller" do
let(:test_hook_controller_class) do
# Also tests that the application controller has the model included
Class.new(ApplicationController)
@@ -49,7 +49,7 @@
instance_double(ActionDispatch::Request)
end
- it 'adds to the context' do
+ it "adds to the context" do
allow(OpenProject::Hook)
.to receive(:call_hook)
@@ -64,7 +64,7 @@
end
end
- context 'when called within a view' do
+ context "when called within a view" do
let(:test_hook_view_class) do
# Also tests that the application controller has the model included
Class.new(ActionView::Base) do
@@ -73,7 +73,7 @@
end
let(:instance) do
test_hook_view_class
- .new(ActionView::LookupContext.new(Rails.root.join('app/views')), {}, nil)
+ .new(ActionView::LookupContext.new(Rails.root.join("app/views")), {}, nil)
.tap do |inst|
inst.instance_variable_set(:@project, project)
allow(inst)
@@ -94,7 +94,7 @@
instance_double(ApplicationController)
end
- it 'adds to the context' do
+ it "adds to the context" do
# mimics having two different classes registered for the hook
allow(OpenProject::Hook)
.to receive(:call_hook)
diff --git a/spec/helpers/individual_principal_hooks_helper_spec.rb b/spec/helpers/individual_principal_hooks_helper_spec.rb
index 8130da348177..6c268d76441b 100644
--- a/spec/helpers/individual_principal_hooks_helper_spec.rb
+++ b/spec/helpers/individual_principal_hooks_helper_spec.rb
@@ -26,28 +26,28 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe IndividualPrincipalHooksHelper do
let(:user) { build(:user) }
let(:placeholder_user) { build(:placeholder_user) }
- describe '#individual_principal_key' do
- it 'returns the class name in underscore format' do
+ describe "#individual_principal_key" do
+ it "returns the class name in underscore format" do
expect(helper.individual_principal_key(user)).to be(:user)
expect(helper.individual_principal_key(placeholder_user)).to be(:placeholder_user)
end
end
- describe '#call_individual_principals_memberships_hook' do
+ describe "#call_individual_principals_memberships_hook" do
before do
allow(helper)
.to receive(:call_hook)
end
- context 'with user and without context' do
- it 'call call_hook with the correct arguments' do
- helper.call_individual_principals_memberships_hook(user, 'foo')
+ context "with user and without context" do
+ it "call call_hook with the correct arguments" do
+ helper.call_individual_principals_memberships_hook(user, "foo")
expect(helper)
.to have_received(:call_hook)
@@ -56,9 +56,9 @@
end
end
- context 'with placeholder user and without context' do
- it 'call call_hook with the correct arguments' do
- helper.call_individual_principals_memberships_hook(placeholder_user, 'foo')
+ context "with placeholder user and without context" do
+ it "call call_hook with the correct arguments" do
+ helper.call_individual_principals_memberships_hook(placeholder_user, "foo")
expect(helper)
.to have_received(:call_hook)
@@ -67,15 +67,15 @@
end
end
- context 'with user and with context' do
- it 'call call_hook with the correct arguments' do
- helper.call_individual_principals_memberships_hook(user, 'foo', yay: 'yo')
+ context "with user and with context" do
+ it "call call_hook with the correct arguments" do
+ helper.call_individual_principals_memberships_hook(user, "foo", yay: "yo")
expect(helper)
.to have_received(:call_hook)
.with(:view_users_memberships_table_foo,
user:,
- yay: 'yo')
+ yay: "yo")
end
end
end
diff --git a/spec/helpers/journals_helper_spec.rb b/spec/helpers/journals_helper_spec.rb
index 1a5d20b46fae..8dd35375916f 100644
--- a/spec/helpers/journals_helper_spec.rb
+++ b/spec/helpers/journals_helper_spec.rb
@@ -28,16 +28,16 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe JournalsHelper do
- describe 'back_to_activity_page_url' do
+ describe "back_to_activity_page_url" do
{
- 'all' => 'http://test.host/activities',
- 'projects/some-identifier' => 'http://test.host/projects/some-identifier/activities',
- 'unsupported_gizmo' => nil,
- 'users/5' => 'http://test.host/users/5',
- 'work_packages/42' => 'http://test.host/work_packages/42',
+ "all" => "http://test.host/activities",
+ "projects/some-identifier" => "http://test.host/projects/some-identifier/activities",
+ "unsupported_gizmo" => nil,
+ "users/5" => "http://test.host/users/5",
+ "work_packages/42" => "http://test.host/work_packages/42",
nil => nil
}.each do |activity_page, expected_url|
context "when activity page is #{activity_page.inspect}" do
diff --git a/spec/helpers/no_results_helper_spec.rb b/spec/helpers/no_results_helper_spec.rb
index e26b8f230400..9def7d0d2549 100644
--- a/spec/helpers/no_results_helper_spec.rb
+++ b/spec/helpers/no_results_helper_spec.rb
@@ -26,36 +26,36 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe NoResultsHelper do
before do
- allow(helper).to receive(:t).with('.no_results_title_text', cascade: true).and_return("Nothing here!")
- allow(helper).to receive(:t).with('.no_results_content_text').and_return("Add some foo")
+ allow(helper).to receive(:t).with(".no_results_title_text", cascade: true).and_return("Nothing here!")
+ allow(helper).to receive(:t).with(".no_results_content_text").and_return("Add some foo")
end
- describe '#no_results_box' do
+ describe "#no_results_box" do
it "contains the just the title" do
- expect(helper.no_results_box).to have_content 'Nothing here!'
- expect(helper.no_results_box).to have_no_link 'Add some foo'
+ expect(helper.no_results_box).to have_content "Nothing here!"
+ expect(helper.no_results_box).to have_no_link "Add some foo"
end
it "contains the title and content link" do
no_results_box = helper.no_results_box(action_url: root_path,
display_action: true)
- expect(no_results_box).to have_content 'Nothing here!'
- expect(no_results_box).to have_link 'Add some foo', href: '/'
+ expect(no_results_box).to have_content "Nothing here!"
+ expect(no_results_box).to have_link "Add some foo", href: "/"
end
- it 'contains title and content_link with custom text' do
+ it "contains title and content_link with custom text" do
no_results_box = helper.no_results_box(action_url: root_path,
display_action: true,
- custom_title: 'This is a different title about foo',
- custom_action_text: 'Link to nowhere')
+ custom_title: "This is a different title about foo",
+ custom_action_text: "Link to nowhere")
- expect(no_results_box).to have_content 'This is a different title about foo'
- expect(no_results_box).to have_link 'Link to nowhere', href: '/'
+ expect(no_results_box).to have_content "This is a different title about foo"
+ expect(no_results_box).to have_link "Link to nowhere", href: "/"
end
end
end
diff --git a/spec/helpers/pagination_helper_spec.rb b/spec/helpers/pagination_helper_spec.rb
index 718e06fc454f..211a598597bc 100644
--- a/spec/helpers/pagination_helper_spec.rb
+++ b/spec/helpers/pagination_helper_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe PaginationHelper do
let(:paginator) do
@@ -45,7 +45,7 @@
paginator
end
- describe '#pagination_links_full' do
+ describe "#pagination_links_full" do
let(:per_page) { 10 }
let(:total_entries) { 55 }
let(:offset) { 1 }
@@ -59,25 +59,25 @@
allow(helper)
.to receive(:params)
- .and_return(ActionController::Parameters.new(controller: 'work_packages', action: 'index'))
+ .and_return(ActionController::Parameters.new(controller: "work_packages", action: "index"))
allow(helper)
.to receive(:url_options)
- .and_return(url_options.merge(controller: 'work_packages', action: 'index'))
+ .and_return(url_options.merge(controller: "work_packages", action: "index"))
end
it "is inside a 'pagination' div" do
- expect(pagination).to have_css('div.op-pagination')
+ expect(pagination).to have_css("div.op-pagination")
end
- it 'has a next_page reference' do
- expect(pagination).to have_css('.op-pagination--item_next')
+ it "has a next_page reference" do
+ expect(pagination).to have_css(".op-pagination--item_next")
end
- it 'does not have a previous_page reference' do
- expect(pagination).to have_no_css('.op-pagination--item_prev')
+ it "does not have a previous_page reference" do
+ expect(pagination).to have_no_css(".op-pagination--item_prev")
end
- it 'has links to every page except the current one' do
+ it "has links to every page except the current one" do
(1..(total_entries / per_page)).each do |i|
next if i == current_page
@@ -86,23 +86,23 @@
end
end
- it 'does not have a link to the current page' do
- expect(pagination).to have_no_css('a', text: Regexp.new("^#{current_page}$"))
+ it "does not have a link to the current page" do
+ expect(pagination).to have_no_css("a", text: Regexp.new("^#{current_page}$"))
end
- it 'has an element for the current page' do
- expect(pagination).to have_css('.op-pagination--item_current',
+ it "has an element for the current page" do
+ expect(pagination).to have_css(".op-pagination--item_current",
text: Regexp.new("^#{current_page}$"))
end
- it 'shows the range of the entries displayed' do
+ it "shows the range of the entries displayed" do
range = "(#{(current_page * per_page) - per_page + 1} - " +
"#{current_page * per_page}/#{total_entries})"
- expect(pagination).to have_css('.op-pagination--range', text: range)
+ expect(pagination).to have_css(".op-pagination--range", text: range)
end
- it 'has different urls if the params are specified as options' do
- params = { controller: 'work_packages', action: 'index' }
+ it "has different urls if the params are specified as options" do
+ params = { controller: "work_packages", action: "index" }
pagination = helper.pagination_links_full(paginator, params:)
@@ -115,74 +115,74 @@
end
end
- it 'shows the available per page options' do
+ it "shows the available per page options" do
allow(Setting)
.to receive(:per_page_options)
.and_return("#{per_page},#{per_page * 10}")
- expect(pagination).to have_css('.op-pagination--options')
+ expect(pagination).to have_css(".op-pagination--options")
- expect(pagination).to have_css('.op-pagination--options .op-pagination--item_current', text: per_page)
+ expect(pagination).to have_css(".op-pagination--options .op-pagination--item_current", text: per_page)
path = work_packages_path(page: current_page, per_page: Setting.per_page_options_array.last)
expect(pagination).to have_css(".op-pagination--options a[href='#{path}']")
end
- describe 'WHEN the first page is the current' do
+ describe "WHEN the first page is the current" do
let(:current_page) { 1 }
- it 'deactivates the previous page link' do
- expect(pagination).to have_no_css('.op-pagination--item_prev')
+ it "deactivates the previous page link" do
+ expect(pagination).to have_no_css(".op-pagination--item_prev")
end
- it 'has a link to the next page' do
+ it "has a link to the next page" do
path = work_packages_path(page: current_page + 1)
expect(pagination).to have_css(".op-pagination--item_next a[href='#{path}']")
end
end
- describe 'WHEN the last page is the current' do
+ describe "WHEN the last page is the current" do
let(:current_page) { (total_entries / per_page) + 1 }
- it 'deactivates the next page link' do
- expect(pagination).to have_no_css('.op-pagination--item_next')
+ it "deactivates the next page link" do
+ expect(pagination).to have_no_css(".op-pagination--item_next")
end
- it 'has a link to the previous page' do
+ it "has a link to the previous page" do
path = work_packages_path(page: current_page - 1)
expect(pagination).to have_css(".op-pagination--item_prev a[href='#{path}']")
end
end
- describe 'WHEN the paginated object is empty' do
+ describe "WHEN the paginated object is empty" do
let(:total_entries) { 0 }
- it 'shows no pages' do
- expect(pagination).to have_no_css('.op-pagination--items .op-pagination--item')
+ it "shows no pages" do
+ expect(pagination).to have_no_css(".op-pagination--items .op-pagination--item")
end
- it 'shows no pagination' do
- expect(pagination).to have_no_css('.op-pagination')
+ it "shows no pagination" do
+ expect(pagination).to have_no_css(".op-pagination")
end
end
end
- describe '#page_param' do
- it 'returns page if provided and sensible' do
+ describe "#page_param" do
+ it "returns page if provided and sensible" do
page = 2
expect(page_param(page:)).to eq(page)
end
- it 'returns default page 1 if page provided but useless' do
+ it "returns default page 1 if page provided but useless" do
page = 0
expect(page_param(page:)).to eq(1)
end
- context 'with multiples per_page',
- with_settings: { per_page_options: '5,10,15' } do
- it 'calculates page from offset and limit if page is not provided' do
+ context "with multiples per_page",
+ with_settings: { per_page_options: "5,10,15" } do
+ it "calculates page from offset and limit if page is not provided" do
# need to change settings as only multiples of per_page
# are allowed for limit
offset = 55
@@ -192,7 +192,7 @@
end
end
- it 'ignores offset and limit if page is provided' do
+ it "ignores offset and limit if page is provided" do
offset = 55
limit = 10
page = 7
@@ -200,30 +200,30 @@
expect(page_param(offset:, limit:, page:)).to eq(page)
end
- context 'faulty settings',
- with_settings: { per_page_options: '-1,2,3' } do
- it 'does not break if limit is bogus (also faulty settings)' do
+ context "faulty settings",
+ with_settings: { per_page_options: "-1,2,3" } do
+ it "does not break if limit is bogus (also faulty settings)" do
offset = 55
- limit = 'lorem'
+ limit = "lorem"
expect(page_param(offset:, limit:)).to eq(28)
end
end
- it 'returns 1 if nothing is provided' do
+ it "returns 1 if nothing is provided" do
expect(page_param({})).to eq(1)
end
end
- describe '#per_page_param',
- with_settings: { per_page_options: '1,2,3' } do
- it 'returns per_page if provided and one of the values stored in the settings' do
+ describe "#per_page_param",
+ with_settings: { per_page_options: "1,2,3" } do
+ it "returns per_page if provided and one of the values stored in the settings" do
per_page = 2
expect(per_page_param(per_page:)).to eq(per_page)
end
- it 'returns per_page if provided and store it in the session' do
+ it "returns per_page if provided and store it in the session" do
session[:per_page] = 3
per_page = 2
@@ -231,39 +231,39 @@
expect(session[:per_page]).to eq(2)
end
- it 'should take the smallest value stored in the settings ' +
- 'if provided per_page param is not one of the configured' do
+ it "should take the smallest value stored in the settings " +
+ "if provided per_page param is not one of the configured" do
per_page = 4
expect(per_page_param(per_page:)).to eq(1)
end
- it 'prefers the value stored in the session if it is valid according to the settings' do
+ it "prefers the value stored in the session if it is valid according to the settings" do
session[:per_page] = 2
expect(per_page_param(per_page: 3)).to eq(session[:per_page])
end
- it 'ignores the value stored in the session if it is not valid according to the settings' do
+ it "ignores the value stored in the session if it is not valid according to the settings" do
session[:per_page] = 4
expect(per_page_param(per_page: 3)).to eq(3)
end
- it 'uses limit synonymously to per_page' do
+ it "uses limit synonymously to per_page" do
limit = 2
expect(per_page_param(limit:)).to eq(limit)
end
- it 'prefers per_page over limit' do
+ it "prefers per_page over limit" do
limit = 2
per_page = 3
expect(per_page_param(limit:, per_page:)).to eq(per_page)
end
- it 'stores the value in the session' do
+ it "stores the value in the session" do
limit = 2
per_page_param(limit:)
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb
index 0bb6537acf12..7b5636d71aef 100644
--- a/spec/helpers/projects_helper_spec.rb
+++ b/spec/helpers/projects_helper_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe ProjectsHelper do
include ApplicationHelper
@@ -47,53 +47,53 @@
.and_return(query_instance)
end
- describe '#short_project_description' do
+ describe "#short_project_description" do
let(:project) { build_stubbed(:project, description: "#{'Abcd ' * 5}\n" * 11) }
- it 'returns shortened description' do
+ it "returns shortened description" do
expect(helper.short_project_description(project))
.to eql("#{("#{'Abcd ' * 5}\n" * 10)[0..-2]}...")
end
end
- describe '#projects_columns_options' do
+ describe "#projects_columns_options" do
before do
project_selects
end
- it 'returns the columns options' do
+ it "returns the columns options" do
expect(helper.projects_columns_options)
.to eql([
- { name: 'Description', id: :description },
- { name: 'Name', id: :name },
- { name: 'Status', id: :project_status }
+ { name: "Description", id: :description },
+ { name: "Name", id: :name },
+ { name: "Status", id: :project_status }
])
end
end
- describe '#selected_project_columns_options', with_settings: { enabled_projects_columns: %w[name description] } do
+ describe "#selected_project_columns_options", with_settings: { enabled_projects_columns: %w[name description] } do
before do
project_selects
end
- it 'returns the columns options currently persisted in the setting (in that order)' do
+ it "returns the columns options currently persisted in the setting (in that order)" do
expect(helper.selected_projects_columns_options)
.to eql([
- { name: 'Name', id: :name },
- { name: 'Description', id: :description }
+ { name: "Name", id: :name },
+ { name: "Description", id: :description }
])
end
end
- describe '#protected_project_columns_options' do
+ describe "#protected_project_columns_options" do
before do
project_selects
end
- it 'returns the columns options currently persisted in the setting (in that order)' do
+ it "returns the columns options currently persisted in the setting (in that order)" do
expect(helper.protected_projects_columns_options)
.to eql([
- { name: 'Name', id: :name }
+ { name: "Name", id: :name }
])
end
end
diff --git a/spec/helpers/removed_js_helpers_helper_spec.rb b/spec/helpers/removed_js_helpers_helper_spec.rb
index 4644f9282ec8..270cf090ae73 100644
--- a/spec/helpers/removed_js_helpers_helper_spec.rb
+++ b/spec/helpers/removed_js_helpers_helper_spec.rb
@@ -26,24 +26,24 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe RemovedJsHelpersHelper do
include RemovedJsHelpersHelper
- describe 'link_to_function' do
- it 'returns a valid link' do
- allow(SecureRandom).to receive(:uuid).and_return 'uuid'
+ describe "link_to_function" do
+ it "returns a valid link" do
+ allow(SecureRandom).to receive(:uuid).and_return "uuid"
expect(self).to receive(:content_for).with(:additional_js_dom_ready)
- expect(link_to_function('blubs', nil))
+ expect(link_to_function("blubs", nil))
.to be_html_eql %{
blubs
}
end
- it 'adds the provided method to the onclick handler' do
+ it "adds the provided method to the onclick handler" do
expect(self).to receive(:content_for).with(:additional_js_dom_ready)
- expect(link_to_function('blubs', 'doTheMagic(now)', id: :foo))
+ expect(link_to_function("blubs", "doTheMagic(now)", id: :foo))
.to be_html_eql %{
blubs
}
diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb
index da48346fda98..2c52aa6b73ff 100644
--- a/spec/helpers/search_helper_spec.rb
+++ b/spec/helpers/search_helper_spec.rb
@@ -26,37 +26,37 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
-RSpec.describe 'search/index' do
+RSpec.describe "search/index" do
let(:project) { create(:project) }
- let(:scope) { 'foobar' }
+ let(:scope) { "foobar" }
before do
allow(helper).to receive(:params).and_return(
- q: 'foobar',
- all_words: '1',
+ q: "foobar",
+ all_words: "1",
scope:
)
assign(:project, project)
end
- describe '#highlight_tokens' do
+ describe "#highlight_tokens" do
let(:maximum_length) { 1300 }
subject(:highlighted_title) { helper.highlight_tokens title, tokens }
- context 'with single token' do
+ context "with single token" do
let(:tokens) { %w(token) }
- let(:title) { 'This is a token.' }
+ let(:title) { "This is a token." }
let(:expected_title) { 'This is a token.' }
it { is_expected.to eq expected_title }
end
- context 'with multiple tokens' do
+ context "with multiple tokens" do
let(:tokens) { %w(token another) }
- let(:title) { 'This is a token and another token.' }
+ let(:title) { "This is a token and another token." }
let(:expected_title) do
<<~TITLE.squish
This is a token
@@ -68,19 +68,19 @@
it { is_expected.to eq expected_title }
end
- context 'with huge content' do
+ context "with huge content" do
let(:tokens) { %w(token) }
let(:title) { "#{'1234567890' * 100} token " * 100 }
let(:highlighted_token) { 'token' }
it { expect(highlighted_title).to include highlighted_token }
- it 'does not exceed maximum length' do
+ it "does not exceed maximum length" do
expect(highlighted_title.length).to be <= maximum_length
end
end
- context 'with multibyte title' do
+ context "with multibyte title" do
let(:tokens) { %w(token) }
let(:title) { "#{'й' * 200} token #{'й' * 200}" }
let(:expected_title) do
@@ -91,7 +91,7 @@
end
end
- describe '#highlight_tokens_in_event' do
+ describe "#highlight_tokens_in_event" do
let(:journal_notes) { "Journals notes" }
let(:event_description) { "The description of the event" }
let(:attachment_fulltext) { "The fulltext of the attachment" }
@@ -118,58 +118,58 @@
end
end
- context 'with the token in the journal notes' do
+ context "with the token in the journal notes" do
let(:tokens) { %w(journals) }
- it 'shows the text in the notes' do
+ it "shows the text in the notes" do
expect(helper.highlight_tokens_in_event(event, tokens))
.to eql 'Journals notes'
end
end
- context 'with the token in the description' do
+ context "with the token in the description" do
let(:tokens) { %w(description) }
- it 'shows the text in the description' do
+ it "shows the text in the description" do
expect(helper.highlight_tokens_in_event(event, tokens))
.to eql 'The description of the event'
end
end
- context 'with the token in the description and empty journal notes' do
+ context "with the token in the description and empty journal notes" do
let(:tokens) { %w(description) }
let(:journal_notes) { "" }
- it 'shows the text in the description' do
+ it "shows the text in the description" do
expect(helper.highlight_tokens_in_event(event, tokens))
.to eql 'The description of the event'
end
end
- context 'with the token in the attachment text' do
+ context "with the token in the attachment text" do
let(:tokens) { %w(fulltext) }
- it 'shows the text in the fulltext' do
+ it "shows the text in the fulltext" do
expect(helper.highlight_tokens_in_event(event, tokens))
.to eql 'The fulltext of the attachment'
end
end
- context 'with the token in the attachment filename' do
+ context "with the token in the attachment filename" do
let(:tokens) { %w(filename) }
- it 'shows the text in the fulltext' do
+ it "shows the text in the fulltext" do
expect(helper.highlight_tokens_in_event(event, tokens))
.to eql 'attachment_filename.txt'
end
end
- context 'with the token in neither' do
+ context "with the token in neither" do
let(:tokens) { %w(bogus) }
- it 'shows the description (without highlight)' do
+ it "shows the description (without highlight)" do
expect(helper.highlight_tokens_in_event(event, tokens))
- .to eql 'The description of the event'
+ .to eql "The description of the event"
end
end
end
diff --git a/spec/helpers/security_badge_helper_spec.rb b/spec/helpers/security_badge_helper_spec.rb
index 9b53f468acd4..05c6c8443f23 100644
--- a/spec/helpers/security_badge_helper_spec.rb
+++ b/spec/helpers/security_badge_helper_spec.rb
@@ -26,13 +26,13 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe SecurityBadgeHelper do
- describe '#security_badge_url' do
+ describe "#security_badge_url" do
before do
# can't use with_settings since Setting.installation_uuid has a custom implementation
- allow(Setting).to receive(:installation_uuid).and_return 'abcd1234'
+ allow(Setting).to receive(:installation_uuid).and_return "abcd1234"
end
it "generates a URL with the release API path and the details of the installation" do
diff --git a/spec/helpers/settings_helper_spec.rb b/spec/helpers/settings_helper_spec.rb
index d9f4f24d4484..96a9d04c47e0 100644
--- a/spec/helpers/settings_helper_spec.rb
+++ b/spec/helpers/settings_helper_spec.rb
@@ -26,13 +26,13 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
RSpec.describe SettingsHelper do
include Capybara::RSpecMatchers
- let(:options) { { class: 'custom-class' } }
+ let(:options) { { class: "custom-class" } }
before do
allow(Setting)
@@ -40,145 +40,145 @@
.and_return true
allow(I18n).to receive(:t).and_call_original
- allow(I18n).to receive(:t).with('setting_field_a').and_return('Field A')
- allow(I18n).to receive(:t).with('setting_field_b').and_return('Field B')
- allow(I18n).to receive(:t).with('setting_field').and_return('Field')
+ allow(I18n).to receive(:t).with("setting_field_a").and_return("Field A")
+ allow(I18n).to receive(:t).with("setting_field_b").and_return("Field B")
+ allow(I18n).to receive(:t).with("setting_field").and_return("Field")
end
- shared_examples_for 'field disabled if non writable' do
- context 'when the setting is writable' do
- it 'is enabled' do
+ shared_examples_for "field disabled if non writable" do
+ context "when the setting is writable" do
+ it "is enabled" do
expect(output)
- .to have_field 'settings_host_name', disabled: false
+ .to have_field "settings_host_name", disabled: false
end
end
- context 'when the setting isn`t writable' do
+ context "when the setting isn`t writable" do
before do
allow(Setting)
.to receive(:host_name_writable?)
.and_return false
end
- it 'is disabled' do
+ it "is disabled" do
expect(output)
- .to have_field 'settings_host_name', disabled: true
+ .to have_field "settings_host_name", disabled: true
end
end
end
- describe '#setting_select' do
+ describe "#setting_select" do
subject(:output) do
- helper.setting_select :host_name, [['Popsickle', '1'], ['Jello', '2'], ['Ice Cream', '3']], options
+ helper.setting_select :host_name, [["Popsickle", "1"], ["Jello", "2"], ["Ice Cream", "3"]], options
end
before do
- allow(Setting).to receive(:host_name).and_return('2')
+ allow(Setting).to receive(:host_name).and_return("2")
end
- it_behaves_like 'labelled by default'
- it_behaves_like 'wrapped in field-container by default'
- it_behaves_like 'wrapped in container', 'select-container'
- it_behaves_like 'field disabled if non writable'
+ it_behaves_like "labelled by default"
+ it_behaves_like "wrapped in field-container by default"
+ it_behaves_like "wrapped in container", "select-container"
+ it_behaves_like "field disabled if non writable"
- it 'outputs element' do
- expect(output).to have_css 'select.form--select > option', count: 3
- expect(output).to have_select 'settings_host_name', selected: 'Jello'
+ it "outputs element" do
+ expect(output).to have_css "select.form--select > option", count: 3
+ expect(output).to have_select "settings_host_name", selected: "Jello"
end
end
- describe '#setting_multiselect' do
+ describe "#setting_multiselect" do
subject(:output) do
- helper.setting_multiselect :host_name, [['Popsickle', '1'], ['Jello', '2'], ['Ice Cream', '3']], options
+ helper.setting_multiselect :host_name, [["Popsickle", "1"], ["Jello", "2"], ["Ice Cream", "3"]], options
end
before do
- allow(Setting).to receive(:host_name).at_least(:once).and_return('1')
+ allow(Setting).to receive(:host_name).at_least(:once).and_return("1")
end
- it_behaves_like 'wrapped in container' do
+ it_behaves_like "wrapped in container" do
let(:container_count) { 3 }
end
- it 'has checkboxes wrapped in checkbox-container' do
- expect(output).to have_css 'span.form--check-box-container', count: 3
+ it "has checkboxes wrapped in checkbox-container" do
+ expect(output).to have_css "span.form--check-box-container", count: 3
end
- it 'has three labels' do
- expect(output).to have_css 'label.form--label-with-check-box', count: 3
+ it "has three labels" do
+ expect(output).to have_css "label.form--label-with-check-box", count: 3
end
- it 'outputs element' do
+ it "outputs element" do
expect(output).to have_css 'input[type="checkbox"].form--check-box', count: 3
end
- context 'when the setting isn`t writable' do
+ context "when the setting isn`t writable" do
before do
allow(Setting)
.to receive(:host_name_writable?)
.and_return false
end
- it 'is disabled and has no hidden field' do
+ it "is disabled and has no hidden field" do
expect(output).to have_no_css 'input[type="hidden"][value=""]', visible: :all
expect(output).to have_css 'input[type="checkbox"][disabled="disabled"].form--check-box', count: 3
end
end
end
- describe '#settings_matrix' do
+ describe "#settings_matrix" do
subject(:output) do
settings = %i[host_name protocol]
choices = [
{
- caption: 'Popsickle',
- value: '1'
+ caption: "Popsickle",
+ value: "1"
},
{
- caption: 'Jello',
- value: '2'
+ caption: "Jello",
+ value: "2"
},
{
- caption: 'Ice Cream',
- value: '3'
+ caption: "Ice Cream",
+ value: "3"
},
{
- value: 'Quarkspeise'
+ value: "Quarkspeise"
}
]
helper.settings_matrix settings, choices
end
before do
- allow(Setting).to receive(:host_name).at_least(:once).and_return('2')
- allow(Setting).to receive(:protocol).at_least(:once).and_return('3')
+ allow(Setting).to receive(:host_name).at_least(:once).and_return("2")
+ allow(Setting).to receive(:protocol).at_least(:once).and_return("3")
allow(Setting).to receive_messages(
host_name_writable?: true,
protocol_writable?: true
)
end
- it_behaves_like 'not wrapped in container'
+ it_behaves_like "not wrapped in container"
- it 'is structured as a table' do
- expect(output).to have_css 'table.form--matrix'
+ it "is structured as a table" do
+ expect(output).to have_css "table.form--matrix"
end
- it 'has table headers' do
- expect(output).to have_css 'thead th.form--matrix-header-cell', count: 3
+ it "has table headers" do
+ expect(output).to have_css "thead th.form--matrix-header-cell", count: 3
end
- it 'has three table rows' do
- expect(output).to have_css 'tbody > tr.form--matrix-row', count: 4
+ it "has three table rows" do
+ expect(output).to have_css "tbody > tr.form--matrix-row", count: 4
end
- it 'has cells with text labels' do
+ it "has cells with text labels" do
expect(output).to be_html_eql(%{
Popsickle |
- }).at_path('tr:first-child > td:first-child')
+ }).at_path("tr:first-child > td:first-child")
end
- it 'has cells with styled checkboxes' do
+ it "has cells with styled checkboxes" do
expect(output).to be_html_eql(%{
@@ -186,7 +186,7 @@
name="settings[host_name][]" type="checkbox" value="1">
|
- }).at_path('tr.form--matrix-row:first-child > td:nth-of-type(2)')
+ }).at_path("tr.form--matrix-row:first-child > td:nth-of-type(2)")
expect(output).to be_html_eql(%{
@@ -195,22 +195,22 @@
name="settings[host_name][]" type="checkbox" value="Quarkspeise">
|
- }).at_path('tr.form--matrix-row:last-child > td:nth-of-type(2)')
+ }).at_path("tr.form--matrix-row:last-child > td:nth-of-type(2)")
end
- it 'has the correct fields checked' do
- expect(output).to have_checked_field 'host_name_2'
- expect(output).to have_checked_field 'protocol_3'
+ it "has the correct fields checked" do
+ expect(output).to have_checked_field "host_name_2"
+ expect(output).to have_checked_field "protocol_3"
end
- context 'when the setting isn`t writable' do
+ context "when the setting isn`t writable" do
before do
allow(Setting)
.to receive(:host_name_writable?)
.and_return false
end
- it 'is disabled' do
+ it "is disabled" do
expect(output).to be_html_eql(%{
@@ -218,146 +218,146 @@
name="settings[host_name][]" type="checkbox" disabled="disabled" value="1">
|
- }).at_path('tr.form--matrix-row:first-child > td:nth-of-type(2)')
+ }).at_path("tr.form--matrix-row:first-child > td:nth-of-type(2)")
end
end
end
- describe '#setting_text_field' do
+ describe "#setting_text_field" do
subject(:output) do
helper.setting_text_field :host_name, options
end
before do
- allow(Setting).to receive(:host_name).and_return('important value')
+ allow(Setting).to receive(:host_name).and_return("important value")
end
- it_behaves_like 'labelled by default'
- it_behaves_like 'wrapped in field-container by default'
- it_behaves_like 'wrapped in container', 'text-field-container'
- it_behaves_like 'field disabled if non writable'
+ it_behaves_like "labelled by default"
+ it_behaves_like "wrapped in field-container by default"
+ it_behaves_like "wrapped in container", "text-field-container"
+ it_behaves_like "field disabled if non writable"
- it 'outputs element' do
+ it "outputs element" do
expect(output).to be_html_eql(%{
- }).at_path('input')
+ }).at_path("input")
end
end
- describe '#setting_text_area' do
+ describe "#setting_text_area" do
subject(:output) do
helper.setting_text_area :host_name, options
end
before do
- allow(Setting).to receive(:host_name).and_return('important text')
+ allow(Setting).to receive(:host_name).and_return("important text")
end
- it_behaves_like 'labelled by default'
- it_behaves_like 'wrapped in field-container by default'
- it_behaves_like 'wrapped in container', 'text-area-container'
- it_behaves_like 'field disabled if non writable'
+ it_behaves_like "labelled by default"
+ it_behaves_like "wrapped in field-container by default"
+ it_behaves_like "wrapped in container", "text-area-container"
+ it_behaves_like "field disabled if non writable"
- it 'outputs element' do
+ it "outputs element" do
expect(output).to be_html_eql(%{
- }).at_path('textarea')
+ }).at_path("textarea")
end
end
- describe '#setting_check_box' do
+ describe "#setting_check_box" do
subject(:output) do
helper.setting_check_box :host_name, options
end
- context 'when setting is true' do
+ context "when setting is true" do
before do
allow(Setting).to receive(:host_name?).and_return(true)
end
- it_behaves_like 'labelled by default'
- it_behaves_like 'wrapped in field-container by default'
- it_behaves_like 'wrapped in container', 'check-box-container'
- it_behaves_like 'field disabled if non writable'
+ it_behaves_like "labelled by default"
+ it_behaves_like "wrapped in field-container by default"
+ it_behaves_like "wrapped in container", "check-box-container"
+ it_behaves_like "field disabled if non writable"
- it 'outputs element' do
+ it "outputs element" do
expect(output).to have_css 'input[type="hidden"][value=0]', visible: :hidden
expect(output).to have_css 'input[type="checkbox"].custom-class.form--check-box'
- expect(output).to have_checked_field 'settings_host_name'
+ expect(output).to have_checked_field "settings_host_name"
end
- context 'when the setting isn`t writable' do
+ context "when the setting isn`t writable" do
before do
allow(Setting)
.to receive(:host_name_writable?)
.and_return false
end
- it 'does not output a hidden field' do
+ it "does not output a hidden field" do
expect(output).to have_no_css 'input[type="hidden"][value=0]', visible: :hidden
end
end
end
- context 'when setting is false' do
+ context "when setting is false" do
before do
allow(Setting).to receive(:host_name?).and_return(false)
end
- it_behaves_like 'labelled by default'
- it_behaves_like 'wrapped in field-container by default'
- it_behaves_like 'wrapped in container', 'check-box-container'
- it_behaves_like 'field disabled if non writable'
+ it_behaves_like "labelled by default"
+ it_behaves_like "wrapped in field-container by default"
+ it_behaves_like "wrapped in container", "check-box-container"
+ it_behaves_like "field disabled if non writable"
- it 'outputs element' do
+ it "outputs element" do
expect(output).to have_css 'input[type="hidden"][value=0]', visible: :hidden
expect(output).to have_css 'input[type="checkbox"].custom-class.form--check-box'
- expect(output).to have_unchecked_field 'settings_host_name'
+ expect(output).to have_unchecked_field "settings_host_name"
end
- context 'when the setting isn`t writable' do
+ context "when the setting isn`t writable" do
before do
allow(Setting)
.to receive(:host_name_writable?)
.and_return false
end
- it 'does not output a hidden field' do
+ it "does not output a hidden field" do
expect(output).to have_no_css 'input[type="hidden"][value=0]', visible: :hidden
end
end
end
end
- describe '#setting_time_field' do
+ describe "#setting_time_field" do
subject(:output) do
helper.setting_time_field :host_name, options
end
before do
- allow(Setting).to receive(:host_name).and_return('16:00')
+ allow(Setting).to receive(:host_name).and_return("16:00")
end
- it_behaves_like 'labelled by default'
- it_behaves_like 'wrapped in field-container by default'
- it_behaves_like 'wrapped in container', 'text-field-container'
+ it_behaves_like "labelled by default"
+ it_behaves_like "wrapped in field-container by default"
+ it_behaves_like "wrapped in container", "text-field-container"
- it 'outputs element' do
+ it "outputs element" do
expect(output).to be_html_eql(%{
- }).at_path('input')
+ }).at_path("input")
end
end
- describe '#setting_label' do
+ describe "#setting_label" do
subject(:output) do
helper.setting_label :host_name
end
- it_behaves_like 'labelled'
- it_behaves_like 'not wrapped in container'
+ it_behaves_like "labelled"
+ it_behaves_like "not wrapped in container"
end
end
diff --git a/spec/helpers/sort_helper_spec.rb b/spec/helpers/sort_helper_spec.rb
index d6cd9a256199..374782219614 100644
--- a/spec/helpers/sort_helper_spec.rb
+++ b/spec/helpers/sort_helper_spec.rb
@@ -26,107 +26,107 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'spec_helper'
+require "spec_helper"
RSpec.describe SortHelper do
- describe '#sort_init/#sort_update/#sort_clause' do
+ describe "#sort_init/#sort_update/#sort_clause" do
# Needed to mimic being included in a controller
- def controller_name; 'foo'; end
+ def controller_name; "foo"; end
- def action_name; 'bar'; end
+ def action_name; "bar"; end
before do
- sort_init 'attr1', 'desc'
+ sort_init "attr1", "desc"
end
- context 'with arrays' do
+ context "with arrays" do
before do
sort_update(%w[attr1 attr2])
end
- it 'returns the first attr in descending order' do
+ it "returns the first attr in descending order" do
expect(sort_clause)
- .to eql 'attr1 DESC'
+ .to eql "attr1 DESC"
end
end
- context 'with hashes' do
+ context "with hashes" do
before do
- sort_update('attr1' => 'table1.attr1', 'attr2' => 'table2.attr2')
+ sort_update("attr1" => "table1.attr1", "attr2" => "table2.attr2")
end
- it 'returns the first attr in descending order with the table name prefixed' do
+ it "returns the first attr in descending order with the table name prefixed" do
expect(sort_clause)
- .to eql 'table1.attr1 DESC'
+ .to eql "table1.attr1 DESC"
end
end
- context 'with hashes sorting by multiple values' do
+ context "with hashes sorting by multiple values" do
before do
- sort_update('attr1' => %w[table1.attr1 table1.attr2], 'attr2' => 'table2.attr2')
+ sort_update("attr1" => %w[table1.attr1 table1.attr2], "attr2" => "table2.attr2")
end
- it 'returns the first attr in descending order' do
+ it "returns the first attr in descending order" do
expect(sort_clause)
- .to eql 'table1.attr1 DESC, table1.attr2 DESC'
+ .to eql "table1.attr1 DESC, table1.attr2 DESC"
end
end
end
- describe '#sort_init/#sort_update/params/session' do
+ describe "#sort_init/#sort_update/params/session" do
# Needed to mimic being included in a controller
- def controller_name; 'foo'; end
+ def controller_name; "foo"; end
- def action_name; 'bar'; end
+ def action_name; "bar"; end
def params; { sort: sort_param }; end
def session; @session ||= {}; end
before do
- sort_init 'attr1', 'desc'
- sort_update('attr1' => %w[table1.attr1 table1.attr2], 'attr2' => 'table2.attr2')
+ sort_init "attr1", "desc"
+ sort_update("attr1" => %w[table1.attr1 table1.attr2], "attr2" => "table2.attr2")
end
- context 'with valid sort params' do
- let(:sort_param) { 'attr1,attr2:desc' }
+ context "with valid sort params" do
+ let(:sort_param) { "attr1,attr2:desc" }
- it 'persists the order in the session' do
- expect(session['foo_bar_sort'])
- .to eql 'attr1,attr2:desc'
+ it "persists the order in the session" do
+ expect(session["foo_bar_sort"])
+ .to eql "attr1,attr2:desc"
end
end
- context 'with invalid sort key' do
- let(:sort_param) { 'invalid_key' }
+ context "with invalid sort key" do
+ let(:sort_param) { "invalid_key" }
- it 'keeps the default sort in the session' do
- expect(session['foo_bar_sort'])
- .to eql 'attr1:desc'
+ it "keeps the default sort in the session" do
+ expect(session["foo_bar_sort"])
+ .to eql "attr1:desc"
end
end
- context 'with invalid sort direction' do
- let(:sort_param) { 'attr1:blubs,attr2' }
+ context "with invalid sort direction" do
+ let(:sort_param) { "attr1:blubs,attr2" }
- it 'falls back to the default sort order in the session' do
- expect(session['foo_bar_sort'])
- .to eql 'attr1,attr2'
+ it "falls back to the default sort order in the session" do
+ expect(session["foo_bar_sort"])
+ .to eql "attr1,attr2"
end
end
end
- describe '#sort_header_tag' do
+ describe "#sort_header_tag" do
let(:output) do
- helper.sort_header_tag('id')
+ helper.sort_header_tag("id")
end
- let(:sort_key) { '' }
+ let(:sort_key) { "" }
let(:sort_asc) { true }
let(:sort_criteria) do
instance_double(SortHelper::SortCriteria,
first_key: sort_key,
first_asc?: sort_asc,
- to_param: 'sort_criteria_params').as_null_object
+ to_param: "sort_criteria_params").as_null_object
end
before do
@@ -136,10 +136,10 @@ def session; @session ||= {}; end
# fake having called '/work_packages'
allow(helper)
.to receive(:url_options)
- .and_return(url_options.merge(controller: 'work_packages', action: 'index'))
+ .and_return(url_options.merge(controller: "work_packages", action: "index"))
end
- it 'renders a th with a sort link' do
+ it "renders a th with a sort link" do
expect(output).to be_html_eql(%{
|