Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add specs

Mir Bhatia81ecd29d2561
diff --git a/spec/features/work_packages/is_empty_filter_spec.rb b/spec/features/work_packages/is_empty_filter_spec.rb
index ea70bfe76e9..9dfd464a668 100644
--- a/spec/features/work_packages/is_empty_filter_spec.rb
+++ b/spec/features/work_packages/is_empty_filter_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe 'Filter by date with "is empty"', js: true do
let(:work_package_with_start_date) do
create(:work_package,
project:,
- start_date: Date.today)
+ start_date: Time.zone.today)
end
let(:work_package_without_dates) do
@@ -53,21 +53,46 @@ RSpec.describe 'Filter by date with "is empty"', js: true do
project:)
end
+ let(:work_package_with_custom_date) do
+ create(:work_package,
+ project:)
+ end
+
+ let(:custom_field_date) do
+ create(:date_wp_custom_field,
+ name: 'Date CF',
+ is_filter: true,
+ searchable: true).tap do |custom_field|
+ project.work_package_custom_fields << custom_field
+ work_package_with_custom_date.type.custom_fields << custom_field
+
+ create(:work_package_custom_value,
+ custom_field:,
+ customized: work_package_with_custom_date,
+ value: Time.zone.today)
+ end
+ end
+
+ 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')
+ end
+
before do
login_as(user)
member
work_package_without_dates
work_package_with_start_date
+ work_package_with_custom_date
+ custom_field_date
wp_table.visit!
end
- it 'for regular fields works as intended' do
- wp_table.expect_work_package_listed work_package_without_dates, work_package_with_start_date
-
- filters.expect_filter_count 1
- filters.open
- filters.remove_filter('status')
+ it 'works as intended for regular fields' do
+ remove_default
filters.add_filter_by('Start date', 'is empty', nil, 'startDate')
@@ -75,7 +100,12 @@ RSpec.describe 'Filter by date with "is empty"', js: true do
wp_table.ensure_work_package_not_listed! work_package_with_start_date
end
- it 'for custom fields works as intended' do
- # TO 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}")
+
+ wp_table.expect_work_package_listed work_package_without_dates
+ wp_table.ensure_work_package_not_listed! work_package_with_custom_date
end
end