Sha256: b01cf7f00279d56fdfddc57997019485c27f19de517bc959bc4b039e7be3c5d4

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

module Ransack
  module Nodes
    describe Condition do

      context 'with multiple values and an _any predicate' do
        subject {
          Condition.extract(
            Context.for(Person), 'name_eq_any', Person.first(2).map(&:name)
          )
        }

        specify { expect(subject.values.size).to eq(2) }
      end

      context 'with an invalid predicate' do
        subject {
          Condition.extract(
            Context.for(Person), 'name_invalid', Person.first.name
          )
        }

        context "when ignore_unknown_conditions is false" do
          before do
            Ransack.configure { |c| c.ignore_unknown_conditions = false }
          end

          specify { expect { subject }.to raise_error ArgumentError }
        end

        context "when ignore_unknown_conditions is true" do
          before do
            Ransack.configure { |c| c.ignore_unknown_conditions = true }
          end

          specify { subject.should be_nil }
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ransack-1.6.6/spec/ransack/nodes/condition_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ransack-1.6.6/spec/ransack/nodes/condition_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ransack-1.6.6/spec/ransack/nodes/condition_spec.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/ransack-1.6.2/spec/ransack/nodes/condition_spec.rb
ransack-1.6.6 spec/ransack/nodes/condition_spec.rb
ransack-1.6.5 spec/ransack/nodes/condition_spec.rb
ransack-1.6.4 spec/ransack/nodes/condition_spec.rb
ransack-1.6.3 spec/ransack/nodes/condition_spec.rb
ransack-1.6.2 spec/ransack/nodes/condition_spec.rb
ransack-1.6.1 spec/ransack/nodes/condition_spec.rb
ransack-1.6.0 spec/ransack/nodes/condition_spec.rb