Skip to content

Commit

Permalink
Showing 2 changed files with 18 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/admin/cdr/cdr_exports.rb
Original file line number Diff line number Diff line change
@@ -282,11 +282,14 @@ def build_new_resource
input_html: {
class: 'chosen-ajax',
data: {
path: '/customers_auths/search_with_return_external_id?q[ordered_by]=name'
path: '/customers_auths/search_with_return_external_id?q[ordered_by]=name&q[external_id_null]=false'
}
},
collection: if params.dig(:q, :customer_auth_external_id_in)
CustomersAuth.where(external_id: params.dig(:q, :customer_auth_external_id_in)).order(:name).pluck(:name, :external_id)
collection: if ff.object.customer_auth_external_id_in.present?
CustomersAuth
.where(external_id: ff.object.customer_auth_external_id_in)
.order(:name)
.map { |r| [r.display_name, r.external_id] }
else
CustomersAuth.none
end
12 changes: 12 additions & 0 deletions spec/features/cdr/cdr_exports/new_cdr_export_spec.rb
Original file line number Diff line number Diff line change
@@ -281,6 +281,18 @@
end
end

context 'when "Customer Auth external ID IN" filter is selected and then form submitted' do
let!(:customer_auth) { create(:customers_auth, external_id: 1235, external_type: 'term') }
let(:fill_form!) { fill_in_chosen 'Customer auth external id in', with: customer_auth.display_name, multiple: true, ajax: true }

it 'should render form with previously selected Customer Auth' do
subject

expect(page).to have_semantic_errors count: 2
expect(page).to have_field_chosen 'Customer auth external id in', with: customer_auth.display_name
end
end

context 'without fields' do
let(:fill_form!) do
fill_in 'Time start gteq', with: '2018-01-01'

0 comments on commit 1029843

Please sign in to comment.