by_star 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'rubygems'
2
3
  require 'rake'
3
4
 
@@ -11,8 +12,7 @@ begin
11
12
  gem.homepage = "http://github.com/radar/by_star"
12
13
  gem.authors = ["Ryan Bigg", "Mislav Marohnić"]
13
14
  gem.add_development_dependency "rspec"
14
-
15
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ gem.add_dependency('chronic', '~> 0.2.3')
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
@@ -32,7 +32,6 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
32
32
  end
33
33
 
34
34
  task :spec => :check_dependencies
35
-
36
35
  task :default => :spec
37
36
 
38
37
  require 'rake/rdoctask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
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.1"
8
+ s.version = "0.5.2"
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-15}
12
+ s.date = %q{2010-01-13}
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 = [
@@ -56,10 +56,13 @@ Gem::Specification.new do |s|
56
56
 
57
57
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
58
58
  s.add_development_dependency(%q<rspec>, [">= 0"])
59
+ s.add_runtime_dependency(%q<chronic>, ["~> 0.2.3"])
59
60
  else
60
61
  s.add_dependency(%q<rspec>, [">= 0"])
62
+ s.add_dependency(%q<chronic>, ["~> 0.2.3"])
61
63
  end
62
64
  else
63
65
  s.add_dependency(%q<rspec>, [">= 0"])
66
+ s.add_dependency(%q<chronic>, ["~> 0.2.3"])
64
67
  end
65
68
  end
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.to_s || "created_at")
3
+ field = table_name << '.' << (field ? 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
@@ -111,8 +111,12 @@ describe Post do
111
111
  end
112
112
 
113
113
  it "should be able to use an alternative field" do
114
- stub_time(1, 12)
115
- Event.by_month(nil, :field => "start_time").size.should eql(1)
114
+ if Time.zone.now.month == 12
115
+ Event.by_month(nil, :field => "start_time").size.should eql(4)
116
+ else
117
+ stub_time(1, 12)
118
+ Event.by_month(nil, :field => "start_time").size.should eql(1)
119
+ end
116
120
  end
117
121
 
118
122
  it "should be able to specify the year as a string" do
@@ -238,7 +242,7 @@ describe Post do
238
242
  end
239
243
 
240
244
  it "should be able to use an alternative field" do
241
- Event.by_day(nil, :field => "start_time").size.should eql(1)
245
+ Event.by_day(Time.now - 1.day, :field => "start_time").size.should eql(1)
242
246
  end
243
247
  end
244
248
 
@@ -317,7 +321,7 @@ describe Post do
317
321
  end
318
322
 
319
323
  it "should be able to find all events before Ryan's birthday using a non-standard field" do
320
- Event.past("04-12-#{Time.zone.now.year}".to_time, :field => "start_time").size.should eql(7)
324
+ Event.past("01-01-#{Time.zone.now.year+2}".to_time, :field => "start_time").size.should eql(8)
321
325
  end
322
326
 
323
327
  it "should be able to order the find" do
@@ -55,7 +55,7 @@ Post.factory "Tomorrow's post", Time.zone.now + 1.day
55
55
  Post.factory "That's it!", Time.zone.now.end_of_year
56
56
 
57
57
  # For by_weekend scoped test
58
- post = Post.factory "Weekend of May", "16-05-2009".to_time
58
+ post = Post.factory "Weekend of May", "16-05-#{Time.zone.now.year}".to_time
59
59
  post.tags.create(:name => "weekend")
60
60
 
61
61
  # For by_day scoped test
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.1
4
+ version: 0.5.2
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-15 00:00:00 +10:00
13
+ date: 2010-01-13 00:00:00 +10:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -23,6 +23,16 @@ dependencies:
23
23
  - !ruby/object:Gem::Version
24
24
  version: "0"
25
25
  version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: chronic
28
+ type: :runtime
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 0.2.3
35
+ version:
26
36
  description: ActiveRecord extension for easier date scopes and time ranges
27
37
  email: radarlistener@gmail.com
28
38
  executables: []