Skip to content

Commit

Permalink
Add rejected?()
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Dolski committed Mar 13, 2024
1 parent 1b9fc0c commit 8c19033
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
#
Expand Down
11 changes: 11 additions & 0 deletions test/models/item_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8c19033

Please sign in to comment.