event_calendar_engine 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/models/event.rb +3 -6
- data/spec/models/event_spec.rb +15 -12
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/app/models/event.rb
CHANGED
@@ -19,12 +19,9 @@ class Event < ActiveRecord::Base
|
|
19
19
|
|
20
20
|
acts_as_revisable :revision_class_name => 'EventRevision', :on_delete => :revise
|
21
21
|
|
22
|
-
scope :past,
|
23
|
-
|
24
|
-
|
25
|
-
scope :future, lambda{
|
26
|
-
where(sanitize_sql_array(["start_on > '%s'", Date.current]))
|
27
|
-
}
|
22
|
+
scope :past, where(sanitize_sql_array(["end_on < '%s'", Date.current]))
|
23
|
+
scope :future, where(sanitize_sql_array(["start_on > '%s'", Date.current]))
|
24
|
+
scope :current, where(sanitize_sql_array(["end_on >= '%s' AND start_on <= '%s'", Date.current, Date.current]))
|
28
25
|
|
29
26
|
validate :sane_dates
|
30
27
|
|
data/spec/models/event_spec.rb
CHANGED
@@ -10,24 +10,27 @@ describe Event do
|
|
10
10
|
:location => "value for location",
|
11
11
|
:description => "value for description"
|
12
12
|
}
|
13
|
-
|
14
|
-
|
15
|
-
it "Event.past finds past events" do
|
16
|
-
past = Event.create!(@valid_attributes)
|
17
|
-
Event.create!(@valid_attributes.merge!({
|
13
|
+
@may_2010 = Event.create!(@valid_attributes)
|
14
|
+
@mar_2100 = Event.create!(@valid_attributes.merge!({
|
18
15
|
:start_on => Date.new(2100,3,12),
|
19
16
|
:end_on => Date.new(2100,3,13)
|
20
17
|
}))
|
21
|
-
Event.
|
18
|
+
@current = Event.create!(@valid_attributes.merge!({
|
19
|
+
:start_on => Date.yesterday,
|
20
|
+
:end_on => Date.tomorrow
|
21
|
+
}))
|
22
|
+
end
|
23
|
+
|
24
|
+
it "Event.past finds past events" do
|
25
|
+
Event.past.first.should eql @may_2010
|
22
26
|
end
|
23
27
|
|
24
28
|
it "Event.future finds future events" do
|
25
|
-
Event.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
Event.future.first.should eql future
|
29
|
+
Event.future.first.should eql @mar_2100
|
30
|
+
end
|
31
|
+
|
32
|
+
it "Event.current finds current events" do
|
33
|
+
Event.current.first.should eql @current
|
31
34
|
end
|
32
35
|
|
33
36
|
it "should create a new instance given valid attributes" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_calendar_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jason LaPier
|