spec/particle_builder_spec.rb in conglomerate-0.12.1 vs spec/particle_builder_spec.rb in conglomerate-0.13.0
- old
+ new
@@ -14,13 +14,13 @@
datum :id
datum :event_id
datum :roster_id
datum :team_ids
- datum :event_date_time
- datum :event_date
- datum :event_time
+ datum :event_date_time, :type => "datetime"
+ datum :event_date, :type => "date"
+ datum :event_time, :type => "time"
datum :alternately_named_event_time, :value => Proc.new{ item.event_time }
datum :is_available
link :event, :href => Proc.new{ event_url(item.event_id) }
@@ -34,11 +34,11 @@
datum :id
end
template do
datum :repeats, :prompt => "true|false"
- datum :description, :prompt => "awesome"
+ datum :description, :prompt => "awesome", :type => "string"
end
end
end
class ConglomerateExtraTestParticleSerializer
@@ -214,13 +214,13 @@
{"name" => "description", "value" => "Tasty Burgers", "prompt" => "awesome"},
{"name" => "id", "value" => 1},
{"name" => "event_id", "value" => 2},
{"name" => "roster_id", "value" => nil},
{"name" => "team_ids", "value" => [1,2]},
- {"name" => "event_date_time", "value" => "1981-11-28T10:00:00Z"},
- {"name" => "event_date", "value" => "1981-11-28"},
- {"name" => "event_time", "value" => "1981-11-28T10:00:00Z"},
+ {"name" => "event_date_time", "value" => "1981-11-28T10:00:00Z", "type" => "datetime"},
+ {"name" => "event_date", "value" => "1981-11-28", "type" => "date"},
+ {"name" => "event_time", "value" => "1981-11-28T10:00:00Z", "type" => "time"},
{"name" => "alternately_named_event_time", "value" => "1981-11-28T10:00:00Z"},
{"name" => "is_available", "value" => false}
],
"links" => [
{"rel" => "event", "href" => "https://example.com/events/2"},
@@ -253,13 +253,13 @@
{"name" => "description", "value" => "Tasty Burgers", "prompt" => "awesome"},
{"name" => "id", "value" => 1},
{"name" => "event_id", "value" => 2},
{"name" => "roster_id", "value" => nil},
{"name" => "team_ids", "value" => [1,2]},
- {"name" => "event_date_time", "value" => "1981-11-28T10:00:00Z"},
- {"name" => "event_date", "value" => "1981-11-28"},
- {"name" => "event_time", "value" => "1981-11-28T10:00:00Z"},
+ {"name" => "event_date_time", "value" => "1981-11-28T10:00:00Z", "type" => "datetime"},
+ {"name" => "event_date", "value" => "1981-11-28", "type" => "date"},
+ {"name" => "event_time", "value" => "1981-11-28T10:00:00Z", "type" => "time"},
{"name" => "alternately_named_event_time", "value" => "1981-11-28T10:00:00Z"},
{"name" => "is_available", "value" => false}
],
"links" => [
{"href" => "https://example.com/events/2", "rel" => "event"},
@@ -273,13 +273,13 @@
{"name" => "description", "value" => "Tasty Pizza", "prompt" => "awesome"},
{"name" => "id", "value" => 2},
{"name" => "event_id", "value" => 3},
{"name" => "roster_id", "value" => nil},
{"name" => "team_ids", "value" => [3,4]},
- {"name" => "event_date_time", "value" => "1982-01-22T10:00:00Z"},
- {"name" => "event_date", "value" => "1981-01-22"},
- {"name" => "event_time", "value" => "1981-01-22T10:00:00Z"},
+ {"name" => "event_date_time", "value" => "1982-01-22T10:00:00Z", "type" => "datetime"},
+ {"name" => "event_date", "value" => "1981-01-22", "type" => "date"},
+ {"name" => "event_time", "value" => "1981-01-22T10:00:00Z", "type" => "time"},
{"name" => "alternately_named_event_time", "value" => "1981-01-22T10:00:00Z"},
{"name" => "is_available", "value" => true}
],
"links" => [
{"href" => "https://example.com/events/3", "rel" => "event"},
@@ -298,10 +298,10 @@
end
it "includes a valid template if attributes have them" do
expect(test_collection["template"]["data"]).to match_array(
[
- {"name" => "description", "value" => nil, "prompt" => "awesome"},
+ {"name" => "description", "value" => nil, "prompt" => "awesome", "type" => "string"},
{"name" => "repeats", "value" => nil, "prompt" => "true|false"}
]
)
end
end