Sha256: 0b9bd374959225ebfcd575c4a324af45ffe7ab57e6abd0e73e168dff585d7a13

Contents?: true

Size: 964 Bytes

Versions: 7

Compression:

Stored size: 964 Bytes

Contents

require 'spec_helper'

module Ransack
  describe Configuration do
    it 'yields Ransack on configure' do
      Ransack.configure do |config|
        config.should eq Ransack
      end
    end

    it 'adds predicates' do
      Ransack.configure do |config|
        config.add_predicate :test_predicate
      end

      Ransack.predicates.should have_key 'test_predicate'
      Ransack.predicates.should have_key 'test_predicate_any'
      Ransack.predicates.should have_key 'test_predicate_all'
    end

    it 'avoids creating compound predicates if :compounds => false' do
      Ransack.configure do |config|
        config.add_predicate :test_predicate_without_compound, :compounds => false
      end

      Ransack.predicates.should have_key 'test_predicate_without_compound'
      Ransack.predicates.should_not have_key 'test_predicate_without_compound_any'
      Ransack.predicates.should_not have_key 'test_predicate_without_compound_all'
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
ransack_ffcrm-0.6.0 spec/ransack/configuration_spec.rb
ransack-0.6.0 spec/ransack/configuration_spec.rb
ransack-0.5.8 spec/ransack/configuration_spec.rb
ransack-0.5.7 spec/ransack/configuration_spec.rb
ransack-0.5.6 spec/ransack/configuration_spec.rb
ransack-0.5.5 spec/ransack/configuration_spec.rb
ransack-0.5.4 spec/ransack/configuration_spec.rb