-
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
Carets - Guillermina #23
base: master
Are you sure you want to change the base?
Conversation
Media RankerWhat We're Looking For
|
output.must_be_instance_of Hash | ||
end | ||
|
||
it "should return values that are arrays" 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.
I would also test that they are in the proper order...
validates :title, presence: true | ||
validates :title, uniqueness: true | ||
|
||
def self.all_works_by_title |
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.
Shouldn't this be by the # of votes?
let(:work) { Work.new } | ||
let(:vote_1) { votes(:vote_1)} | ||
|
||
it "must have a valid work and user to be 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.
I would also add a test to verify that two votes can't have the same work_id and user_id.
So a user can't vote for the same work twice.
describe MainPageController do | ||
it "should get index" do | ||
get main_page_index_url | ||
value(response).must_be :success? |
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 could instead do:
must_respond_with :success
post login_path, params: {username: "alyssa"} | ||
}.must_change 'User.count', 1 | ||
must_respond_with :redirect | ||
must_redirect_to root_path |
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 test:
id = find_by(username: 'alyssa').id
id.must_equal session[:user_id]
proc { | ||
post login_path, params: {username: nil} | ||
}.must_change 'User.count', 0 | ||
flash[:error].must_equal "User not logged in successfully" |
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.
Please use status codes.
|
||
describe SessionsController do | ||
|
||
it "going to the login_form page is successful" 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.
Fix AUTOINDENT!
}.must_change 'Vote.count', 0 | ||
must_respond_with :redirect | ||
must_redirect_to work_path(works(:anti).id) | ||
flash[:error].must_equal "You've already upvoted this!" |
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 have a test voting for a work that doesn't exist, or voting if not logged in.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
session
andflash
? What is the difference between them?