Sha256: edc97e98222a9a51dd5f583c80ccf3e7340e1d3fdb07b47f961c43a2c2f936e6

Contents?: true

Size: 753 Bytes

Versions: 6

Compression:

Stored size: 753 Bytes

Contents

require 'spec_helper'

describe OData4::Properties::DateTime do
  let(:subject) { OData4::Properties::DateTime.new('DateTime', '2000-01-01T16:00:00.000') }
  let(:new_datetime) { DateTime.strptime('2004-05-01T14:32:00.000', '%Y-%m-%dT%H:%M:%S.%L') }

  it { expect(subject.type).to eq('Edm.DateTime') }
  it { expect(subject.value).to eq(DateTime.parse('2000-01-01T16:00:00.000')) }

  it { expect(subject.url_value).to eq("2000-01-01T16:00:00.000")}

  it { expect {subject.value = 'bad'}.to raise_error(ArgumentError) }

  it { expect(lambda {
    subject.value = '2004-05-01T14:32:00.000'
    subject.value
  }.call).to eq(new_datetime) }

  it { expect(lambda {
    subject.value = new_datetime
    subject.value
  }.call).to eq(new_datetime) }
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
odata4-0.9.1 spec/odata4/properties/date_time_spec.rb
odata4-0.9.0 spec/odata4/properties/date_time_spec.rb
odata4-0.8.2 spec/odata4/properties/date_time_spec.rb
odata4-0.8.1 spec/odata4/properties/date_time_spec.rb
odata4-0.8.0 spec/odata4/properties/date_time_spec.rb
odata4-0.7.0 spec/odata4/properties/date_time_spec.rb