Isogram Exercise improvements: change method name/add failure messages#664
Conversation
| # skip | ||
| string = "" | ||
| assert Isogram.is_isogram?(string) | ||
| assert Isogram.isogram?(string), "Expected 'true', '' is an isogram" |
There was a problem hiding this comment.
I am not sure if true/false should be quoted. I have a slight preference for not quoting it.
@kotp?
There was a problem hiding this comment.
We don't want people to think they have to return a string.
There was a problem hiding this comment.
No definitely, I get what you're saying! I guess I was just going off the triangle exercise test case more or less. If we decide to change it on here I can also go back and change it here later https://github.com/exercism/xruby/blob/master/exercises/triangle/triangle_test.rb. 😄
|
Looks good 👍 |
| end | ||
|
|
||
| def type | ||
| "#{expected ? 'is' : 'is not'} an isogram" |
There was a problem hiding this comment.
I like how you've left the 'is' in both cases. 👍
There was a problem hiding this comment.
def failure_message
%Q("Expected '#{expected}', '#{input}' #{reason}")
end
def reason
"#{is_or_not} an isogram"
end
def is_or_not
expected ? 'is' : 'is not'
endSince we aren't really getting a type, the method name is not quite right.
EDIT: I left input as it is, but perhaps that is result instead. input always seems too generic, and often is not expressing what it is well enough.
There was a problem hiding this comment.
I like reason but think the input is part of the reason.
%Q("Expected '#{expected}', #{reason}")
There was a problem hiding this comment.
For me it is a little bit easier to read it as Q("Expected '#{expected}', #{reason}") rather than %Q("Expected '#{expected}', '#{input}' #{reason}") if say I was just skimming through it.
There was a problem hiding this comment.
Comment on @kotp's edit: input is the input - the string that is provided as input to the method under test.
There was a problem hiding this comment.
Nothing we should do regarding 'input' for sure. I was just re-reading the code as you were writing the response.
| end | ||
|
|
||
| def type | ||
| "#{expected ? 'is' : 'is not'} an isogram" |
There was a problem hiding this comment.
def failure_message
%Q("Expected '#{expected}', '#{input}' #{reason}")
end
def reason
"#{is_or_not} an isogram"
end
def is_or_not
expected ? 'is' : 'is not'
endSince we aren't really getting a type, the method name is not quite right.
EDIT: I left input as it is, but perhaps that is result instead. input always seems too generic, and often is not expressing what it is well enough.
| # skip | ||
| string = "" | ||
| assert Isogram.is_isogram?(string) | ||
| assert Isogram.isogram?(string), "Expected 'true', '' is an isogram" |
| def test_bookkeeping | ||
| skip | ||
| assert_equal 3, BookKeeping::VERSION | ||
| assert_equal 4, BookKeeping::VERSION |
There was a problem hiding this comment.
If messages are the only thing being changed, and not the tests themselves, then VERSION should not change.
There was a problem hiding this comment.
Ah yes, removed the query part that is common in languages where the question mark cannot be used. So it is a good version bump.
|
Wow thank you for all the feedback @kotp ! When I was making the method name I was actually wondering what to call it, so I'm happy for your insight. |
|
Submitted another commit and integrated your great feedback. |
|
Thanks @deohtee, I will look at this when I get a chance. |
|
Thanks @deohtee ❤️ |
|
Why didn't Travis run on these changes? |
|
It looks like a missed hook communication. |
|
Travis CI had some issues between May 31 and June 2 it looks like this PR came in during that window and the PR was never picked up by Travis. |
Why?
What?
is_isogram?toisogram?3to version #4How Has This Been Tested?
testing the generated test.
Screenshots (if appropriate):
Types of changes
Picked breaking change too because the method name changed so if you went back and ran the
version 3 solutions against this version they would fail.
References and Closures
references #475
Checklist: