-
Notifications
You must be signed in to change notification settings - Fork 48
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
Media Ranker - Danielle #32
base: master
Are you sure you want to change the base?
Conversation
…rors will appear on webpage
…d across all the way
… for select, and the second for html options. So all you need is to give default empty options as first param after list of items and then add your class to html_options. This fixed the category drop down to be the entire width of the container
…rails destroy controller
Media RankerWhat We're Looking For
|
Rails.application.routes.draw do | ||
root 'works#main' | ||
resources :works | ||
post 'works/:id/upvote', to: 'works#upvote', as: 'upvote' |
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.
The indentation doesn't actually mean anything here as it's not technically nested inside.
resources :works | ||
post 'works/:id/upvote', to: 'works#upvote', as: 'upvote' | ||
|
||
resources :users |
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.
Do you need all the CRUD route for users? What about :edit
and :update
?
vote = work.votes | ||
|
||
# Assert | ||
expect(vote).must_be_instance_of Vote |
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.
because vote
here is actually a collection of votes, this test failed. If you wanted to test the type you could loop through the collection and check that each instance is a Vote
.
Also since a Work
has many votes, it doesn't have a foreign key in it.
Instead expect(vote.work_id).must_equal work.id
end | ||
|
||
describe 'Media Page - Methods' do | ||
it 'return top 10 of a given category' 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.
You're not throughly testing all the methods here. Just top_movies
for 10 items and more than 10 and top_books
for less than 10. You don't test each.
end | ||
end | ||
|
||
describe "Validations" 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.
No user validations?
What about tests for date_joined
class User < ApplicationRecord | ||
has_many :votes | ||
has_many :works, through: :votes | ||
|
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.
No validations? What about username?
def update | ||
if @work && @work.update(work_params) | ||
redirect_to work_path(@work.id) | ||
elsif @book |
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.
No flash.now
notices?
</tr> | ||
</thead> | ||
<tbody> | ||
<% @works.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.
Notice that you do a very similar table here a lot. You could DRY this out with a partial.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
session
andflash
? What is the difference between them?