nostradamus 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Nostradamus
2
2
  module Version
3
- STRING = "0.0.2"
3
+ STRING = "0.0.3"
4
4
  end
5
5
  end
data/lib/nostradamus.rb CHANGED
@@ -5,11 +5,15 @@ module Nostradamus
5
5
  SECONDS_REGEX = /[0-9]*:[0-9]*:([0-9]*)/
6
6
 
7
7
  def parse(human_time)
8
- convert(human_time, :to => :seconds)
8
+ if human_time
9
+ convert(human_time, :to => :seconds)
10
+ end
9
11
  end
10
12
 
11
13
  def humanize(seconds, format = nil)
12
- convert(seconds, :to => :human_time, :format => format)
14
+ if seconds
15
+ convert(seconds, :to => :human_time, :format => format)
16
+ end
13
17
  end
14
18
 
15
19
  private
@@ -9,6 +9,12 @@ describe Nostradamus do
9
9
  described_class.parse("12:15").should eq 44100
10
10
  described_class.parse("12:15:15").should eq 44115
11
11
  end
12
+
13
+ it "should not raise error without value" do
14
+ expect {
15
+ described_class.parse(nil)
16
+ }.to_not raise_error
17
+ end
12
18
  end
13
19
 
14
20
  context "seconds to human time" do
@@ -18,5 +24,11 @@ describe Nostradamus do
18
24
  described_class.humanize(44115).should eq "12:15:15"
19
25
  described_class.humanize(44115, :short).should eq "12:15"
20
26
  end
27
+
28
+ it "should not raise error without value" do
29
+ expect {
30
+ described_class.humanize(nil)
31
+ }.to_not raise_error
32
+ end
21
33
  end
22
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nostradamus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: