Sha256: 9c3c70f44dd29d51192250a99e672d1a3bf1a8c93bce058b23a971d824afe376

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe AutocompleteController do
  let!(:tag){ Factory(:tag, :name => 'Music') }
  
  describe 'get #index' do
    before do
      get :index, :model => 'tag', :q => "Mus", :format => 'json'
    end
    
    it { should respond_with(:success) }
    it { should respond_with_content_type(:json) }
  end

  describe 'get #index with autocomplete_query_term_param_names config setting set' do
    before do
      Rails.application.config.activeadmin_associations.autocomplete_query_term_param_names = [:q, :term]
      get :index, :model => 'tag', :q => "Mus", :format => 'json'
    end
    after do
      Rails.application.config.activeadmin_associations.autocomplete_query_term_param_names = nil
    end
    
    it { should respond_with(:success) }
    it { should respond_with_content_type(:json) }
  end
  
  describe 'get #index with no value' do
    before do
      get :index, :model => 'tag', :format => 'json'
    end
    
    it { should respond_with(:success) }
    it { should respond_with_content_type(:json) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeadmin_associations-0.1.3 spec/controllers/autocomplete_controller_spec.rb