-
Notifications
You must be signed in to change notification settings - Fork 43
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
Pipes - Sarah Read-Brown - MediaRanker #43
base: master
Are you sure you want to change the base?
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| %> |
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.
Good use of a view partial here
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
session
andflash
? What is the difference between them?