clean_model 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/clean_model.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.require_paths = ["lib"]
18
18
 
19
19
  s.add_dependency 'activemodel', '>= 3.0.0'
20
- s.add_dependency 'web_client', '0.0.4'
20
+ s.add_dependency 'web_client', '~> 0.0.4'
21
21
 
22
22
  s.add_development_dependency 'rspec'
23
23
  s.add_development_dependency 'webmock'
@@ -35,7 +35,7 @@ module CleanModel
35
35
 
36
36
  def assign_default(model)
37
37
  default_value = @options[:default].is_a?(Proc) ? @options[:default].call : @options[:default]
38
- model.send("#{@name}=", default_value) if default_value && model.respond_to?("#{@name}=")
38
+ model.send("#{@name}=", default_value) if !default_value.nil? && model.respond_to?("#{@name}=")
39
39
  end
40
40
 
41
41
  private
@@ -1,3 +1,3 @@
1
1
  module CleanModel
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
@@ -43,11 +43,13 @@ describe CleanModel::Base do
43
43
  end
44
44
 
45
45
  it 'Get attributes hash' do
46
- person = Person.new first_name: 'John', last_name: 'Doe', nationality: :usa
47
- person.attributes.keys.should eq [:first_name, :last_name, :nationality, :age]
46
+ person = Person.new first_name: 'John', last_name: 'Doe', nationality: :usa, age: 42, married: true
47
+ person.attributes.keys.should eq [:first_name, :last_name, :nationality, :age, :married]
48
48
  person.attributes[:first_name].should eq 'John'
49
49
  person.attributes[:last_name].should eq 'Doe'
50
50
  person.attributes[:nationality].should eq :usa
51
+ person.attributes[:age].should eq 42
52
+ person.attributes[:married].should eq true
51
53
  end
52
54
 
53
55
  end
@@ -82,6 +84,7 @@ describe CleanModel::Base do
82
84
  person.last_name.should be_nil
83
85
  person.nationality.should eq :argentina
84
86
  person.age.should eq Time.now.year - 1979
87
+ person.married.should be false
85
88
  end
86
89
 
87
90
  end
@@ -7,6 +7,7 @@ module BaseModels
7
7
  attribute :last_name
8
8
  attribute :nationality, default: :argentina
9
9
  attribute :age, default: -> { Time.now.year - 1979 }
10
+ attribute :married, default: false
10
11
 
11
12
  validates_presence_of :first_name, :last_name
12
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clean_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-11 00:00:00.000000000 Z
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -32,7 +32,7 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - '='
35
+ - - ~>
36
36
  - !ruby/object:Gem::Version
37
37
  version: 0.0.4
38
38
  type: :runtime
@@ -40,7 +40,7 @@ dependencies:
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - '='
43
+ - - ~>
44
44
  - !ruby/object:Gem::Version
45
45
  version: 0.0.4
46
46
  - !ruby/object:Gem::Dependency
@@ -126,3 +126,4 @@ signing_key:
126
126
  specification_version: 3
127
127
  summary: Extensions for ActiveModel to implement multiple types of models
128
128
  test_files: []
129
+ has_rdoc: