Sha256: 63f5ae7d7389300fa475512608c4a38eb32586ec8950f00025b92e3614376fa6

Contents?: true

Size: 885 Bytes

Versions: 24

Compression:

Stored size: 885 Bytes

Contents

require 'spec_helper'
require 'multi_solr/utils'

describe MultiSolr::Utils do

  context "solr_datetime_to_ruby_time" do
    it "should return nil if becomes a blank value" do
      MultiSolr::Utils.solr_datetime_to_ruby_time('').should be_nil
    end

    it "should return the correct Ruby-Time-Instance" do
      t = MultiSolr::Utils.solr_datetime_to_ruby_time('2012-06-29T10:30:20Z')
      t.should be_a(Time)
      t.should == Time.utc(2012, 06, 29, 10, 30, 20)
    end
  end


  context "ruby_time_to_solr_datetime" do
    it "should return nil if becomes a nil" do
      MultiSolr::Utils.ruby_time_to_solr_datetime(nil).should be_nil
    end

    it "should return the correct Solr-Date-String for Ruby-Time-Instance" do
      sdate = MultiSolr::Utils.ruby_time_to_solr_datetime(Time.utc(2012, 06, 29, 10, 30, 20))
      sdate.should == '2012-06-29T10:30:20Z'
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

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