by_star 2.2.0 → 4.0.0

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.
Files changed (66) hide show
  1. checksums.yaml +5 -13
  2. data/.github/workflows/mysql.yml +92 -0
  3. data/.github/workflows/postgresql.yml +99 -0
  4. data/.gitignore +6 -5
  5. data/.travis.yml +92 -35
  6. data/CHANGELOG.md +59 -29
  7. data/Gemfile +18 -25
  8. data/MIT-LICENSE +20 -20
  9. data/README.md +616 -523
  10. data/Rakefile +18 -18
  11. data/UPGRADING +4 -12
  12. data/by_star.gemspec +34 -32
  13. data/cleaner.rb +24 -24
  14. data/lib/by_star/base.rb +69 -68
  15. data/lib/by_star/between.rb +185 -120
  16. data/lib/by_star/directional.rb +35 -21
  17. data/lib/by_star/kernel/date.rb +41 -0
  18. data/lib/by_star/kernel/in_time_zone.rb +20 -0
  19. data/lib/by_star/{kernel.rb → kernel/time.rb} +41 -41
  20. data/lib/by_star/normalization.rb +156 -118
  21. data/lib/by_star/orm/active_record/by_star.rb +75 -59
  22. data/lib/by_star/orm/mongoid/by_star.rb +90 -63
  23. data/lib/by_star/orm/mongoid/reorder.rb +23 -0
  24. data/lib/by_star/version.rb +3 -3
  25. data/lib/by_star.rb +18 -15
  26. data/spec/database.yml +15 -15
  27. data/spec/fixtures/active_record/models.rb +12 -10
  28. data/spec/fixtures/active_record/schema.rb +19 -19
  29. data/spec/fixtures/mongoid/models.rb +31 -29
  30. data/spec/fixtures/shared/seeds.rb +36 -26
  31. data/spec/gemfiles/Gemfile.rails +5 -0
  32. data/spec/gemfiles/Gemfile.rails32 +7 -0
  33. data/spec/gemfiles/Gemfile.rails40 +7 -0
  34. data/spec/gemfiles/Gemfile.rails41 +7 -0
  35. data/spec/gemfiles/Gemfile.rails42 +7 -0
  36. data/spec/gemfiles/Gemfile.rails50 +7 -0
  37. data/spec/gemfiles/Gemfile.rails51 +7 -0
  38. data/spec/gemfiles/Gemfile.rails52 +7 -0
  39. data/spec/gemfiles/Gemfile.rails60 +7 -0
  40. data/spec/gemfiles/Gemfile.rails61 +7 -0
  41. data/spec/integration/active_record/active_record_spec.rb +41 -53
  42. data/spec/integration/mongoid/mongoid_spec.rb +39 -46
  43. data/spec/integration/shared/at_time.rb +53 -0
  44. data/spec/integration/shared/between_dates.rb +99 -0
  45. data/spec/integration/shared/between_times.rb +99 -0
  46. data/spec/integration/shared/by_calendar_month.rb +55 -55
  47. data/spec/integration/shared/by_cweek.rb +54 -0
  48. data/spec/integration/shared/by_day.rb +120 -108
  49. data/spec/integration/shared/by_direction.rb +126 -114
  50. data/spec/integration/shared/by_fortnight.rb +48 -48
  51. data/spec/integration/shared/by_month.rb +50 -50
  52. data/spec/integration/shared/by_quarter.rb +49 -49
  53. data/spec/integration/shared/by_week.rb +54 -54
  54. data/spec/integration/shared/by_weekend.rb +49 -49
  55. data/spec/integration/shared/by_year.rb +48 -48
  56. data/spec/integration/shared/index_scope_parameter.rb +111 -0
  57. data/spec/integration/shared/offset_parameter.rb +32 -31
  58. data/spec/integration/shared/order_parameter.rb +36 -0
  59. data/spec/integration/shared/relative.rb +174 -174
  60. data/spec/spec_helper.rb +33 -29
  61. data/spec/unit/kernel_date_spec.rb +113 -0
  62. data/spec/unit/kernel_time_spec.rb +57 -57
  63. data/spec/unit/normalization_spec.rb +384 -255
  64. data/tmp/.gitignore +1 -1
  65. metadata +82 -68
  66. data/spec/integration/shared/scope_parameter.rb +0 -42
@@ -1,63 +1,90 @@
1
- # In keeping with Mongoid standards, this module must be included into your model class, i.e.
2
- #
3
- # include Mongoid::ByStar
4
- #
5
- module Mongoid
6
- module ByStar
7
- extend ActiveSupport::Concern
8
-
9
- module ClassMethods
10
- include ::ByStar::Base
11
-
12
- def between_times_query(start, finish, options={})
13
- start_field = by_star_start_field(options)
14
- end_field = by_star_end_field(options)
15
-
16
- scope = by_star_scope(options)
17
- scope = if options[:strict] || start_field == end_field
18
- scope.gte(start_field => start).lte(end_field => finish)
19
- else
20
- scope.gt(end_field => start).lt(start_field => finish)
21
- end
22
- scope = scope.order_by(field => options[:order]) if options[:order]
23
- scope
24
- end
25
-
26
- def by_star_end_field_with_mongoid(options = {})
27
- database_field_name by_star_end_field_without_mongoid(options)
28
- end
29
- alias_method_chain :by_star_end_field, :mongoid
30
-
31
- def by_star_start_field_with_mongoid(options = {})
32
- database_field_name by_star_start_field_without_mongoid(options)
33
- end
34
- alias_method_chain :by_star_start_field, :mongoid
35
-
36
- protected
37
-
38
- def by_star_default_field
39
- :created_at
40
- end
41
-
42
- def before_query(time, options={})
43
- field = by_star_start_field(options)
44
- by_star_scope(options).lte(field => time)
45
- end
46
-
47
- def after_query(time, options={})
48
- field = by_star_start_field(options)
49
- by_star_scope(options).gte(field => time)
50
- end
51
- end
52
-
53
- def previous(options={})
54
- field = self.class.by_star_start_field
55
- self.class.by_star_scope(options).lt(field => self.send(field)).desc(field).first
56
- end
57
-
58
- def next(options={})
59
- field = self.class.by_star_start_field
60
- self.class.by_star_scope(options).gt(field => self.send(field)).asc(field).first
61
- end
62
- end
63
- end
1
+ # In keeping with Mongoid standards, this module must be included into your model class, i.e.
2
+ #
3
+ # include Mongoid::ByStar
4
+ #
5
+ module Mongoid
6
+ module ByStar
7
+ extend ActiveSupport::Concern
8
+
9
+ module ClassMethods
10
+ include ::ByStar::Base
11
+
12
+ alias_method :original_by_star_end_field, :by_star_end_field
13
+ alias_method :original_by_star_start_field, :by_star_start_field
14
+
15
+ def by_star_end_field(options = {})
16
+ database_field_name original_by_star_end_field(options)
17
+ end
18
+
19
+ def by_star_start_field(options = {})
20
+ database_field_name original_by_star_start_field(options)
21
+ end
22
+
23
+ def by_star_default_field
24
+ :created_at
25
+ end
26
+
27
+ protected
28
+
29
+ def by_star_point_query(scope, field, start_time, end_time)
30
+ range = start_time..end_time
31
+ scope.where(field => range)
32
+ end
33
+
34
+ def by_star_span_strict_query(scope, start_field, end_field, start_time, end_time)
35
+ range = start_time..end_time
36
+ scope.where(start_field => range).where(end_field => range)
37
+ end
38
+
39
+ def by_star_span_loose_query(scope, start_field, end_field, start_time, end_time, options)
40
+ index_scope = by_star_eval_index_scope(start_time, end_time, options)
41
+ scope = scope.gt(end_field => start_time).lt(start_field => end_time)
42
+ scope = scope.gte(start_field => index_scope) if index_scope
43
+ scope
44
+ end
45
+
46
+ def by_star_point_overlap_query(scope, field, time)
47
+ scope.where(field => time)
48
+ end
49
+
50
+ def by_star_span_overlap_query(scope, start_field, end_field, time, options)
51
+ index_scope = by_star_eval_index_scope(time, time, options)
52
+ scope = scope.gt(end_field => time).lte(start_field => time)
53
+ scope = scope.gte(start_field => index_scope) if index_scope
54
+ scope
55
+ end
56
+
57
+ def by_star_before_query(scope, field, time)
58
+ scope.lte(field => time)
59
+ end
60
+
61
+ def by_star_after_query(scope, field, time)
62
+ scope.gte(field => time)
63
+ end
64
+
65
+ def by_star_order(scope, order)
66
+ scope.order_by(order)
67
+ end
68
+
69
+ def oldest_query(options={})
70
+ field = by_star_start_field(options)
71
+ all.reorder(field => :asc).first
72
+ end
73
+
74
+ def newest_query(options={})
75
+ field = by_star_start_field(options)
76
+ all.reorder(field => :desc).first
77
+ end
78
+ end
79
+
80
+ def previous(options={})
81
+ field = self.class.by_star_start_field(options)
82
+ self.class.lt(field => self.send(field)).reorder(field => :desc).first
83
+ end
84
+
85
+ def next(options={})
86
+ field = self.class.by_star_start_field(options)
87
+ self.class.gt(field => self.send(field)).reorder(field => :asc).first
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,23 @@
1
+ # Backport of `reorder` method from Origin 2.1.0+
2
+ if defined?(Origin::Optional) && !Origin::Optional.method_defined?(:reorder)
3
+ module Origin
4
+ module Optional
5
+
6
+ # Instead of merging the order criteria, use this method to completely
7
+ # replace the existing ordering with the provided.
8
+ #
9
+ # @example Replace the ordering.
10
+ # optional.reorder(name: :asc)
11
+ #
12
+ # @param [ Array, Hash, String ] spec The sorting specification.
13
+ #
14
+ # @return [ Optional ] The cloned optional.
15
+ #
16
+ # @since 2.1.0
17
+ def reorder(*spec)
18
+ options.delete(:sort)
19
+ order_by(*spec)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
- module ByStar
2
- VERSION = '2.2.0'
3
- end
1
+ module ByStar
2
+ VERSION = '4.0.0'
3
+ end
data/lib/by_star.rb CHANGED
@@ -1,15 +1,18 @@
1
- require 'by_star/kernel'
2
- require 'by_star/normalization'
3
- require 'by_star/between'
4
- require 'by_star/directional'
5
- require 'by_star/base'
6
-
7
- if defined?(ActiveRecord)
8
- require 'by_star/orm/active_record/by_star'
9
- ActiveRecord::Base.send :include, ByStar::ActiveRecord
10
- ActiveRecord::Relation.send :extend, ByStar::ActiveRecord::ClassMethods
11
- end
12
-
13
- if defined?(Mongoid)
14
- require 'by_star/orm/mongoid/by_star'
15
- end
1
+ require 'by_star/kernel/in_time_zone'
2
+ require 'by_star/kernel/time'
3
+ require 'by_star/kernel/date'
4
+ require 'by_star/normalization'
5
+ require 'by_star/between'
6
+ require 'by_star/directional'
7
+ require 'by_star/base'
8
+
9
+ if defined?(ActiveRecord)
10
+ require 'by_star/orm/active_record/by_star'
11
+ ActiveRecord::Base.send :include, ByStar::ActiveRecord
12
+ ActiveRecord::Relation.send :extend, ByStar::ActiveRecord::ClassMethods
13
+ end
14
+
15
+ if defined?(Mongoid)
16
+ require 'by_star/orm/mongoid/reorder'
17
+ require 'by_star/orm/mongoid/by_star'
18
+ end
data/spec/database.yml CHANGED
@@ -1,15 +1,15 @@
1
- sqlite:
2
- adapter: sqlite3
3
- database: by_star.sqlite3
4
-
5
- postgres:
6
- adapter: postgresql
7
- database: by_star_test
8
- username: postgres
9
- min_messages: warning
10
-
11
- mysql:
12
- adapter: mysql2
13
- database: by_star_test
14
- username: root
15
- encoding: utf8
1
+ sqlite:
2
+ adapter: sqlite3
3
+ database: by_star.sqlite3
4
+
5
+ postgres:
6
+ adapter: postgresql
7
+ database: by_star_test
8
+ username: <%= ENV.fetch("USER") || "postgres" %>
9
+ min_messages: warning
10
+
11
+ mysql:
12
+ adapter: mysql2
13
+ database: by_star_test
14
+ username: root
15
+ encoding: utf8
@@ -1,10 +1,12 @@
1
- class Post < ActiveRecord::Base
2
- end
3
-
4
- class Appointment < ActiveRecord::Base
5
- by_star_field scope: ->{ where(day_of_month: 1) }
6
- end
7
-
8
- class Event < ActiveRecord::Base
9
- by_star_field :start_time, :end_time, offset: 3.hours
10
- end
1
+ class Post < ActiveRecord::Base
2
+ end
3
+
4
+ class Appointment < ActiveRecord::Base
5
+ by_star_field index_scope: ->(start){ start - 5.days }
6
+ end
7
+
8
+ class Event < ActiveRecord::Base
9
+ by_star_field :start_time, :end_time, offset: 3.hours
10
+
11
+ default_scope ->{ order('day_of_month ASC') }
12
+ end
@@ -1,19 +1,19 @@
1
- ActiveRecord::Schema.define do
2
- self.verbose = false
3
-
4
- create_table :posts, :force => true do |t|
5
- t.timestamps
6
- t.integer :day_of_month
7
- end
8
-
9
- create_table :events, :force => true do |t|
10
- t.timestamps
11
- t.datetime :start_time, :end_time
12
- t.integer :day_of_month
13
- end
14
-
15
- create_table :appointments, :force => true do |t|
16
- t.timestamps
17
- t.integer :day_of_month
18
- end
19
- end
1
+ ActiveRecord::Schema.define do
2
+ self.verbose = false
3
+
4
+ create_table :posts, force: true do |t|
5
+ t.timestamps
6
+ t.integer :day_of_month
7
+ end
8
+
9
+ create_table :events, force: true do |t|
10
+ t.timestamps
11
+ t.datetime :start_time, :end_time
12
+ t.integer :day_of_month
13
+ end
14
+
15
+ create_table :appointments, force: true do |t|
16
+ t.timestamps
17
+ t.integer :day_of_month
18
+ end
19
+ end
@@ -1,29 +1,31 @@
1
- class Post
2
- include Mongoid::Document
3
- include Mongoid::Timestamps
4
- include Mongoid::ByStar
5
-
6
- field :day_of_month, type: Integer
7
- end
8
-
9
- class Appointment
10
- include Mongoid::Document
11
- include Mongoid::Timestamps
12
- include Mongoid::ByStar
13
-
14
- field :day_of_month, type: Integer
15
-
16
- by_star_field scope: ->{ where(day_of_month: 1) }
17
- end
18
-
19
- class Event
20
- include Mongoid::Document
21
- include Mongoid::Timestamps
22
- include Mongoid::ByStar
23
-
24
- field :st, as: :start_time, type: Time
25
- field :end_time, type: Time
26
- field :day_of_month, type: Integer
27
-
28
- by_star_field :start_time, :end_time, offset: 3.hours
29
- end
1
+ class Post
2
+ include Mongoid::Document
3
+ include Mongoid::Timestamps
4
+ include Mongoid::ByStar
5
+
6
+ field :day_of_month, type: Integer
7
+ end
8
+
9
+ class Appointment
10
+ include Mongoid::Document
11
+ include Mongoid::Timestamps
12
+ include Mongoid::ByStar
13
+
14
+ field :day_of_month, type: Integer
15
+
16
+ by_star_field index_scope: ->(start){ start - 5.days }
17
+ end
18
+
19
+ class Event
20
+ include Mongoid::Document
21
+ include Mongoid::Timestamps
22
+ include Mongoid::ByStar
23
+
24
+ field :st, as: :start_time, type: Time
25
+ field :end_time, type: Time
26
+ field :day_of_month, type: Integer
27
+
28
+ by_star_field :start_time, :end_time, offset: 3.hours
29
+
30
+ default_scope ->{ order_by(day_of_month: :asc) }
31
+ end
@@ -1,26 +1,36 @@
1
- %w(2013-11-01
2
- 2013-11-30
3
- 2013-12-01
4
- 2013-12-05
5
- 2013-12-08
6
- 2013-12-16
7
- 2013-12-22
8
- 2013-12-25
9
- 2013-12-28
10
- 2013-12-31
11
- 2014-01-01
12
- 2014-01-01
13
- 2014-01-05
14
- 2014-01-10
15
- 2014-01-12
16
- 2014-01-20
17
- 2014-02-01
18
- 2014-02-15
19
- 2014-03-01
20
- 2014-03-15
21
- 2014-04-01
22
- 2014-04-15).map{|d| Time.zone.parse(d) + 17.hours }.each do |d|
23
- Post.create!(:created_at => d, day_of_month: d.day)
24
- Appointment.create!(:created_at => d, day_of_month: d.day)
25
- Event.create!(:created_at => d, :start_time => d - 5.days, :end_time => d + 5.days, day_of_month: d.day)
26
- end
1
+ %w(2013-11-01
2
+ 2013-11-30
3
+ 2013-12-01
4
+ 2013-12-05
5
+ 2013-12-08
6
+ 2013-12-16
7
+ 2013-12-22
8
+ 2013-12-25
9
+ 2013-12-28
10
+ 2013-12-31
11
+ 2014-01-01
12
+ 2014-01-01
13
+ 2014-01-05
14
+ 2014-01-10
15
+ 2014-01-12
16
+ 2014-01-20
17
+ 2014-02-01
18
+ 2014-02-15
19
+ 2014-03-01
20
+ 2014-03-15
21
+ 2014-04-01
22
+ 2014-04-15).map{|d| Time.zone.parse(d) + 17.hours }.each_with_index do |d, index|
23
+ Post.create!(created_at: d, updated_at: d + index.days, day_of_month: d.day)
24
+ Appointment.create!(created_at: d, day_of_month: d.day)
25
+ Event.create!(created_at: d, start_time: d - 5.days, end_time: d + 5.days, day_of_month: d.day)
26
+ end
27
+
28
+ # Sydney timezone specific records
29
+ %w(
30
+ 2020-04-05
31
+ 2020-10-04
32
+ ).map{|d| Date.parse(d) }.each do |d|
33
+ [1, 4, 5, 10].each do |h|
34
+ Event.create!(start_time: d + h.hour, end_time: d + h.hour + 30.minutes, created_at: Date.parse('2011-01-01').in_time_zone)
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec path: '../../'
4
+
5
+ gem 'activerecord', github: 'rails', branch: "main"
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec path: '../../'
4
+
5
+ gem 'activerecord', '~> 3.2.0'
6
+ gem 'pg', '~> 0.11'
7
+ gem 'mongoid'
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec path: '../../'
4
+
5
+ gem 'activerecord', '~> 4.0.0'
6
+ gem 'pg', '~> 0.11'
7
+ gem 'mongoid'
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec path: '../../'
4
+
5
+ gem 'activerecord', '~> 4.1.0'
6
+ gem 'pg', '~> 0.11'
7
+ gem 'mongoid'
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec path: '../../'
4
+
5
+ gem 'activerecord', '~> 4.2.0'
6
+ gem 'pg', '~> 0.15'
7
+ gem 'mongoid'
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec path: '../../'
4
+
5
+ gem 'activerecord', '~> 5.0.0'
6
+ gem 'pg', '~> 0.18'
7
+ gem 'mongoid'
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec path: '../../'
4
+
5
+ gem 'activerecord', '~> 5.1.0'
6
+ gem 'pg', '~> 0.18'
7
+ gem 'mongoid'
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec path: '../../'
4
+
5
+ gem 'activerecord', '~> 5.2.0'
6
+ gem 'pg', '~> 0.18'
7
+ gem 'mongoid'
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec path: '../../'
4
+
5
+ gem 'activerecord', '~> 6.0'
6
+ gem 'pg'
7
+ gem 'mongoid'
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec path: '../../'
4
+
5
+ gem 'activerecord', '~> 6.1'
6
+ gem 'pg'
7
+ gem 'mongoid'
@@ -1,53 +1,41 @@
1
- require 'spec_helper'
2
- Dir[File.dirname(__FILE__) + '/../shared/*.rb'].each {|file| require file }
3
-
4
- describe ActiveRecord do
5
- before(:all) do
6
- ActiveRecord::Base.default_timezone = :utc
7
- # ActiveRecord::Base.logger = Logger.new(STDOUT)
8
-
9
- db_config = YAML::load_file(File.dirname(__FILE__) + '/../../database.yml')
10
- if db_config.has_key?('sqlite') && db_config['sqlite'].has_key?('database')
11
- db_config['sqlite']['database'] = File.dirname(__FILE__) + '/../../tmp/' + db_config['sqlite']['database']
12
- end
13
-
14
- ActiveRecord::Base.configurations = db_config
15
- ActiveRecord::Base.establish_connection(ENV['DB'] || 'sqlite')
16
- load File.dirname(__FILE__) + '/../../fixtures/active_record/schema.rb'
17
- load File.dirname(__FILE__) + '/../../fixtures/active_record/models.rb'
18
- load File.dirname(__FILE__) + '/../../fixtures/shared/seeds.rb'
19
-
20
- ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/../../tmp/activerecord.log')
21
- end
22
-
23
- it_behaves_like 'by day'
24
- it_behaves_like 'by direction'
25
- it_behaves_like 'by fortnight'
26
- it_behaves_like 'by month'
27
- it_behaves_like 'by calendar month'
28
- it_behaves_like 'by quarter'
29
- it_behaves_like 'by week'
30
- it_behaves_like 'by weekend'
31
- it_behaves_like 'by year'
32
- it_behaves_like 'relative'
33
- it_behaves_like 'offset parameter'
34
- it_behaves_like 'scope parameter'
35
-
36
- it 'should be able to order the result set' do
37
- scope = Post.by_year(Time.zone.now.year, :order => 'created_at DESC')
38
- scope.order_values.should == ['created_at DESC']
39
- end
40
-
41
- describe '#between_times' do
42
- subject { Post.between_times(Time.parse('2014-01-01'), Time.parse('2014-01-06')) }
43
- it { should be_a(ActiveRecord::Relation) }
44
- its(:count) { should eq 3 }
45
- end
46
-
47
- describe '#between' do
48
- subject { Post.between(Time.parse('2014-01-01'), Time.parse('2014-01-06')) }
49
- it 'should be an alias of #between_times' do
50
- subject.count.should eq 3
51
- end
52
- end
53
- end if testing_active_record?
1
+ require 'spec_helper'
2
+ Dir[File.dirname(__FILE__) + '/../shared/*.rb'].each {|file| require file }
3
+
4
+ describe ActiveRecord do
5
+ before(:all) do
6
+ ActiveRecord::Base.default_timezone = :utc
7
+ # ActiveRecord::Base.logger = Logger.new(STDOUT)
8
+ database_file = File.dirname(__FILE__) + '/../../database.yml'
9
+ parsed_config = ERB.new(File.read(database_file)).result
10
+ db_config = YAML.safe_load(parsed_config)
11
+ if db_config.has_key?('sqlite') && db_config['sqlite'].has_key?('database')
12
+ db_config['sqlite']['database'] = File.dirname(__FILE__) + '/../../tmp/' + db_config['sqlite']['database']
13
+ end
14
+
15
+ ActiveRecord::Base.configurations = db_config
16
+ ActiveRecord::Base.establish_connection(ENV['DB'].try(:to_sym) || :sqlite)
17
+ load File.dirname(__FILE__) + '/../../fixtures/active_record/schema.rb'
18
+ load File.dirname(__FILE__) + '/../../fixtures/active_record/models.rb'
19
+ load File.dirname(__FILE__) + '/../../fixtures/shared/seeds.rb'
20
+
21
+ ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/../../tmp/activerecord.log')
22
+ end
23
+
24
+ it_behaves_like 'between_times'
25
+ it_behaves_like 'between_dates'
26
+ it_behaves_like 'at_time'
27
+ it_behaves_like 'offset parameter'
28
+ it_behaves_like 'order parameter'
29
+ it_behaves_like 'index_scope parameter'
30
+ it_behaves_like 'by day'
31
+ it_behaves_like 'by direction'
32
+ it_behaves_like 'by fortnight'
33
+ it_behaves_like 'by month'
34
+ it_behaves_like 'by calendar month'
35
+ it_behaves_like 'by quarter'
36
+ it_behaves_like 'by week'
37
+ it_behaves_like 'by cweek'
38
+ it_behaves_like 'by weekend'
39
+ it_behaves_like 'by year'
40
+ it_behaves_like 'relative'
41
+ end if testing_active_record?