accept 'ready' as alias for 'queued' state
Expand phase: parse 'ready' as State::Queued so both names work on
input. Output and DB storage still use 'queued'. This allows
migrating data before renaming the variant.
diff --git a/src/models.rs b/src/models.rs
index 9702c9c..3a73072 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -42,7 +42,7 @@ impl std::str::FromStr for State {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"icebox" => Ok(State::Icebox),
- "queued" => Ok(State::Queued),
+ "queued" | "ready" => Ok(State::Queued),
"in_progress" => Ok(State::InProgress),
"done" => Ok(State::Done),
_ => Err(InvalidStateError(s.to_string())),
@@ -134,6 +134,12 @@ mod tests {
}
}
+ #[test]
+ fn ready_parses_as_queued() {
+ let parsed: State = "ready".parse().unwrap();
+ assert_eq!(parsed, State::Queued);
+ }
+
#[test]
fn state_parse_invalid_returns_error() {
let err = "bogus".parse::<State>().unwrap_err();