Skip to content
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

Submitting MediaRanker #31

Open
wants to merge 38 commits into
base: erg/master
Choose a base branch
from
Open

Submitting MediaRanker #31

wants to merge 38 commits into from

Conversation

emgord
Copy link

@emgord emgord commented Dec 4, 2015

Submitting MediaRanker final project. Right now my controller tests are mostly testing that the pages are re-directing to the right place, but I was struggling with coming up with tests to make sure that the desired action of creating/deleting/editing was happening beforehand. I was not sure if this was needed, since this is provided by active record, but wanted to be sure that I was actually doing what was intended.

@ElsaTKO ElsaTKO self-assigned this Dec 9, 2015
def upvote
album = Album.find(params[:id])
album.rank += 1
album.save
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 There's also a cool .increment! method that does the same thing as lines 9-10.

@ElsaTKO
Copy link

ElsaTKO commented Dec 9, 2015

This looks awesome! 😄 It might be worth putting controller finds like album = Album.find(params[:id]) into a before_action so they aren't repeated so many times in the controllers, but everything looks super clean. ❤️ the polymorphic paths and shared examples. CRUD tests are good to make sure model validations and your setup are working as you expect, and they generally just assert the record count or attribute, or change thereof.

Great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants