pacecar 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/.gitignore +6 -0
  2. data/.travis.yml +4 -0
  3. data/Appraisals +22 -0
  4. data/Gemfile +1 -7
  5. data/Gemfile.lock +129 -0
  6. data/README.md +33 -33
  7. data/Rakefile +2 -19
  8. data/gemfiles/rails-3.0.11-database-mysql.gemfile +8 -0
  9. data/gemfiles/rails-3.0.11-database-mysql.gemfile.lock +134 -0
  10. data/gemfiles/rails-3.0.11-database-mysql2.gemfile +8 -0
  11. data/gemfiles/rails-3.0.11-database-mysql2.gemfile.lock +134 -0
  12. data/gemfiles/rails-3.0.11-database-pg.gemfile +8 -0
  13. data/gemfiles/rails-3.0.11-database-pg.gemfile.lock +134 -0
  14. data/gemfiles/rails-3.0.11-database-sqlite3-ruby.gemfile +8 -0
  15. data/gemfiles/rails-3.0.11-database-sqlite3-ruby.gemfile.lock +136 -0
  16. data/gemfiles/rails-3.0.11-database-sqlite3.gemfile +8 -0
  17. data/gemfiles/rails-3.0.11-database-sqlite3.gemfile.lock +134 -0
  18. data/gemfiles/rails-3.1.3-database-mysql.gemfile +8 -0
  19. data/gemfiles/rails-3.1.3-database-mysql.gemfile.lock +144 -0
  20. data/gemfiles/rails-3.1.3-database-mysql2.gemfile +8 -0
  21. data/gemfiles/rails-3.1.3-database-mysql2.gemfile.lock +144 -0
  22. data/gemfiles/rails-3.1.3-database-pg.gemfile +8 -0
  23. data/gemfiles/rails-3.1.3-database-pg.gemfile.lock +144 -0
  24. data/gemfiles/rails-3.1.3-database-sqlite3-ruby.gemfile +8 -0
  25. data/gemfiles/rails-3.1.3-database-sqlite3-ruby.gemfile.lock +146 -0
  26. data/gemfiles/rails-3.1.3-database-sqlite3.gemfile +8 -0
  27. data/gemfiles/rails-3.1.3-database-sqlite3.gemfile.lock +144 -0
  28. data/lib/pacecar.rb +1 -0
  29. data/lib/pacecar/helpers.rb +1 -1
  30. data/lib/pacecar/version.rb +3 -0
  31. data/pacecar.gemspec +25 -0
  32. data/spec/associations_spec.rb +32 -0
  33. data/spec/boolean_spec.rb +30 -0
  34. data/spec/datetime_spec.rb +92 -0
  35. data/spec/dummy/Rakefile +7 -0
  36. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  37. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  38. data/spec/dummy/app/models/article.rb +5 -0
  39. data/spec/dummy/app/models/comment.rb +5 -0
  40. data/spec/dummy/app/models/mammal.rb +7 -0
  41. data/spec/dummy/app/models/post.rb +14 -0
  42. data/spec/dummy/app/models/user.rb +14 -0
  43. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  44. data/spec/dummy/config.ru +4 -0
  45. data/spec/dummy/config/application.rb +45 -0
  46. data/spec/dummy/config/boot.rb +10 -0
  47. data/spec/dummy/config/database.yml +51 -0
  48. data/spec/dummy/config/environment.rb +5 -0
  49. data/spec/dummy/config/environments/development.rb +26 -0
  50. data/spec/dummy/config/environments/production.rb +49 -0
  51. data/spec/dummy/config/environments/test.rb +35 -0
  52. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  53. data/spec/dummy/config/initializers/inflections.rb +10 -0
  54. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  55. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  56. data/spec/dummy/config/initializers/session_store.rb +8 -0
  57. data/spec/dummy/config/locales/en.yml +5 -0
  58. data/spec/dummy/config/routes.rb +58 -0
  59. data/spec/dummy/db/migrate/20100419201348_create_schema.rb +37 -0
  60. data/spec/dummy/public/404.html +26 -0
  61. data/spec/dummy/public/422.html +26 -0
  62. data/spec/dummy/public/500.html +26 -0
  63. data/spec/dummy/public/favicon.ico +0 -0
  64. data/spec/dummy/public/javascripts/application.js +2 -0
  65. data/spec/dummy/public/javascripts/controls.js +965 -0
  66. data/spec/dummy/public/javascripts/dragdrop.js +974 -0
  67. data/spec/dummy/public/javascripts/effects.js +1123 -0
  68. data/spec/dummy/public/javascripts/prototype.js +6001 -0
  69. data/spec/dummy/public/javascripts/rails.js +191 -0
  70. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  71. data/spec/dummy/script/rails +6 -0
  72. data/spec/duration_spec.rb +22 -0
  73. data/spec/factories.rb +26 -0
  74. data/spec/helpers_spec.rb +49 -0
  75. data/spec/integration/navigation_spec.rb +9 -0
  76. data/spec/limit_spec.rb +25 -0
  77. data/spec/numeric_spec.rb +43 -0
  78. data/spec/order_spec.rb +22 -0
  79. data/spec/pacecar_spec.rb +7 -0
  80. data/spec/polymorph_spec.rb +18 -0
  81. data/spec/presence_spec.rb +23 -0
  82. data/spec/ranking_spec.rb +63 -0
  83. data/spec/search_spec.rb +63 -0
  84. data/spec/spec_helper.rb +38 -0
  85. data/spec/state_spec.rb +69 -0
  86. metadata +202 -10
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rails", "3.1.3"
6
+ gem "sqlite3-ruby"
7
+
8
+ gemspec :path=>"../"
@@ -0,0 +1,146 @@
1
+ PATH
2
+ remote: /Users/mjankowski/Development/opensource/pacecar
3
+ specs:
4
+ pacecar (1.5.2)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ actionmailer (3.1.3)
10
+ actionpack (= 3.1.3)
11
+ mail (~> 2.3.0)
12
+ actionpack (3.1.3)
13
+ activemodel (= 3.1.3)
14
+ activesupport (= 3.1.3)
15
+ builder (~> 3.0.0)
16
+ erubis (~> 2.7.0)
17
+ i18n (~> 0.6)
18
+ rack (~> 1.3.5)
19
+ rack-cache (~> 1.1)
20
+ rack-mount (~> 0.8.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.0.3)
23
+ activemodel (3.1.3)
24
+ activesupport (= 3.1.3)
25
+ builder (~> 3.0.0)
26
+ i18n (~> 0.6)
27
+ activerecord (3.1.3)
28
+ activemodel (= 3.1.3)
29
+ activesupport (= 3.1.3)
30
+ arel (~> 2.2.1)
31
+ tzinfo (~> 0.3.29)
32
+ activeresource (3.1.3)
33
+ activemodel (= 3.1.3)
34
+ activesupport (= 3.1.3)
35
+ activesupport (3.1.3)
36
+ multi_json (~> 1.0)
37
+ appraisal (0.4.0)
38
+ bundler
39
+ rake
40
+ arel (2.2.1)
41
+ builder (3.0.0)
42
+ capybara (1.1.2)
43
+ mime-types (>= 1.16)
44
+ nokogiri (>= 1.3.3)
45
+ rack (>= 1.0.0)
46
+ rack-test (>= 0.5.4)
47
+ selenium-webdriver (~> 2.0)
48
+ xpath (~> 0.1.4)
49
+ childprocess (0.2.6)
50
+ ffi (~> 1.0.6)
51
+ diff-lcs (1.1.3)
52
+ erubis (2.7.0)
53
+ factory_girl (2.3.2)
54
+ activesupport
55
+ factory_girl_rails (1.4.0)
56
+ factory_girl (~> 2.3.0)
57
+ railties (>= 3.0.0)
58
+ ffi (1.0.11)
59
+ hike (1.2.1)
60
+ i18n (0.6.0)
61
+ json (1.6.4)
62
+ mail (2.3.0)
63
+ i18n (>= 0.4.0)
64
+ mime-types (~> 1.16)
65
+ treetop (~> 1.4.8)
66
+ metaclass (0.0.1)
67
+ mime-types (1.17.2)
68
+ mocha (0.10.0)
69
+ metaclass (~> 0.0.1)
70
+ multi_json (1.0.4)
71
+ nokogiri (1.5.0)
72
+ polyglot (0.3.3)
73
+ rack (1.3.6)
74
+ rack-cache (1.1)
75
+ rack (>= 0.4)
76
+ rack-mount (0.8.3)
77
+ rack (>= 1.0.0)
78
+ rack-ssl (1.3.2)
79
+ rack
80
+ rack-test (0.6.1)
81
+ rack (>= 1.0)
82
+ rails (3.1.3)
83
+ actionmailer (= 3.1.3)
84
+ actionpack (= 3.1.3)
85
+ activerecord (= 3.1.3)
86
+ activeresource (= 3.1.3)
87
+ activesupport (= 3.1.3)
88
+ bundler (~> 1.0)
89
+ railties (= 3.1.3)
90
+ railties (3.1.3)
91
+ actionpack (= 3.1.3)
92
+ activesupport (= 3.1.3)
93
+ rack-ssl (~> 1.3.2)
94
+ rake (>= 0.8.7)
95
+ rdoc (~> 3.4)
96
+ thor (~> 0.14.6)
97
+ rake (0.9.2.2)
98
+ rdoc (3.12)
99
+ json (~> 1.4)
100
+ rspec (2.8.0)
101
+ rspec-core (~> 2.8.0)
102
+ rspec-expectations (~> 2.8.0)
103
+ rspec-mocks (~> 2.8.0)
104
+ rspec-core (2.8.0)
105
+ rspec-expectations (2.8.0)
106
+ diff-lcs (~> 1.1.2)
107
+ rspec-mocks (2.8.0)
108
+ rspec-rails (2.8.1)
109
+ actionpack (>= 3.0)
110
+ activesupport (>= 3.0)
111
+ railties (>= 3.0)
112
+ rspec (~> 2.8.0)
113
+ rubyzip (0.9.5)
114
+ selenium-webdriver (2.16.0)
115
+ childprocess (>= 0.2.5)
116
+ ffi (~> 1.0.9)
117
+ multi_json (~> 1.0.4)
118
+ rubyzip
119
+ sprockets (2.0.3)
120
+ hike (~> 1.2)
121
+ rack (~> 1.0)
122
+ tilt (~> 1.1, != 1.3.0)
123
+ sqlite3 (1.3.5)
124
+ sqlite3-ruby (1.3.3)
125
+ sqlite3 (>= 1.3.3)
126
+ thor (0.14.6)
127
+ tilt (1.3.3)
128
+ treetop (1.4.10)
129
+ polyglot
130
+ polyglot (>= 0.3.1)
131
+ tzinfo (0.3.31)
132
+ xpath (0.1.4)
133
+ nokogiri (~> 1.3)
134
+
135
+ PLATFORMS
136
+ ruby
137
+
138
+ DEPENDENCIES
139
+ appraisal (~> 0.4)
140
+ capybara (>= 0.4.0)
141
+ factory_girl_rails
142
+ mocha
143
+ pacecar!
144
+ rails (= 3.1.3)
145
+ rspec-rails (>= 2.4.0)
146
+ sqlite3-ruby
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rails", "3.1.3"
6
+ gem "sqlite3"
7
+
8
+ gemspec :path=>"../"
@@ -0,0 +1,144 @@
1
+ PATH
2
+ remote: /Users/mjankowski/Development/opensource/pacecar
3
+ specs:
4
+ pacecar (1.5.2)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ actionmailer (3.1.3)
10
+ actionpack (= 3.1.3)
11
+ mail (~> 2.3.0)
12
+ actionpack (3.1.3)
13
+ activemodel (= 3.1.3)
14
+ activesupport (= 3.1.3)
15
+ builder (~> 3.0.0)
16
+ erubis (~> 2.7.0)
17
+ i18n (~> 0.6)
18
+ rack (~> 1.3.5)
19
+ rack-cache (~> 1.1)
20
+ rack-mount (~> 0.8.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.0.3)
23
+ activemodel (3.1.3)
24
+ activesupport (= 3.1.3)
25
+ builder (~> 3.0.0)
26
+ i18n (~> 0.6)
27
+ activerecord (3.1.3)
28
+ activemodel (= 3.1.3)
29
+ activesupport (= 3.1.3)
30
+ arel (~> 2.2.1)
31
+ tzinfo (~> 0.3.29)
32
+ activeresource (3.1.3)
33
+ activemodel (= 3.1.3)
34
+ activesupport (= 3.1.3)
35
+ activesupport (3.1.3)
36
+ multi_json (~> 1.0)
37
+ appraisal (0.4.0)
38
+ bundler
39
+ rake
40
+ arel (2.2.1)
41
+ builder (3.0.0)
42
+ capybara (1.1.2)
43
+ mime-types (>= 1.16)
44
+ nokogiri (>= 1.3.3)
45
+ rack (>= 1.0.0)
46
+ rack-test (>= 0.5.4)
47
+ selenium-webdriver (~> 2.0)
48
+ xpath (~> 0.1.4)
49
+ childprocess (0.2.6)
50
+ ffi (~> 1.0.6)
51
+ diff-lcs (1.1.3)
52
+ erubis (2.7.0)
53
+ factory_girl (2.3.2)
54
+ activesupport
55
+ factory_girl_rails (1.4.0)
56
+ factory_girl (~> 2.3.0)
57
+ railties (>= 3.0.0)
58
+ ffi (1.0.11)
59
+ hike (1.2.1)
60
+ i18n (0.6.0)
61
+ json (1.6.4)
62
+ mail (2.3.0)
63
+ i18n (>= 0.4.0)
64
+ mime-types (~> 1.16)
65
+ treetop (~> 1.4.8)
66
+ metaclass (0.0.1)
67
+ mime-types (1.17.2)
68
+ mocha (0.10.0)
69
+ metaclass (~> 0.0.1)
70
+ multi_json (1.0.4)
71
+ nokogiri (1.5.0)
72
+ polyglot (0.3.3)
73
+ rack (1.3.6)
74
+ rack-cache (1.1)
75
+ rack (>= 0.4)
76
+ rack-mount (0.8.3)
77
+ rack (>= 1.0.0)
78
+ rack-ssl (1.3.2)
79
+ rack
80
+ rack-test (0.6.1)
81
+ rack (>= 1.0)
82
+ rails (3.1.3)
83
+ actionmailer (= 3.1.3)
84
+ actionpack (= 3.1.3)
85
+ activerecord (= 3.1.3)
86
+ activeresource (= 3.1.3)
87
+ activesupport (= 3.1.3)
88
+ bundler (~> 1.0)
89
+ railties (= 3.1.3)
90
+ railties (3.1.3)
91
+ actionpack (= 3.1.3)
92
+ activesupport (= 3.1.3)
93
+ rack-ssl (~> 1.3.2)
94
+ rake (>= 0.8.7)
95
+ rdoc (~> 3.4)
96
+ thor (~> 0.14.6)
97
+ rake (0.9.2.2)
98
+ rdoc (3.12)
99
+ json (~> 1.4)
100
+ rspec (2.8.0)
101
+ rspec-core (~> 2.8.0)
102
+ rspec-expectations (~> 2.8.0)
103
+ rspec-mocks (~> 2.8.0)
104
+ rspec-core (2.8.0)
105
+ rspec-expectations (2.8.0)
106
+ diff-lcs (~> 1.1.2)
107
+ rspec-mocks (2.8.0)
108
+ rspec-rails (2.8.1)
109
+ actionpack (>= 3.0)
110
+ activesupport (>= 3.0)
111
+ railties (>= 3.0)
112
+ rspec (~> 2.8.0)
113
+ rubyzip (0.9.5)
114
+ selenium-webdriver (2.16.0)
115
+ childprocess (>= 0.2.5)
116
+ ffi (~> 1.0.9)
117
+ multi_json (~> 1.0.4)
118
+ rubyzip
119
+ sprockets (2.0.3)
120
+ hike (~> 1.2)
121
+ rack (~> 1.0)
122
+ tilt (~> 1.1, != 1.3.0)
123
+ sqlite3 (1.3.5)
124
+ thor (0.14.6)
125
+ tilt (1.3.3)
126
+ treetop (1.4.10)
127
+ polyglot
128
+ polyglot (>= 0.3.1)
129
+ tzinfo (0.3.31)
130
+ xpath (0.1.4)
131
+ nokogiri (~> 1.3)
132
+
133
+ PLATFORMS
134
+ ruby
135
+
136
+ DEPENDENCIES
137
+ appraisal (~> 0.4)
138
+ capybara (>= 0.4.0)
139
+ factory_girl_rails
140
+ mocha
141
+ pacecar!
142
+ rails (= 3.1.3)
143
+ rspec-rails (>= 2.4.0)
144
+ sqlite3
data/lib/pacecar.rb CHANGED
@@ -11,6 +11,7 @@ require 'pacecar/ranking'
11
11
  require 'pacecar/search'
12
12
  require 'pacecar/state'
13
13
  require 'pacecar/numeric'
14
+ require 'pacecar/version'
14
15
 
15
16
  module Pacecar
16
17
  def self.included(base)
@@ -38,7 +38,7 @@ module Pacecar
38
38
  end
39
39
 
40
40
  def numeric_column_names
41
- column_names_for_type :integer, :float
41
+ column_names_for_type :integer, :float, :decimal
42
42
  end
43
43
 
44
44
  protected
@@ -0,0 +1,3 @@
1
+ module Pacecar
2
+ VERSION = '1.5.3'.freeze
3
+ end
data/pacecar.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "pacecar/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'pacecar'
7
+ s.version = Pacecar::VERSION.dup
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Matt Jankowski', 'Gabe Berke-Williams', 'Chad Pytel', 'Ryan McGeary', 'Mike Burns', 'Ryan Sonnek', 'Thomas Dippel', 'Tristan Dunn']
10
+ s.email = 'support@thoughtbot.com'
11
+ s.homepage = 'http://github.com/thoughtbot/pacecar'
12
+ s.summary = 'Pacecar adds scope methods to ActiveRecord classes via database column introspection.'
13
+ s.description = 'Generated scopes for ActiveRecord classes.'
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_development_dependency("appraisal", "~> 0.4")
21
+ s.add_development_dependency("capybara", ">= 0.4.0")
22
+ s.add_development_dependency("mocha")
23
+ s.add_development_dependency("rspec-rails", ">= 2.4.0")
24
+ s.add_development_dependency("factory_girl_rails")
25
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Associations', 'has recent records' do
4
+
5
+ before do
6
+ @comment_user = Factory :user
7
+ @post_user = Factory :user
8
+ @both_user = Factory :user
9
+ Factory :comment, :user => @comment_user, :created_at => 10.days.ago
10
+ Factory :comment, :user => @comment_user, :created_at => 3.days.ago
11
+ Factory :post, :owner => @post_user, :created_at => 10.days.ago
12
+ Factory :post, :owner => @post_user, :created_at => 3.days.ago
13
+
14
+ Factory :comment, :user => @both_user, :created_at => 10.days.ago
15
+ Factory :comment, :user => @both_user, :created_at => 3.days.ago
16
+ Factory :post, :owner => @both_user, :created_at => 10.days.ago
17
+ Factory :post, :owner => @both_user, :created_at => 3.days.ago
18
+ end
19
+
20
+ it "should set the correct options for a recent methods for one association" do
21
+ User.recent_comments_since(5.days.ago).should == [@comment_user, @both_user]
22
+ end
23
+
24
+ it "should set the correct options for a recent methods combining associations with or" do
25
+ User.recent_posts_or_comments_since(5.days.ago).should == [@comment_user, @post_user, @both_user]
26
+ end
27
+
28
+ it "should set the correct options for a recent methods combining associations with and" do
29
+ User.recent_posts_and_comments_since(5.days.ago).should == [@both_user]
30
+ end
31
+
32
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Boolean' do
4
+
5
+ before do
6
+ @one = Factory :user, :admin => true
7
+ @two = Factory :user, :admin => true
8
+ @three = Factory :user, :admin => true
9
+ @four = Factory :user, :admin => false
10
+ @five = Factory :user, :admin => false
11
+ end
12
+
13
+ it "should set the correct expected values for a boolean column method" do
14
+ User.admin.should == [@one, @two, @three]
15
+ end
16
+
17
+ it "should set the correct expected values for a not_ boolean column method" do
18
+ User.not_admin.should == [@four, @five]
19
+ end
20
+
21
+ it "should return correct value for balance class method when true greater than false" do
22
+ User.admin_balance.should == 1
23
+ end
24
+
25
+ it "should return correct value for balance class method when true less than false" do
26
+ 3.times { Factory :user, :admin => false }
27
+ User.admin_balance.should == -2
28
+ end
29
+
30
+ end
@@ -0,0 +1,92 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Datetime' do
4
+
5
+ before do
6
+ date = DateTime.parse '2000-01-01'
7
+ @abe = Factory :user, :created_at => date, :rejected_at => date, :updated_at => date, :last_posted_on => date, :approved_at => date
8
+
9
+ date = DateTime.parse '2005-05-05'
10
+ @bob = Factory :user, :created_at => date, :rejected_at => date, :updated_at => date, :last_posted_on => date, :approved_at => date
11
+
12
+ date = DateTime.parse '2010-10-10'
13
+ @fox = Factory :user, :created_at => date, :rejected_at => date, :updated_at => date, :last_posted_on => date, :approved_at => date
14
+ end
15
+
16
+ [:created_at, :rejected_at, :updated_at, :last_posted_on, :approved_at].each do |column|
17
+ describe "before and after methods" do
18
+ it "should set the correct expected values for a #{column}_before method" do
19
+ date = DateTime.parse '2003-01-01'
20
+ User.send(:"#{column}_before", date).should == [@abe]
21
+ end
22
+
23
+ it "should set the correct expected values for a #{column}_after datetime column method" do
24
+ date = DateTime.parse '2007-01-01'
25
+ User.send(:"#{column}_after", date).should == [@fox]
26
+ end
27
+ end
28
+
29
+ describe "past and future methods" do
30
+ it "should set the correct expected values for a #{column}_in_past method without a zone default" do
31
+ Time.zone_default = nil
32
+ Time.zone_default.should == nil
33
+ now = DateTime.parse '2007-01-01'
34
+ User.stubs(:now).returns now
35
+ User.send(:"#{column}_in_past").should == [@abe, @bob]
36
+ end
37
+
38
+ it "should set the correct expected values for a #{column}_in_future datetime column method without a zone default" do
39
+ Time.zone_default = nil
40
+ Time.zone_default.should == nil
41
+ now = DateTime.parse '2007-01-01'
42
+ User.stubs(:now).returns now
43
+ User.send(:"#{column}_in_future").should == [@fox]
44
+ end
45
+
46
+ it "should set the correct expected values for a #{column}_in_past method given a zone_default" do
47
+ Time.zone_default = Time.respond_to?(:find_zone) ? Time.find_zone("UTC") : Time.__send__(:get_zone, "UTC")
48
+ now = DateTime.parse '2007-01-01'
49
+ Time.zone_default.stubs(:now).returns now
50
+ User.send(:"#{column}_in_past").should == [@abe, @bob]
51
+ Time.zone_default = nil
52
+ end
53
+
54
+ it "should set the correct expected values for a #{column}_in_future datetime column method given a zone_default" do
55
+ Time.zone_default = Time.respond_to?(:find_zone) ? Time.find_zone("UTC") : Time.__send__(:get_zone, "UTC")
56
+ now = DateTime.parse '2007-01-01'
57
+ Time.zone_default.stubs(:now).returns now
58
+ User.send(:"#{column}_in_future").should == [@fox]
59
+ Time.zone_default = nil
60
+ end
61
+ end
62
+
63
+ describe "inside and outside methods" do
64
+ it "should set the correct expected values for a #{column}_inside method" do
65
+ start = DateTime.parse '2003-01-01'
66
+ stop = DateTime.parse '2007-01-01'
67
+ User.send(:"#{column}_inside", start, stop).should == [@bob]
68
+ end
69
+
70
+ it "should set the correct expected values for a #{column}_outside method" do
71
+ start = DateTime.parse '2003-01-01'
72
+ stop = DateTime.parse '2007-01-01'
73
+ User.send(:"#{column}_outside", start, stop).should == [@abe, @fox]
74
+ end
75
+ end
76
+
77
+ describe "year month and day methods" do
78
+ it "should set the correct expected values for a #{column}_in_year method" do
79
+ User.send(:"#{column}_in_year", '2000').should == [@abe]
80
+ end
81
+
82
+ it "should set the correct expected values for a #{column}_in_month method" do
83
+ User.send(:"#{column}_in_month", '05').should == [@bob]
84
+ end
85
+
86
+ it "should set the correct expected values for a #{column}_in_day method" do
87
+ User.send(:"#{column}_in_day", '10').should == [@fox]
88
+ end
89
+ end
90
+ end
91
+
92
+ end