spec/support/spec_blueprints.rb in praxis-blueprints-1.2.0 vs spec/support/spec_blueprints.rb in praxis-blueprints-1.3.0
- old
+ new
@@ -1,11 +1,13 @@
class Person < Praxis::Blueprint
attributes do
attribute :name, String, example: /[:first_name:]/
attribute :email, String, example: proc { |person| "#{person.name}@example.com" }
-
+
+ attribute :age, Integer
+
attribute :full_name, FullName
attribute :aliases, Attributor::Collection.of(FullName)
attribute :address, Address, example: proc { |person, context| Address.example(context, resident: person) }
@@ -34,11 +36,18 @@
view :extended do
attribute :name
attribute :full_name
+ attribute :age
attribute :address
attribute :alive
+ end
+
+ view :with_unset, include_unset: true do
+ attribute :name
+ attribute :email
+ attribute :age
end
end