mongoid 0.8.1 → 0.8.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.8.2
@@ -3,9 +3,11 @@ module Mongoid #:nodoc:
3
3
  module Time #:nodoc:
4
4
  module Conversions #:nodoc:
5
5
  def set(value)
6
+ return nil if value.blank?
6
7
  ::Time.parse(value.to_s).utc
7
8
  end
8
9
  def get(value)
10
+ return nil if value.blank?
9
11
  ::Time.zone ? ::Time.zone.parse(value.to_s).getlocal : value
10
12
  end
11
13
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongoid}
8
- s.version = "0.8.1"
8
+ s.version = "0.8.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Durran Jordan"]
@@ -29,12 +29,32 @@ describe Mongoid::Extensions::Time::Conversions do
29
29
 
30
30
  end
31
31
 
32
+ context "when value is nil" do
33
+
34
+ it "returns nil" do
35
+ Time.set(nil).should be_nil
36
+ end
37
+
38
+ end
39
+
32
40
  end
33
41
 
34
42
  describe "#get" do
35
43
 
36
- it "returns the local time" do
37
- Time.get(@time.dup.utc).utc_offset.should == @time.utc_offset
44
+ context "when time is provided" do
45
+
46
+ it "returns the local time" do
47
+ Time.get(@time.dup.utc).utc_offset.should == @time.utc_offset
48
+ end
49
+
50
+ end
51
+
52
+ context "when time is nil" do
53
+
54
+ it "returns nil" do
55
+ Time.get(nil).should be_nil
56
+ end
57
+
38
58
  end
39
59
 
40
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Durran Jordan