Sha256: 574a1a42468ee355d21c95618b04e2009e30d9a1eaaf89de1dcc1e57f4166173
Contents?: true
Size: 1.5 KB
Versions: 12
Compression:
Stored size: 1.5 KB
Contents
require 'rails_helper' require 'support/models' require 'support/capybara' require 'support/active_admin_helpers' RSpec.describe 'searchable select', type: :request do it 'fails with helpful error message if ajax resource cannot be auto detected' do expect do ActiveAdminHelpers.setup do ActiveAdmin.register(Post) do filter(:category_id_eq, as: :searchable_select, ajax: true) end end get '/admin/posts' end.to raise_error(/Cannot auto detect resource/) end it 'fails with helpful error message if named option collection does not exist' do expect do ActiveAdminHelpers.setup do ActiveAdmin.register(Category) do searchable_select_options(scope: Category, text_attribute: :name) end ActiveAdmin.register(Post) do filter(:category, as: :searchable_select, ajax: { collection_name: 'custom' }) end end get '/admin/posts' end.to raise_error(/No option collection named 'custom' defined in 'Category' admin./) end it 'fails with helpful error message if ajax resource does not have an admin' do expect do ActiveAdminHelpers.setup do ActiveAdmin.register(Post) do filter(:category, as: :searchable_select, ajax: true) end end get '/admin/posts' end.to raise_error(/No admin found for 'Category'/) end end
Version data entries
12 entries across 12 versions & 1 rubygems