-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flaky Spec Try 2: Article Decorator properly handles Names #6048
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a suggestion for consideration around style, but LGTM 💯
@@ -57,7 +57,12 @@ def create_article(*args) | |||
it "creates proper description when it is not present and body is not present and long, and tags are present" do | |||
body_markdown = "---\ntitle: Title\npublished: false\ndescription:\ntags: heytag\n---\n\n" | |||
created_article = create_article(body_markdown: body_markdown) | |||
expect(created_article.description_and_tags).to eq("A post by #{created_article.user.name.delete('.')}. Tagged with heytag.") | |||
parsed_post_by_string = if created_article.user.name.end_with?(".") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably a nitpick/style preference so I'm approving this and leaving this as a suggestion.
What about:
parsed_post_by_string = "A post by #{created_article.user.name}"
parsed_post_by_string += "." unless created_article.user.name.end_with?(".")
So it kind of reads like, "append a period unless it already ends with a period". Only because I had to look twice. At first, I thought the conditions were the same by accident and then I noticed the period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that actually matches really nicely with the way it is written in the decorator +1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Also agree with @atsmith813's suggestion b/c I did a double take too, but overall am pretty indifferent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯 I appreciate the update and consideration!
What type of PR is this? (check all applicable)
Description
In a previous PR(#6029) I attempted to fix this flaky spec by removing any periods that might be in the user name figuring if the name is "Sam Jr." then the final period would be removed and we would be good. HOWEVER that doesnt work for a name "Mr. Sam Jr." bc then all of the periods are removed. This updates the spec to use the same
end_with
logic that the method in the decorator uses so it should be super solid now.Related Tickets & Documents
#4884
Added tests?
Added to documentation?