spec/unit/virtus/class_methods/finalize_spec.rb in virtus-1.0.0.rc1 vs spec/unit/virtus/class_methods/finalize_spec.rb in virtus-1.0.0.rc2
- old
+ new
@@ -4,10 +4,11 @@
before do
module Examples
class Person
include Virtus.model(:finalize => false)
+ attribute :name, String
attribute :articles, Array['Examples::Article']
attribute :address, :'Examples::Address'
end
class Article
@@ -35,9 +36,14 @@
expect(Virtus::Builder.pending).not_to include(Examples::Post)
expect(Virtus::Builder.pending).not_to include(Examples::Address)
Virtus.finalize
+ end
+
+ it "sets attributes that don't require finalization" do
+ expect(Examples::Person.attribute_set[:name]).to be_instance_of(Virtus::Attribute)
+ expect(Examples::Person.attribute_set[:name].primitive).to be(String)
end
it 'it finalizes member type for a collection attribute' do
expect(Examples::Person.attribute_set[:address].primitive).to be(Examples::Address)
end