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

Timestamp: make sure an `ArgumentError` is raised when `Timestamp.parse("Pfoo")`

Sebastian Fiedlschuster0ef6fbb11374
diff --git a/spec/models/timestamp_spec.rb b/spec/models/timestamp_spec.rb
index b2ed5870899..2a2fd056f05 100644
--- a/spec/models/timestamp_spec.rb
+++ b/spec/models/timestamp_spec.rb
@@ -116,6 +116,15 @@ describe Timestamp do
it "raises an error" do
expect { subject }.to raise_error ArgumentError
end
+
+ describe "when providing something invalid starting with P (for duration)" do
+ subject { described_class.parse("Pfoo") }
+
+ it "raises an error" do
+ expect { subject }.to raise_error ArgumentError
+ expect { subject }.to raise_error ActiveSupport::Duration::ISO8601Parser::ParsingError
+ end
+ end
end
end