by_star 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/by_star.gemspec +2 -2
- data/lib/shared.rb +1 -1
- data/spec/by_star_spec.rb +10 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/radar/by_star"
|
12
12
|
gem.authors = ["Ryan Bigg", "Mislav Marohnić"]
|
13
13
|
gem.add_development_dependency "rspec"
|
14
|
+
|
14
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
16
|
end
|
16
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
data/by_star.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{by_star}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ryan Bigg", "Mislav Marohni\304\207"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-15}
|
13
13
|
s.description = %q{ActiveRecord extension for easier date scopes and time ranges}
|
14
14
|
s.email = %q{radarlistener@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/shared.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Shared
|
2
2
|
def conditions_for_range(start_time, end_time, field="created_at")
|
3
|
-
field = table_name << '.' << (field || "created_at")
|
3
|
+
field = table_name << '.' << (field.to_s || "created_at")
|
4
4
|
["#{field} >= ? AND #{field} <= ?", start_time.utc, end_time.utc]
|
5
5
|
end
|
6
6
|
|
data/spec/by_star_spec.rb
CHANGED
@@ -55,10 +55,19 @@ describe Post do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
it "should be able to use an alternative field" do
|
58
|
+
it "should be able to use an alternative field (string)" do
|
59
59
|
Event.by_year(nil, :field => "start_time").size.should eql(8)
|
60
60
|
end
|
61
61
|
|
62
|
+
it "should be able to use an alternative field (symbol)" do
|
63
|
+
Event.by_year(nil, :field => :start_time).size.should eql(8)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should be able to use an alternative field (symbol) with directional searching" do
|
67
|
+
stub_time
|
68
|
+
Event.past(nil, :field => :start_time).size.should eql(1)
|
69
|
+
end
|
70
|
+
|
62
71
|
it "should be able to order the result set" do
|
63
72
|
find(Time.zone.now.year, :order => "created_at DESC").first.text.should eql("That's it!")
|
64
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: by_star
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bigg
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-11-
|
13
|
+
date: 2009-11-15 00:00:00 +10:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|