Pipes - Sarah Read-Brown - MediaRanker#43
Open
SRBusiness wants to merge 67 commits intoAda-C8:masterfrom
Open
Conversation
…s, basic css class for good bad
…hod to take arguments
…st enter a username to submit
…t an id but a whole user
…dition to completing tests
…nough but not excellent
Media RankerWhat We're Looking For
|
| <section class="top-ten columns large-4 small-12"> | ||
| <h3>Top <%= model.first.category.capitalize%>s</h3> | ||
| <ul> | ||
| <% model.each do |work| %> |
|
|
||
| it "returns works in order votes in descending order" do | ||
| sorted_albums.first.votes.count.must_be :>, sorted_albums.second.votes.count | ||
| sorted_albums.second.votes.count.must_be :>, sorted_albums.last.votes.count |
There was a problem hiding this comment.
You might want to use :>= here instead of :>. That way if two works have the same number of votes the test will still pass.
| describe "top_ten_works" do | ||
| it "it will return up to ten works" do | ||
| Work.top_ten_works("album").length.must_be :<=, 10 | ||
| end |
There was a problem hiding this comment.
I feel like there are more interesting edge cases here:
- What if there are no works?
- What if there are less than 10 works?
- What if there are more than 10 works?
| Work.sorted_works("albums").must_equal [] | ||
| Work.sorted_works([1,2]).must_equal [] | ||
| Work.sorted_works(2.3).must_equal [] | ||
| end |
There was a problem hiding this comment.
I would also be interested to know whether this method works if there are no works.
| end | ||
|
|
||
| describe "destroy" do | ||
| it "returns success, and destroys the work, if the work ID is valid " do |
There was a problem hiding this comment.
What if you attempt to destroy a work for which there are votes? Can you do it? What happens to the votes? This is exactly the sort of question that the end-to-end approach of a controller test is best for.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? What is the difference between them?