Sha256: e6bc9c19b9f5f6740978b512e6465be5dcf060d4493838aab230b2e80e90ef22
Contents?: true
Size: 1.01 KB
Versions: 6
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' describe OData4::Properties::DateTimeOffset do let(:subject) { OData4::Properties::DateTimeOffset.new('DateTime', '2000-01-01T16:00:00-09:00') } let(:new_datetime) { DateTime.strptime('2004-05-01T14:32:00+02:00', '%Y-%m-%dT%H:%M:%S%:z') } it { expect(subject.type).to eq('Edm.DateTimeOffset') } it { expect(subject.value).to eq(DateTime.strptime('2000-01-01T16:00:00-09:00', '%Y-%m-%dT%H:%M:%S%:z')) } it { expect(subject.url_value).to eq("2000-01-01T16:00:00-09:00")} it { expect {subject.value = 'bad'}.to raise_error(ArgumentError) } it { expect(lambda { subject.value = new_datetime subject.value }.call).to eq(new_datetime) } it { expect(lambda { subject.value = nil }).not_to raise_error } context 'with allows_nil option set to false' do let(:subject) { OData4::Properties::DateTimeOffset.new('DateTime', '2000-01-01T16:00:00Z-09:00', allows_nil: false) } it { expect(lambda { subject.value = nil }).to raise_error(ArgumentError) } end end
Version data entries
6 entries across 6 versions & 1 rubygems