-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add users_controller#edit #9
Conversation
def update | ||
@user_name = @user.name | ||
|
||
@user.email = user_params[:email] |
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 don't you use @user.update(user_params)
?
end | ||
|
||
def update | ||
@user_name = @user.name |
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 as confusing ivar. I prefer to use @user.user_name_was
- @title = "#{@user.user_name_was} « Users"
|
||
it 'edits the name/email' do | ||
expect(assigns(:user).reload.name).to eq(name) | ||
expect(assigns(:user).reload.email).to eq(email) |
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 don't have to reload
twice
let(:provider) { Kuroko2::User::GOOGLE_OAUTH2_PROVIDER } | ||
|
||
it 'returns bad request' do | ||
expect(response).to be_bad_request |
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.
[IMO] I prefer to use to have_http_status(:bad_request)
because it provides more readable failure message
div class="form-group #{@user.errors.has_key?(:name) ? 'has-error' : ''}" | ||
= form.label :name | ||
= form.text_field :name, class: 'form-control', placeholder: 'Group Name' | ||
div class="form-group #{@user.errors.has_key?(:email) ? 'has-error' : ''}" |
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.
don't you show validation error messages?
LGTM |
@cookpad/dev-infra