-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature3 #3
base: feature2
Are you sure you want to change the base?
Feature3 #3
Conversation
params | ||
n | ||
c | ||
n |
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.
@Smokashi23 Unnecessary file pushed
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.
updated changes
begin | ||
JWT.decode(token, Rails.application.credentials[:secret_key_base] ) | ||
rescue JWT::DecodeError | ||
nil |
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.
Why using nil here ?
@user = User.find_by!(email: user_params[:email]) | ||
if current_user.nil? | ||
def authorized | ||
if current_user.nil? | ||
render json: { message: 'Please log in' }, status: :unauthorized |
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.
Display message through I18n.t
app/controllers/appts_controller.rb
Outdated
end | ||
|
||
def show | ||
@appt = Appt.find(params[: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.
Error handling is missing
app/controllers/appts_controller.rb
Outdated
end | ||
|
||
def appt_params | ||
params.permit(: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.
Instead of permitting, you can directly access id through query params as well
appt = create(:appt) | ||
put :update, params: { id: appt.id, status: "cancelled" } | ||
appt.reload | ||
expect(appt.status).to eq("cancelled") |
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.
Add more expects to check database changes as well
slot.update(booked: true) | ||
post :booked, params: { id: slot.id } | ||
expect(response).to have_http_status(:unprocessable_entity) | ||
expect(JSON.parse(response.body)["error"]).to eq("This slot is already booked") |
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.
Pleas use I18n to display or check any type of messages
role { create(:role, role_name: 'Doctor') } | ||
end | ||
|
||
trait :patient 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 is trait here used for ?
spec/factories/users.rb
Outdated
end | ||
end | ||
|
||
|
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.
Unnecessary space detected
@@ -0,0 +1,7 @@ | |||
require "test_helper" | |||
|
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 do not push unnecessary files
No description provided.