recurrence 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +15 -11
- data/History.txt +4 -0
- data/lib/recurrence/namespace.rb +10 -6
- data/lib/recurrence/version.rb +1 -1
- data/recurrence.gemspec +2 -1
- data/spec/recurrence_spec.rb +45 -0
- metadata +52 -44
data/Gemfile.lock
CHANGED
@@ -1,26 +1,30 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
recurrence (1.0.
|
4
|
+
recurrence (1.0.3)
|
5
5
|
activesupport (>= 2.3.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (3.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
activesupport (3.1.1)
|
11
|
+
multi_json (~> 1.0)
|
12
|
+
diff-lcs (1.1.3)
|
13
|
+
multi_json (1.0.3)
|
14
|
+
rake (0.9.2.2)
|
15
|
+
rspec (2.6.0)
|
16
|
+
rspec-core (~> 2.6.0)
|
17
|
+
rspec-expectations (~> 2.6.0)
|
18
|
+
rspec-mocks (~> 2.6.0)
|
19
|
+
rspec-core (2.6.4)
|
20
|
+
rspec-expectations (2.6.0)
|
18
21
|
diff-lcs (~> 1.1.2)
|
19
|
-
rspec-mocks (2.
|
22
|
+
rspec-mocks (2.6.0)
|
20
23
|
|
21
24
|
PLATFORMS
|
22
25
|
ruby
|
23
26
|
|
24
27
|
DEPENDENCIES
|
28
|
+
rake
|
25
29
|
recurrence!
|
26
|
-
rspec (~> 2.
|
30
|
+
rspec (~> 2.6)
|
data/History.txt
CHANGED
data/lib/recurrence/namespace.rb
CHANGED
@@ -14,6 +14,15 @@ module SimplesIdeias
|
|
14
14
|
FREQUENCY = %w(day week month year)
|
15
15
|
|
16
16
|
attr_reader :event, :options
|
17
|
+
|
18
|
+
def self.as_date(date) # :nodoc:
|
19
|
+
case date
|
20
|
+
when String
|
21
|
+
Date.parse(date)
|
22
|
+
else
|
23
|
+
date
|
24
|
+
end
|
25
|
+
end
|
17
26
|
|
18
27
|
# Return the default starting date.
|
19
28
|
#
|
@@ -291,12 +300,7 @@ module SimplesIdeias
|
|
291
300
|
end
|
292
301
|
|
293
302
|
def as_date(date) # :nodoc:
|
294
|
-
|
295
|
-
when String
|
296
|
-
Date.parse(date)
|
297
|
-
else
|
298
|
-
date
|
299
|
-
end
|
303
|
+
self.class.as_date(date)
|
300
304
|
end
|
301
305
|
end
|
302
306
|
end
|
data/lib/recurrence/version.rb
CHANGED
data/recurrence.gemspec
CHANGED
data/spec/recurrence_spec.rb
CHANGED
@@ -94,6 +94,51 @@ describe Recurrence do
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
97
|
+
|
98
|
+
describe ".default_until_date" do
|
99
|
+
after(:each){ Recurrence.default_until_date = Date.new(2037, 12, 31)}
|
100
|
+
|
101
|
+
it "should return 2037-12-31 by default" do
|
102
|
+
Recurrence.default_until_date.should == Date.new(2037, 12, 31)
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should return new until when changed" do
|
106
|
+
Recurrence.default_until_date = Date.new(2057, 12, 31)
|
107
|
+
Recurrence.default_until_date.should == Date.new(2057, 12, 31)
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should alter event end with new default until" do
|
111
|
+
@recurrence = Recurrence.daily
|
112
|
+
@recurrence.events[-1].should == Date.parse("2037-12-31")
|
113
|
+
|
114
|
+
Recurrence.default_until_date = Date.new(2057, 12, 31)
|
115
|
+
|
116
|
+
@recurrence = Recurrence.daily
|
117
|
+
@recurrence.events[-1].should == Date.parse("2057-12-31")
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should not return any events when default until is past" do
|
121
|
+
Recurrence.default_until_date = Date.new(2007, 12, 31)
|
122
|
+
@recurrence = Recurrence.daily
|
123
|
+
@recurrence.events.length.should == 0
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should allow value to be changed multiple times" do
|
127
|
+
Recurrence.default_until_date = Date.new(2057, 12, 31)
|
128
|
+
Recurrence.default_until_date.should == Date.new(2057, 12, 31)
|
129
|
+
@recurrence1 = Recurrence.monthly(:on => 2)
|
130
|
+
|
131
|
+
Recurrence.default_until_date = Date.new(2187, 12, 31)
|
132
|
+
Recurrence.default_until_date.should == Date.new(2187, 12, 31)
|
133
|
+
@recurrence2 = Recurrence.monthly(:on => 2)
|
134
|
+
@recurrence2.events.length.should == @recurrence1.events.length + 130 * 12
|
135
|
+
|
136
|
+
Recurrence.default_until_date = Date.new(2257, 12, 31)
|
137
|
+
Recurrence.default_until_date.should == Date.new(2257, 12, 31)
|
138
|
+
@recurrence3 = Recurrence.monthly(:on => 2)
|
139
|
+
@recurrence3.events.length.should == @recurrence2.events.length + 70 * 12
|
140
|
+
end
|
141
|
+
end
|
97
142
|
|
98
143
|
context "with daily recurring" do
|
99
144
|
it "should recur until limit date" do
|
metadata
CHANGED
@@ -1,50 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: recurrence
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Nando Vieira
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-10-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: activesupport
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70267646596360 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
24
21
|
version: 2.3.0
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *70267646596360
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &70267646595780 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
29
|
+
requirements:
|
33
30
|
- - ~>
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: 2.
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.6'
|
36
33
|
type: :development
|
37
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70267646595780
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: &70267646595300 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70267646595300
|
38
47
|
description: A simple library to handle recurring events
|
39
|
-
email:
|
48
|
+
email:
|
40
49
|
- fnando.vieira@gmail.com
|
41
50
|
executables: []
|
42
|
-
|
43
51
|
extensions: []
|
44
|
-
|
45
52
|
extra_rdoc_files: []
|
46
|
-
|
47
|
-
files:
|
53
|
+
files:
|
48
54
|
- .gitignore
|
49
55
|
- .rspec
|
50
56
|
- .rvmrc
|
@@ -66,34 +72,36 @@ files:
|
|
66
72
|
- recurrence.gemspec
|
67
73
|
- spec/recurrence_spec.rb
|
68
74
|
- spec/spec_helper.rb
|
69
|
-
has_rdoc: true
|
70
75
|
homepage: http://rubygems.org/gems/recurrence
|
71
76
|
licenses: []
|
72
|
-
|
73
77
|
post_install_message:
|
74
78
|
rdoc_options: []
|
75
|
-
|
76
|
-
require_paths:
|
79
|
+
require_paths:
|
77
80
|
- lib
|
78
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
82
|
none: false
|
80
|
-
requirements:
|
81
|
-
- -
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version:
|
84
|
-
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
hash: -4581356905210184239
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
91
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version:
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
hash: -4581356905210184239
|
90
99
|
requirements: []
|
91
|
-
|
92
100
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.
|
101
|
+
rubygems_version: 1.8.10
|
94
102
|
signing_key:
|
95
103
|
specification_version: 3
|
96
104
|
summary: A simple library to handle recurring events
|
97
|
-
test_files:
|
105
|
+
test_files:
|
98
106
|
- spec/recurrence_spec.rb
|
99
107
|
- spec/spec_helper.rb
|