Skip to content

Commit a682ef9

Browse files
committed
Normalize the Reference status when set.
1 parent 918f473 commit a682ef9

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/cff/reference.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ def format=(fmt)
393393
# Sets the status of this Reference. The status is restricted to a
394394
# [defined set of status types](https://citation-file-format.github.io/1.0.3/specifications/#/status-strings).
395395
def status=(status)
396+
status.downcase!
396397
@fields['status'] = status if REFERENCE_STATUS_TYPES.include?(status)
397398
end
398399

test/cff_reference_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ def test_status_restricted_to_allowed_types
8383
@reference.status = "published"
8484
refute_equal @reference.status, "published"
8585
assert_equal @reference.status, "in-press"
86+
87+
@reference.status = "Pre-Print"
88+
assert_equal @reference.status, "pre-print"
8689
end
8790

8891
def test_languages_methods

0 commit comments

Comments
 (0)