-
Notifications
You must be signed in to change notification settings - Fork 15
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
Thrillow #22
base: master
Are you sure you want to change the base?
Thrillow #22
Conversation
…atus or the update method
…em to be having some seed issues
…ers that were just guests in user seeds. Added test for index on user controller. Still troubleshooting error on dashboard test
…t_products instead, created test for dashboard authorization. Two tests have errors, may be due to Github being down.
bEtsyWhat We're Looking For
Only the person who submitted the PR will get an email about this feedback. Please let the rest of your team know about it. |
get "users/:user_id/products", to: "users#products", as: "merchant_products" | ||
get "orders/:order_id/confirmation", to: "orders#confirmation", as: "confirmation" | ||
|
||
resources :users, only: [ :new, :create, :index] |
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 use the /users/new
route? What about `post '/users`` route to create users? I thought they happened through the sessions controller?
@@ -0,0 +1,46 @@ | |||
class SessionsController < ApplicationController | |||
# TODO How do we handle a merchant shopping/closing browser |
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.
Looks like you never resolved what to do about the cart of a user in this circumstance.
# Make fake session | ||
# Tell OmniAuth to use this user's info when it sees | ||
# an auth callback from github | ||
OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new(mock_auth_hash(@user)) |
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 strongly suggest you create a method in your test_helper.rb
file to log a user in, and then call that method in your tests when you want to log in the user. I would not do this piece over and over again.
|
||
end | ||
|
||
it "does not allow guests to access the new category page" 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 also suggest grouping your tests by the type of user. 1 set for authenticated users, and one for guests, and maybe one for controller methods for which it doesn't matter.
Mixing and matching like this can get confusing and it's easier to miss one.
id = categories(:category1).id | ||
|
||
|
||
get category_path(id) |
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.
Just a note, you can make the category route use the category name instead of the Id, especially if the category name is unique. That can make the URL more readable to the user.
|
||
describe "actions that require User Authentication" do | ||
|
||
before 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.
👍
end | ||
end | ||
|
||
describe "actions that require User Authentication" 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 also need to test these actions with guest users to verify redirection and the flash warning message.
must_redirect_to root_path | ||
end | ||
|
||
it "should get dashboard if you are a logged in merchant/it's your dashboard" 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 about if you're logged in and it's not your dashboard?
end | ||
end | ||
|
||
describe "create" 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.
Can you do this? Shouldn't this be done with the SessionsController
?
|
||
|
||
describe "update" do | ||
it "will create a new order with the passed params if the order isn't @current_order and change order status from pending to paid" 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.
This test seems to imply anyone can update an order...
I would think you would need to perform some actions to create an order (and have a session field set to record that this is that user's order, and then try to update it.
What you have in this test implies that anyone can send a patch request to update an order by it's id.
If so, I would love to go to your store with postman and place an expensive order!
bEtsy
Congratulations! You're submitting your assignment! These comprehension questions should be answered by all members of your team, not by a single teammate.
Comprehension Questions