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.06.00 spec/multi_solr/utils_spec.rb
multi-solr-01.05.00 spec/multi_solr/utils_spec.rb
multi-solr-01.04.00 spec/multi_solr/utils_spec.rb
multi-solr-01.03.00 spec/multi_solr/utils_spec.rb