Skip to content

Commit d1eb35a

Browse files
committed
Ensure end to end test makes ajax request
Adapt test case for namespaced module to actually fetch the options to ensure that the constructed route actually works.
1 parent fac26c8 commit d1eb35a

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

spec/features/end_to_end_spec.rb

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,32 +72,24 @@
7272
end
7373

7474
ActiveAdmin.register Internal::TagName, as: 'Tag Name' do
75-
filter :color, as: :searchable_select, ajax: { resource: 'RGB::Color' }
75+
filter :color, as: :searchable_select, ajax: { resource: RGB::Color }
7676
end
7777

78-
ActiveAdmin::SearchableSelect.inline_ajax_options = true
7978
ActiveAdmin.setup {}
8079
end
8180
end
8281

8382
describe 'index page with searchable select filter' do
84-
let!(:orange) { RGB::Color.create(code: '#eac112', description: 'Orange') }
85-
let(:filters_options) { %w(Any #19bf25 #eac112) }
86-
87-
let!(:other_records) do
83+
it 'loads filter input options' do
84+
RGB::Color.create(code: '#eac112', description: 'Orange')
8885
RGB::Color.create(code: '#19bf25', description: 'Green')
89-
Internal::TagName.create(name: 'Important Guest', color: orange)
90-
end
9186

92-
before { visit '/admin/tag_names' }
87+
visit '/admin/tag_names'
9388

94-
it 'should have all created colors in filter' do
95-
expect(page).to have_select :Color, options: filters_options
96-
end
89+
expand_select_box
90+
wait_for_ajax
9791

98-
it 'should have selected option' do
99-
select orange.code, from: :Color
100-
expect(page).to have_select :Color, selected: orange.code
92+
expect(select_box_items).to eq(%w(#eac112 #19bf25))
10193
end
10294
end
10395
end

0 commit comments

Comments
 (0)