Skip to content

Commit

Permalink
Changes update_attributes to update
Browse files Browse the repository at this point in the history
  • Loading branch information
PSzyszkaSpark committed Sep 30, 2019
1 parent 8711419 commit 6a4c9b3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def registration
end

def update_registration
if order_params[:email] =~ Devise.email_regexp && current_order.update_attribute(:email, order_params[:email])
if order_params[:email] =~ Devise.email_regexp && current_order.update(email: order_params[:email])
redirect_to spree.checkout_state_path(:address)
else
flash[:error] = t(:email_is_invalid, scope: [:errors, :messages])
Expand Down
2 changes: 1 addition & 1 deletion lib/controllers/frontend/spree/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def create
end

def update
if @user.update_attributes(user_params)
if @user.update(user_params)
if params[:user][:password].present?
# this logic needed b/c devise wants to log us out after password changes
Spree::User.reset_password_by_token(params[:user])
Expand Down
6 changes: 3 additions & 3 deletions spec/controllers/spree/checkout_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

it 'does not check registration' do
controller.stub :check_authorization
order.stub update_attributes: true
order.stub update: true
controller.should_not_receive :check_registration
spree_put :update_registration, { order: {} }
end
Expand All @@ -142,7 +142,7 @@
end

it 'redirects to the checkout_path after saving' do
allow(order).to receive(:update_attributes) { true }
allow(order).to receive(:update) { true }
allow(controller).to receive(:check_authorization)
spree_put :update_registration, { order: { email: 'jobs@spreecommerce.com' } }
expect(response).to redirect_to spree.checkout_state_path(:address)
Expand All @@ -154,7 +154,7 @@
else
request.cookie_jar.signed[:guest_token] = token
end
allow(order).to receive(:update_attributes) { true }
allow(order).to receive(:update) { true }
expect(controller).to receive(:authorize!).with(:edit, order, token)
spree_put :update_registration, { order: { email: 'jobs@spreecommerce.com' } }
end
Expand Down

0 comments on commit 6a4c9b3

Please sign in to comment.