diff --git a/app/models/item.rb b/app/models/item.rb index 77bcaa73..a57ac3fc 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -775,6 +775,13 @@ def primary_unit self.primary_collection&.primary_unit end + ## + # @return [Boolean] Whether {stage} is set to {Stages#REJECTED}. + # + def rejected? + self.stage == Stages::REJECTED + end + ## # @return [Bitstream] # diff --git a/test/models/item_test.rb b/test/models/item_test.rb index 71054e54..4ce72dbe 100644 --- a/test/models/item_test.rb +++ b/test/models/item_test.rb @@ -1021,6 +1021,17 @@ class ItemTest < ActiveSupport::TestCase count end + # rejected?() + + test "rejected?() returns true when the stage is set to rejected" do + @instance.stage = Item::Stages::REJECTED + assert @instance.rejected? + end + + test "rejected?() returns false when the stage is not set to rejected" do + assert !@instance.rejected? + end + # representative_bitstream() test "representative_bitstream() returns the primary bitstream if one exists" do