Sha256: 00901d19ca1c61f23b139214f9be2e4ee2330acd2a718b170e900ea8c553ee40

Contents?: true

Size: 1.06 KB

Versions: 21

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require 'multi_solr/utils'

describe MultiSolr::SolrFilterBoolean do

  subject{ MultiSolr::SolrFilterBoolean.new('test') }

  context 'render_value' do
    it "should return 'yes' if value is 1 or true" do
      subject.render_value(1).should == 'yes'
      subject.render_value('1').should == 'yes'
      subject.render_value(true).should == 'yes'
      subject.render_value('1').should == 'yes'
    end

    it "should return 'no' if value is 0 or false or nil or blank" do
      subject.render_value(0).should == 'no'
      subject.render_value('0').should == 'no'
      subject.render_value(false).should == 'no'
      subject.render_value('false').should == 'no'
      subject.render_value('').should == 'no'
      subject.render_value(nil).should == 'no'
    end

  end

  context 'build_solr_query' do
    it "should return fieldnam:true for true value" do
      subject.build_solr_query('1').should == 'test:true'
    end

    it "should return fieldnam:false for false value" do
      subject.build_solr_query('0').should == 'test:false'
    end
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
multi-solr-01.12.00 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.11.01 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.11.00 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.10.00 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.09.05 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.09.04 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.09.03 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.09.02 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.09.01 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.09.00 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.08.01 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.08.00 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.07.07 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.07.06 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.07.05 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.07.04 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.07.03 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.07.02 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.07.01 spec/multi_solr/solr_filter_boolean_spec.rb
multi-solr-01.07.00 spec/multi_solr/solr_filter_boolean_spec.rb