Open
Conversation
Media RankerWhat We're Looking For
|
CheezItMan
reviewed
May 7, 2019
| fixtures :all | ||
| # Add more helper methods to be used by all tests here... | ||
|
|
||
| # def perform_login(user = nil) |
| describe User do | ||
| let(:user) { User.new } | ||
|
|
||
| it "must be valid" do |
| describe Vote do | ||
| let(:vote) { Vote.new } | ||
|
|
||
| it "must be valid" do |
There was a problem hiding this comment.
No other tests for vote? What about a validation to ensure that the combination work_id and user_id is unique.
| end | ||
| end | ||
|
|
||
| describe "validations" do |
| end | ||
|
|
||
| describe "topten" do | ||
| it "will return top votes" do |
| redirect_to root_path | ||
| end | ||
|
|
||
| def upvote |
There was a problem hiding this comment.
This method is rather long, and nonfunctional on the site, but I suggest adding a method to the Usermodel for upvoting. That can help you reduce the size of your controller method here.
| @work = Work.find_by(id: params[:id]) | ||
|
|
||
| if !@work | ||
| head :not_found |
There was a problem hiding this comment.
I suggest redirecting instead of head at this point.
|
|
||
| has_many :votes | ||
| has_many :users, through: :votes | ||
|
|
There was a problem hiding this comment.
I suggest a spotlight method as well.
| Rails.application.routes.draw do | ||
| # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html | ||
| root to: "homepage#index" | ||
| resources :works, :users |
There was a problem hiding this comment.
Do you have all the restful routes as a user?
|
|
||
| <%= f.submit action_name, class:"work-form-btn"%> | ||
|
|
||
| <% end%> No newline at end of file |
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?