by_star 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{by_star}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.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-10-17}
12
+ s.date = %q{2009-10-28}
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 = [
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
22
22
  "Rakefile",
23
23
  "VERSION",
24
24
  "by_star.gemspec",
25
- "by_star.sqlite3",
26
25
  "lib/by_star.rb",
27
26
  "lib/calculations.rb",
28
27
  "lib/calculations/count.rb",
@@ -198,8 +198,10 @@ module ByStar
198
198
  end_time = parse(end_time)
199
199
 
200
200
  raise ParseError, "End time is before start time, searching like this will return no results." if end_time < start_time
201
-
202
- with_scope(:find => { :conditions => conditions_for_range(start_time, end_time, options) }) do
201
+ order = options.delete(:order)
202
+ scoping = { :conditions => conditions_for_range(start_time, end_time, options) }
203
+ scoping.merge!(:order => order) if order
204
+ with_scope(:find => scoping) do
203
205
  if block_given?
204
206
  with_scope(:find => block.call) do
205
207
  find(:all)
@@ -58,6 +58,10 @@ describe Post do
58
58
  it "should be able to use an alternative field" do
59
59
  Event.by_year(nil, :field => "start_time").size.should eql(8)
60
60
  end
61
+
62
+ it "should be able to order the result set" do
63
+ find(Time.zone.now.year, :order => "created_at DESC").first.text.should eql("That's it!")
64
+ end
61
65
  end
62
66
 
63
67
  describe "by month" do
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.3.0
4
+ version: 0.3.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-10-17 00:00:00 +10:00
13
+ date: 2009-10-28 00:00:00 +10:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -38,7 +38,6 @@ files:
38
38
  - Rakefile
39
39
  - VERSION
40
40
  - by_star.gemspec
41
- - by_star.sqlite3
42
41
  - lib/by_star.rb
43
42
  - lib/calculations.rb
44
43
  - lib/calculations/count.rb