valuable 0.9.13 → 0.9.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da8784960fceb040aaabcb25475c849731245869
4
- data.tar.gz: 184e99edcf813a8bc0870d96588d0ac131d26698
3
+ metadata.gz: 6a9ae4b2f448c215cd86746d50be099275ca5a35
4
+ data.tar.gz: ac0f811db32462875b4ff074ecb2601fa86290a9
5
5
  SHA512:
6
- metadata.gz: 79ea215a33a5510fe1a323e12a5599bd1399059fb1a87bfd05eb606fce7c113b1426301f41803eaeef876b52f7b4a230954ba567cbc3a186927f08a30def7104
7
- data.tar.gz: f4aa9ca89a97ed94363a9e6c29022ea8ea32fd8d3d631a2cc28dc1473a353486cd0906d4297678edef0da974b59564e0fc2bcc6f18f446afe958e8cefea88838
6
+ metadata.gz: 93d818c8fa7f7a00d95ab807d7142975bc760aceae78051f16dce1a7cb58a8abbf43cf8214f6d1adfaeda90c505ac96bb9abece10ff0f8d97c696c1c65a198ef
7
+ data.tar.gz: 9b4db1e4201ccadc8a19f1f5d126b91c352a747eb702f75c5355e136927c6c9eaa45d68f78dbd271998d21d065d6d34c1ace52b6bb326eebb83fe3713b3409cb
@@ -0,0 +1,53 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+ jobs:
7
+ build:
8
+ docker:
9
+ # specify the version you desire here
10
+ - image: circleci/ruby:2.4.1-node-browsers
11
+
12
+ # Specify service dependencies here if necessary
13
+ # CircleCI maintains a library of pre-built images
14
+ # documented at https://circleci.com/docs/2.0/circleci-images/
15
+ # - image: circleci/postgres:9.4
16
+
17
+ working_directory: ~/repo
18
+
19
+ steps:
20
+ - checkout
21
+
22
+ # Download and cache dependencies
23
+ - restore_cache:
24
+ keys:
25
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
26
+ # fallback to using the latest cache if no exact match is found
27
+ - v1-dependencies-
28
+
29
+ - run:
30
+ name: install dependencies
31
+ command: |
32
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
33
+
34
+ - save_cache:
35
+ paths:
36
+ - ./venv
37
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
38
+
39
+ # run tests!
40
+ - run:
41
+ name: run tests
42
+ command: |
43
+ mkdir /tmp/test-results
44
+ #TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
45
+
46
+ bundle exec rake test > /tmp/test-results/test-unit.txt
47
+
48
+ # collect reports
49
+ - store_test_results:
50
+ path: /tmp/test-results
51
+ - store_artifacts:
52
+ path: /tmp/test-results
53
+ destination: test-results
@@ -38,7 +38,7 @@ module Valuable::Utils
38
38
  klass = collection_item ? attributes[name][:item_klass] : attributes[name][:klass]
39
39
 
40
40
  case klass
41
- when *formatters.keys
41
+ when *formatters.keys
42
42
  formatters[klass].call(value)
43
43
 
44
44
  when NilClass
@@ -62,7 +62,7 @@ module Valuable::Utils
62
62
  when "ActiveSupport::TimeWithZone", "Time", "DateTime"
63
63
  value.to_date
64
64
  when "String"
65
- value && Date.parse(value)
65
+ value && begin; Date.parse(value); rescue; end
66
66
  else
67
67
  value
68
68
  end
@@ -81,15 +81,15 @@ module Valuable::Utils
81
81
  else
82
82
  BigDecimal.new( value.to_s )
83
83
  end
84
-
84
+
85
85
  when :string
86
-
86
+
87
87
  value && value.to_s
88
88
 
89
89
  when :boolean
90
90
 
91
91
  value == '0' ? false : !!value
92
-
92
+
93
93
  else
94
94
 
95
95
  if value.nil?
@@ -105,11 +105,11 @@ module Valuable::Utils
105
105
  end unless value.nil?
106
106
 
107
107
  end
108
-
108
+
109
109
  def formatters
110
110
  @formatters ||= {}
111
111
  end
112
-
112
+
113
113
  def klass_options
114
114
  [NilClass, :integer, Class, :date, :decimal, :string, :boolean] + formatters.keys
115
115
  end
@@ -133,7 +133,7 @@ module Valuable::Utils
133
133
 
134
134
  raise ArgumentError, "#{class_name}##{attribute} has a default value that must be set using a lambda. Use :default => lambda { Thing.new }." if options[:default] && !options[:default].kind_of?(Proc) && !can_be_duplicated?( options[:default] )
135
135
 
136
- raise ArgumentError, "has_value did not know how to respond to option(s) #{invalid_options.join(', ')}. Valid (optional) arguments are: #{known_options.join(', ')}" unless invalid_options.empty?
136
+ raise ArgumentError, "has_value did not know how to respond to option(s) #{invalid_options.join(', ')}. Valid (optional) arguments are: #{known_options.join(', ')}" unless invalid_options.empty?
137
137
 
138
138
  raise ArgumentError, "#{class_name} doesn't know how to format #{attribute} with :klass => #{options[:klass].inspect}" unless klass_options.any?{|klass| klass === options[:klass]}
139
139
 
@@ -21,6 +21,11 @@ class TypicalTest < Test::Unit::TestCase
21
21
  assert_equal( born_on, me.dob )
22
22
  end
23
23
 
24
+ def test_that_date_do_not_flip_out
25
+ me = Person.new( :dob => "" )
26
+ assert_equal( nil, me.dob )
27
+ end
28
+
24
29
  def test_that_dates_are_parsed_from_strings
25
30
  neil_born_on = 'August 5, 1930'
26
31
  neil = Person.new( :dob => neil_born_on )
@@ -1 +1 @@
1
- 0.9.13
1
+ 0.9.14
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valuable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.13
4
+ version: 0.9.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johnathon Wright
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-02 00:00:00.000000000 Z
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Valuable is a ruby base class that is essentially attr_accessor on steroids.
14
14
  A simple and intuitive interface allows you to get on with modeling in your app.
@@ -17,6 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - ".circleci/config.yml"
20
21
  - ".gitignore"
21
22
  - Gemfile
22
23
  - Gemfile.lock