Skip to content

Commit

Permalink
new spec to test strong params
Browse files Browse the repository at this point in the history
  • Loading branch information
npauzenga committed Jan 12, 2016
1 parent a91641c commit ed70c78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/password_resets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def create
end

def update
update = UpdatePasswordOrganizer.call(password: params[:user][:password],
update = UpdatePasswordOrganizer.call(password: user_params[:password],
token: params[:id])
if update.success?
render json: update.message, status: :ok
Expand Down
9 changes: 9 additions & 0 deletions spec/controllers/password_resets_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@
end
end

context "when no user param is given" do
let(:paramz) { { id: "token123" } }

it "throws an error" do
expect { patch :update, paramz }.
to raise_error ActionController::ParameterMissing
end
end

context "when unsuccessful" do
let(:context) { double(:context, success?: false) }

Expand Down

0 comments on commit ed70c78

Please sign in to comment.