Correct a bug where we get all params in the nonprofit

This commit is contained in:
Eric Schultz 2018-08-16 14:33:36 -05:00
parent 5026af021d
commit 82dbe471bd
2 changed files with 4 additions and 3 deletions

View file

@ -54,11 +54,12 @@ class Houdini::V1::Nonprofit < Houdini::V1::BaseAPI
end
post do
declared_params = declared(params)
np = nil
u = nil
Qx.transaction do
begin
np = Nonprofit.new(OnboardAccounts.set_nonprofit_defaults(params[:nonprofit]))
np = Nonprofit.new(OnboardAccounts.set_nonprofit_defaults(declared_params[:nonprofit]))
begin
np.save!
@ -80,7 +81,7 @@ class Houdini::V1::Nonprofit < Houdini::V1::BaseAPI
end
end
u = User.new(params[:user])
u = User.new(declared_params[:user])
u.save!
role = u.roles.build(host: np, name: 'nonprofit_admin')

View file

@ -130,7 +130,7 @@ describe Houdini::V1::Nonprofit, :type => :controller do
it "succeeds" do
force_create(:nonprofit, slug: "n", state_code_slug: "wi", city_slug: "appleton")
input = {
nonprofit: {name: "n", state_code: "WI", city: "appleton", zip_code: 54915, url: 'www.cs.c'},
nonprofit: {name: "n", state_code: "WI", city: "appleton", zip_code: 54915, url: 'www.cs.c', website: 'www.cs.c'},
user: {name: "Name", email: "em@em.com", password: "12345678", password_confirmation: "12345678"}
}