spec/support/spec_blueprints.rb in praxis-blueprints-3.1 vs spec/support/spec_blueprints.rb in praxis-blueprints-3.2
- old
+ new
@@ -18,10 +18,13 @@
end
attribute :tags, Attributor::Collection.of(String)
attribute :href, String
attribute :alive, Attributor::Boolean, default: true
+ attribute :myself, Person
+ attribute :friends, Attributor::Collection.of(Person)
+ attribute :metadata, Attributor::Hash
end
view :default do
attribute :name
attribute :full_name
@@ -31,10 +34,15 @@
view :circular do
attribute :address, view: :circular
end
+ view :self_referencing do
+ attribute :myself, view: :self_referencing
+ attribute :friends, view: :self_referencing
+ end
+
view :current do
attribute :name
attribute :full_name
attribute :address
end
@@ -91,6 +99,22 @@
attributes do
attribute :first, String, example: /[:first_name:]/
attribute :last, String, example: /[:last_name:]/
end
+end
+
+
+class SimpleHash < Attributor::Model
+ attributes do
+ attribute :id, Integer
+ attribute :hash, Hash
+ end
+end
+
+
+class SimpleHashCollection < Attributor::Model
+ attributes do
+ attribute :id, Integer
+ attribute :hash_collection, Attributor::Collection.of(Hash)
+ end
end