64 Commits

Author SHA1 Message Date
Tobias Dillmann 61c5224cbd [#73887] mocked_permission_helper mirrors UserPermissibleService for empty project
It should not grant all permissions if the project argument is `nil`.
2026-06-10 19:47:12 +02:00
Alexander Brandon Coles 801984e8b9 Stabilize time-sensitive feature specs
Use shared_let for frozen feature spec times
2026-03-10 15:26:39 -03:00
Christophe Bliard b06120d4e3 Add ability to use identifiers in table helpers
This allows to use identifiers in table helpers without checking the
subjects. That's useful for work packages with types having
automatically generated subjects.
2025-10-28 10:16:53 +01:00
Kabiru Mwenja b52debb70d Style/ItBlockParameter: Use it block parameter.RuboCopStyle/ItBlockParameter (#19318) 2025-06-26 13:36:49 +03:00
OpenProject Actions CI 2dcedec67a Merge branch 'release/16.0' into dev 2025-05-28 03:46:46 +00:00
Christophe Bliard 010359aaa3 Make table helpers supports hierarchy column in expect_work_packages
When using `expect_work_packages`, if the column name is `hierarchy`,
the indentations of the work packages names will indicate parent-child
relationships.

So it's possible to check if a work package is parent of another one
along with other properties by writing something like this:

```ruby
expect_work_packages([parent, child], <<~TABLE)
  | hierarchy | duration |
  | parent    |        3 |
  |   child1  |        2 |
  |   child2  |        2 |
TABLE
```

If `child2` is not a child of `parent`, this test would fail.
2025-05-23 14:58:09 +02:00
Jan Sandbrink 0b87e7543f Freeze string literals in specs
Rolling out frozen string literals further by freezing all
string literals in core specs.
2025-05-05 09:29:55 +02:00
Christophe Bliard ea2844e939 table_helpers: Add successor relations column type
Example usage:
  | subject      | successors                   |
  | predecessor2 | main, predecessor with lag 2 |
  | predecessor  | precedes main                |
  | main         |                              |
2025-04-01 18:11:10 +02:00
Christophe Bliard 6a836d758e table_helpers: fix bug when defining multiple relations at once
ActiveSupport deep_merge does not concatenate arrays from different
hashes. Relations were stored as an array.

Switch to a hash to store all relations without any loss.
2025-03-28 16:56:52 +01:00
Jan Sandbrink 112ae02926 Update Ruby copyright headers using rake task
This effectively removes the year from a bunch of copyright headers.
We stopped indicating a specific year at some point, but
didn't propagate this change to every file yet.
2025-03-18 14:23:54 +01:00
Christophe Bliard 59825de677 table_helpers: Fix issue with empty tables 2025-02-25 09:12:26 +01:00
Christophe Bliard 26fbc5522a [59539] switch scheduling mode when modifying follows relations
When a work package becomes a successor of another work package, its
scheduling mode is switched to automatic if it has no children so that
it can be scheduled as soon as possible automatically.

Similarly, when a work package is no longer a successor of any other
work package, its scheduling mode is switched to manual if it has no
children and no dates so that it can keep its current dates.
2025-02-25 09:12:25 +01:00
Christophe Bliard c0a3e0edc3 table helpers: rename properties column to predecessors
It was only used to specify predecessors, so it makes more sense, and it
now allows a shorter syntax: "follows wp1, wp2, wp3".
2025-02-25 09:12:24 +01:00
Christophe Bliard f72692d3fe Show non-working days in the rendered table of table helpers 2025-02-25 09:12:22 +01:00
Christophe Bliard 2d7288d317 [59539] Make work packages manually scheduled by default
The `schedule_manually` column is also non-nullable now.

This includes the following changes:

- Automatically scheduled parent dates are and `ignore_non_working_days`
  attributes are now always derived from children's values, even if the
  children are scheduled manually.

  It's more natural. Without that, adding a child to a work package
  would not change the parent's dates.

  As a consequence, the parent can start on a non-working day if one of
  its children is manually scheduled, ignores non-working days, and
  starts on a non-working day. That's why the parent's
  `ignore_non_working_days` attribute is now also derived from all its
  children regardless of the scheduling mode.

  If the parent is manually scheduled, its dates and it's ability to
  ignore non-working days will still be defined independently from its
  children.

- Fix tests broken by scheduling mode being manual by default.

  The tests had to be adapted to explicitly set scheduling mode to
  automatic for followers and parents, and sometimes even follower's
  children. Without it, work packages would not be rescheduled
  automatically.

- Replace schedule helpers with table helpers.

  Schedule helpers helped well, but table helpers are more flexible and
  support more column types.

- Add "days counting" and "scheduling mode" columns to table helpers.

  "days counting" to set `ignore_non_working_days` attribute.
    - "all days" value maps to `ignore_non_working_days: true`.
    - "working days" value maps to `ignore_non_working_days: false`.
  "scheduling mode" to set `schedule_manually` attribute.
    - "manual" value maps to `schedule_manually: true`.
    - "automatic" value maps to `schedule_manually: false`.
2025-02-25 09:12:22 +01:00
Christophe Bliard bac76b9f6a Define a 'scheduling mode' column in table_helpers
More expressive code.
2025-02-25 09:12:19 +01:00
Christophe Bliard 2219c89cc4 Add schedule and properties column types to table_helpers
They are taken from the schedule_helpers. It will help writing tests
with many work packages needing both the schedule, some properties
(follows relationships) and some other attributes like automatic/manual
scheduling mode.
2024-11-21 16:08:19 +01:00
Christophe Bliard 86a4b9818e Split TableHelpers::Column into multiple files
Introduce a ColumnType class to better separate responsibilities.

It prepares the merge with schedule helpers.
2024-11-21 16:08:18 +01:00
Oliver Günther 9586b06db3 Merge pull request #16331 from opf/chore/verify_partial_doubles
Set verify_partial_doubles=true
2024-08-06 10:54:18 +02:00
Oliver Günther 74fa859e5f Pass correct nil 2024-08-05 19:31:30 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Klaus Zanders 7c5d5e88c4 Add project query stuff to permission mocker 2024-06-17 09:31:51 +02:00
Christophe Bliard 5e4766f072 Merge branch 'dev' into feature/49409-status-exclude-from-totals 2024-06-03 17:56:41 +02:00
Klaus Zanders 77f13d4964 Globally include time helpers 2024-05-28 10:24:06 +02:00
Christophe Bliard d728ea37db Raise an error if there are more cells than headers in a row
It's to prevent silly mistakes when writing and copy-pasting tables in
specs.
2024-05-23 10:51:08 +02:00
Christophe Bliard 4e05da24c1 Table helper can have first line being a comment 2024-05-14 15:31:12 +02:00
Christophe Bliard a89cfa4321 Make match_table work regardless of the order of the work packages 2024-05-02 17:44:41 +02:00
Christophe Bliard 010f264f1c Merge branch 'dev' into feature/40749-consistent-calculation-of-percent-complete 2024-04-10 10:25:35 +02:00
Oliver Günther 027cc22b8b Merge pull request #15198 from opf/remove-old-allowed-methods
Remove old `allowed_to?` methods
2024-04-10 09:24:43 +02:00
ulferts 82ee799f83 Merge remote-tracking branch 'origin/dev' into feature/40749-consistent-calculation-of-percent-complete 2024-04-09 17:49:51 +02:00
Klaus Zanders 8346cdb0c3 Remove legacy interface from MockedPermissionHelper 2024-04-09 14:28:34 +02:00
Oliver Günther e3e8d78972 Rename delay to lag
https://community.openproject.org/work_packages/44054
2024-04-08 19:31:38 +02:00
Christophe Bliard 3e6071b425 Fix table helpers: do not ignore header if first row value is empty
When using `match_table` helper, some column were missing on the output.
It's because the headers where read from the first row, and the ones
without any value were stripped out. As this information is used to know
how to pull column data from work packages, the data was missing.
2024-04-08 16:34:04 +02:00
Christophe Bliard a0cfa092a7 Add status column to table helpers
Works by adding the name of the status in the table.

Raises an error if the status name does not exist
2024-04-05 11:24:05 +02:00
ulferts 3b2121f733 Revert "Merge remote-tracking branch 'origin/release/13.4' into dev"
This reverts commit 40b2bbeb09, reversing
changes made to b4c6cb17cc.
2024-03-21 11:31:17 +01:00
Ivan Kuchin 7787e457a3 Revert "Merge branch 'dev' into release/13.4"
This reverts commit a901541269, reversing
changes made to e573ca00b7.
2024-03-20 20:19:08 +01:00
Ivan Kuchin 9e4934cd0a change quotes using rubocop --only Style/StringLiterals,Style/QuotedSymbols -a 2024-03-20 18:05:22 +01:00
Christophe Bliard d044c908e0 Introduce let_work_packages helpers
It allows to declare work packages and their properties from a visual
table. It is especially useful to visualize hierarchies and data as if
it were presented in the work package table page in OpenProject app.
2024-01-09 17:47:20 +01:00
Christophe Bliard c795874f7f Update copyright year for 2024
command used: `rg -l 'Copyright \(C\) 2012-202\d the OpenProject' | xargs -n 100 sed -i -r 's/Copyright \(C\) 2012-202. the OpenProject/Copyright (C) 2012-2024 the OpenProject/'`
2024-01-02 16:23:54 +01:00
Klaus Zanders bd660582c8 Add an error when trying to mock on nil 2023-10-18 14:27:35 +02:00
Klaus Zanders 0c2011216f Rename methods for mocking to allow_xxx schema
Co-authored-by: Christophe Bliard <c.bliard@openproject.com>
2023-10-16 08:41:06 +02:00
Klaus Zanders 706bd8dfbb Remove bang 2023-10-09 10:49:02 +02:00
Klaus Zanders 532f11addd Raise an error when not providing a block for mocking 2023-10-09 10:48:14 +02:00
Klaus Zanders 59e6dfff40 Review feedback: all_permissions_allowed -> allow_everything 2023-10-09 10:44:45 +02:00
Klaus Zanders f4043e5fa3 Add some more test cases 2023-10-09 10:44:43 +02:00
Klaus Zanders cb759bd810 Add a new service to mock permission checks for stubbed users 2023-10-09 10:44:41 +02:00
Christophe Bliard 4c2a9d0aa8 Enable RSpec zero monkey patching mode
The plan for RSpec 4.0 is to disable monkey patching.

See https://github.com/rspec/rspec-core/blob/main/features/configuration/zero_monkey_patching_mode.feature for details.
2023-05-31 19:22:29 +02:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Christophe Bliard beb08d0fc0 Can reduce dates to work packages dates with Chart#compact_dates 2022-09-27 17:03:15 +02:00
Christophe Bliard cd2254e1ec Fix broken test
Make expect_schedule helper smarter by deriving the ignore_non_working_days information from the actual chart if not yet defined. This gives more accurate diffable information.
2022-09-27 16:52:30 +02:00