Skip to content

Commit

Permalink
clean up per rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
npauzenga committed Dec 25, 2015
1 parent 63fe7fd commit bb204c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/password_resets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def create

def update
update = UpdatePasswordOrganizer.call(password: params[:user][:password],
token: params[:id])
token: params[:id])
if update.success?
render json: update.message, status: :ok
else
Expand Down
13 changes: 8 additions & 5 deletions spec/controllers/password_resets_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,24 @@
end

describe "PATCH #udpate" do
let(:user) { create(:confirmed_user) }
let(:params) do
{
id: "token123",
user: { password: user.password }
id: "token123",
user: { password: user.password }
}
end

let(:arguments) { { password: params[:user][:password], token: params[:id] } }
let(:arguments) do
{ password: params[:user][:password],
token: params[:id] }
end

let(:context) { double(:context, success?: true) }
let(:user) { create(:confirmed_user) }

before(:example) do
allow(UpdatePasswordOrganizer).to receive(:call).with(arguments).
and_return(context)

allow(context).to receive(:message).and_return(["password updated"])
allow(context).to receive(:errors).and_return(["update failed"])
end
Expand Down

0 comments on commit bb204c4

Please sign in to comment.