Sha256: ff0e5ae15e22fb1453a9db61856658c7002881e136935f7cca87555d71325a60
Contents?: true
Size: 1.8 KB
Versions: 3
Compression:
Stored size: 1.8 KB
Contents
require 'spec_helper' describe Wikidata::Property::Time do let(:joconde) { Wikidata::Item.find_by_title 'Mona Lisa' } let(:range_of_year) { described_class.new( { "id" => "Q12418$8EDF7B01-3F71-4DA7-8B52-8C26242F0293", "mainsnak" => { "snaktype" => "value", "property" => "P571", "datatype" => "time", "datavalue"=> { "value" => { "time" => "+00000001503-01-01T00:00:00Z", "timezone" => 0, "before" => 0, "after" => 3, "precision" => 9, "calendarmodel" => "http://www.wikidata.org/entity/Q1985727" }, "type" => "time" } }, "type" => "statement", "rank" => "normal", "references" => [ { "hash" => "592714cb87c0fc64425e45a185765982f444e5ad", "snaks" => { "P143" => [ { "snaktype" => "value", "property" => "P143", "datatype" => "wikibase-item", "datavalue"=> { "value" => { "entity-type" => "item", "numeric-id" => 465 }, "type" => "wikibase-entityid" } } ] }, "snaks-order" => ["P143"] } ] } ) } it 'should return Time from a a key (date_of_foundation_or_creation here)' do range_of_year.tap do |date| date.should be_kind_of Wikidata::Property::Time date.date.should eq DateTime.new(1503, 1, 1) date.range.min.should eq DateTime.new(1503, 1, 1, 0, 0, 0) date.range.max.should eq DateTime.new(1505, 12, 31, 00, 00, 00) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wikidata-client-0.0.3 | spec/wikidata/property/time_spec.rb |
wikidata-client-0.0.2 | spec/wikidata/property/time_spec.rb |
wikidata-client-0.0.1 | spec/wikidata/property/time_spec.rb |