timespan 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/spec/timespan/mongoid/account.rb +7 -1
- data/spec/timespan/mongoid/mongoid_timespan_spec.rb +26 -1
- data/timespan.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
@@ -6,9 +6,22 @@ describe Timespan do
|
|
6
6
|
let(:from) { Chronic.parse("1 day ago") }
|
7
7
|
let(:to) { Time.now }
|
8
8
|
|
9
|
+
context '2 days duration using factory method' do
|
10
|
+
let(:account) do
|
11
|
+
Account.create_it! '2 days'
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.start_date' do
|
15
|
+
it 'should default to today' do
|
16
|
+
DateTime.parse(subject.period.start_date.to_s).strftime('%d %b %Y').should == Date.today.strftime('%d %b %Y')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
9
22
|
context '2 days duration (from now - default)' do
|
10
23
|
let(:account) do
|
11
|
-
Account.create :period => {:duration => '2 days'
|
24
|
+
Account.create :period => {:duration => '2 days'}
|
12
25
|
end
|
13
26
|
|
14
27
|
describe '.start_date' do
|
@@ -17,4 +30,16 @@ describe Timespan do
|
|
17
30
|
end
|
18
31
|
end
|
19
32
|
end
|
33
|
+
|
34
|
+
context '2 days duration (from 1 day ago)' do
|
35
|
+
let(:account) do
|
36
|
+
Account.create :period => {:duration => '2 days', :from => from }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '.start_date' do
|
40
|
+
it 'should default to today' do
|
41
|
+
DateTime.parse(subject.period.start_date.to_s).strftime('%d %b %Y').should == 1.day.ago.strftime('%d %b %Y')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
20
45
|
end
|
data/timespan.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "timespan"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = "2012-05-
|
12
|
+
s.date = "2012-05-17"
|
13
13
|
s.description = "Makes it easy to calculate time distance in different units"
|
14
14
|
s.email = "kmandrup@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timespan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
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-05-
|
12
|
+
date: 2012-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chronic
|
@@ -254,7 +254,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
254
254
|
version: '0'
|
255
255
|
segments:
|
256
256
|
- 0
|
257
|
-
hash:
|
257
|
+
hash: -1064045562578048664
|
258
258
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
259
259
|
none: false
|
260
260
|
requirements:
|