spec/unit/virtus/attribute/class_methods/build_spec.rb in virtus-1.0.2 vs spec/unit/virtus/attribute/class_methods/build_spec.rb in virtus-1.0.3
- old
+ new
@@ -5,11 +5,11 @@
let(:name) { :test }
let(:type) { String }
let(:options) { {} }
- share_examples_for 'a valid attribute instance' do
+ shared_examples_for 'a valid attribute instance' do
it { should be_instance_of(Virtus::Attribute) }
it { should be_frozen }
end
@@ -79,9 +79,17 @@
let(:type) { 'Integer' }
it_behaves_like 'a valid attribute instance'
its(:type) { should be(Axiom::Types::Integer) }
+ end
+
+ context 'when type is a range' do
+ let(:type) { 0..10 }
+
+ it_behaves_like 'a valid attribute instance'
+
+ its(:type) { should be(Axiom::Types.infer(Range)) }
end
context 'when type is a symbol of an existing class constant' do
let(:type) { :String }