experimental 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83c50c67d6dd426e4854405cb9ffdf073501ae5e
4
- data.tar.gz: 72a4707f81e9422629f77c972101238f22c31a00
3
+ metadata.gz: e6f19002ed06a98a4c9631cc51015526b03f9667
4
+ data.tar.gz: 9c317be06e52f75e66958a7a1ddf57659cf542dc
5
5
  SHA512:
6
- metadata.gz: ee6381fc21a8e59ce7acae502650d4023a3ddb4df2be016497137ceb5876e7256e9d837fcf6b7fb4582336769f369db61ed7c06741d3ca8bb6aaefc2a17624f0
7
- data.tar.gz: 33c24ea4e0ef978b55225e474969aa57424ae3bdb122a657fe7445b75426d311846b784f6f646ea17f1195b663a8693ace60c9323219f2237451905244cd8879
6
+ metadata.gz: 23a6c14d60ff60c92a5f40e2db007e4ebf8b65b48867e28afd77611b66724f52f3d6c8fdc98f57ba87aaadbb3bdf35652754123d7df835e3f58c7b723fcd31e1
7
+ data.tar.gz: 80792907f97d4d5d62a31ef7eb5ada47834c1af1f24a0098ae5bc8443b08b1c810647860092ad0b466f082c00bb91561b9c531b9060a32a7f149e7d82bbae0ff
@@ -4,12 +4,14 @@ module Experimental
4
4
 
5
5
  attr_accessible :name, :num_buckets, :notes, :population
6
6
 
7
+
7
8
  validates_presence_of :name, :num_buckets
8
9
  validates_numericality_of :num_buckets, :greater_than_or_equal_to => 1
9
10
  validates_numericality_of :winning_bucket,
10
11
  :greater_than_or_equal_to => 0,
11
12
  :less_than => :num_buckets,
12
13
  :if => :ended?
14
+ validate :has_valid_dates
13
15
 
14
16
  def self.in_code
15
17
  where(:removed_at => nil)
@@ -115,6 +117,17 @@ module Experimental
115
117
 
116
118
  private
117
119
 
120
+ def has_valid_dates
121
+ %w(start_date end_date).each do |attribute|
122
+ value = read_attribute_before_type_cast(attribute)
123
+ begin
124
+ value.try(:to_time)
125
+ rescue ArgumentError
126
+ errors.add(attribute, "is not a valid date")
127
+ end
128
+ end
129
+ end
130
+
118
131
  def population_filter
119
132
  @population_filter ||= self.class.find_population(population)
120
133
  end
@@ -1,5 +1,5 @@
1
1
  module Experimental
2
- VERSION = [0, 2, 3]
2
+ VERSION = [0, 2, 4]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: experimental
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - HowAboutWe.com
8
8
  - Rebecca Miller-Webster
9
9
  - Bryan Woods
10
+ - Andrew Watkins
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2014-01-31 00:00:00.000000000 Z
14
+ date: 2014-03-13 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: rails