Skip to content

Commit

Permalink
Clarify that add_text on Post will work in any state. Fixes #2159.
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Jan 28, 2022
1 parent 9f9641b commit 8514490
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ch17-03-oo-design-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ because we haven’t implemented the `blog` crate yet.
<span class="caption">Listing 17-11: Code that demonstrates the desired
behavior we want our `blog` crate to have</span>

We want to allow the user to create a new draft blog post with `Post::new`.
Then we want to allow text to be added to the blog post while it’s in the draft
state. If we try to get the post’s content immediately, before approval,
nothing should happen because the post is still a draft. We’ve added
`assert_eq!` in the code for demonstration purposes. An excellent unit test for
this would be to assert that a draft blog post returns an empty string from the
`content` method, but we’re not going to write tests for this example.
We want to allow the user to create a new draft blog post with `Post::new`. We
want to allow text to be added to the blog post. If we try to get the post’s
content immediately, before approval, we shouldn't get any text because the
post is still a draft. We’ve added `assert_eq!` in the code for demonstration
purposes. An excellent unit test for this would be to assert that a draft blog
post returns an empty string from the `content` method, but we’re not going to
write tests for this example.

Next, we want to enable a request for a review of the post, and we want
`content` to return an empty string while waiting for the review. When the post
Expand Down

0 comments on commit 8514490

Please sign in to comment.