virtus 1.0.0.beta3 → 1.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,7 +63,7 @@ module Virtus
63
63
  # @see Attribute.build
64
64
  #
65
65
  # @api public
66
- def attribute(name, type, options = {})
66
+ def attribute(name, type = Object, options = {})
67
67
  assert_valid_name(name)
68
68
  attribute_set << Attribute.build(type, merge_options(name, options))
69
69
  self
@@ -1,3 +1,3 @@
1
1
  module Virtus
2
- VERSION = '1.0.0.beta3'
2
+ VERSION = '1.0.0.beta4'
3
3
  end
@@ -56,6 +56,12 @@ describe Virtus, '#attribute' do
56
56
  expect(klass.attribute_set[:attributes]).to be_instance_of(Virtus::Attribute::Collection)
57
57
  end
58
58
 
59
+ it 'allows specifying attribute without type' do
60
+ klass = Class.new { include Virtus::Model::Core }
61
+ klass.attribute(:name)
62
+ expect(klass.attribute_set[:name]).to be_instance_of(Virtus::Attribute)
63
+ end
64
+
59
65
  context 'with a class' do
60
66
  context 'when type is Boolean' do
61
67
  before :all do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta3
4
+ version: 1.0.0.beta4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors: