From d94ca0174a62e82e31739234bc9a0fa76c9f6ec6 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Thu, 23 Oct 2014 15:47:46 +1100 Subject: [PATCH] Registration process sets sells to 'unspecified' --- app/controllers/api/enterprises_controller.rb | 5 +++++ spec/features/consumer/registration_spec.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/enterprises_controller.rb b/app/controllers/api/enterprises_controller.rb index 76320b0750..b1570fb0d1 100644 --- a/app/controllers/api/enterprises_controller.rb +++ b/app/controllers/api/enterprises_controller.rb @@ -3,6 +3,7 @@ module Api before_filter :override_owner, only: [:create, :update] before_filter :check_type, only: :update + before_filter :override_sells, only: [:create, :update] respond_to :json def managed @@ -59,5 +60,9 @@ module Api def check_type params[:enterprise].delete :type unless current_api_user.admin? end + + def override_sells + params[:enterprise][:sells] = 'unspecified' + end end end diff --git a/spec/features/consumer/registration_spec.rb b/spec/features/consumer/registration_spec.rb index ea09450467..354a5c37eb 100644 --- a/spec/features/consumer/registration_spec.rb +++ b/spec/features/consumer/registration_spec.rb @@ -51,7 +51,7 @@ feature "Registration", js: true do expect(page).to have_content 'Nice one!' e = Enterprise.find_by_name('My Awesome Enterprise') expect(e.address.address1).to eq "123 Abc Street" - expect(e.sells).to eq "none" + expect(e.sells).to eq "unspecified" expect(e.is_primary_producer).to eq true expect(e.contact).to eq "Saskia Munroe"