acts_as_historical 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_historical}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["hasclass"]
12
- s.date = %q{2010-02-19}
12
+ s.date = %q{2010-02-22}
13
13
  s.description = %q{}
14
14
  s.email = %q{sebastian.burkhard@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -24,12 +24,13 @@ module ActsAsHistorical
24
24
  send :extend, DynamicClassMethods
25
25
 
26
26
  self.cattr_accessor :historical_date_col, :historical_scope, :only_weekdays
27
- self.historical_date_col = 'snapshot_date' #configuration[:date_column]
27
+
28
+ self.historical_date_col = configuration[:date_column]
28
29
  self.historical_scope = configuration[:scope]
29
-
30
+
30
31
  order_desc = "#{self.historical_date_col_sql} DESC"
31
32
  order_asc = "#{self.historical_date_col_sql} ASC"
32
-
33
+
33
34
  # named_scopes - sortings
34
35
  named_scope :asc, :order => order_asc
35
36
  named_scope :desc, :order => order_desc
@@ -17,6 +17,12 @@ class ActsAsHistoricalTest < ActiveSupport::TestCase
17
17
  assert_equal Record.create(:snapshot_date => date).to_date, date
18
18
  end
19
19
 
20
+ context "Record" do
21
+ should "have default date = snapshot_date" do
22
+ assert_equal 'snapshot_date', Record.historical_date_col
23
+ end
24
+ end
25
+
20
26
  context 'named_scopes with 5 weekdays' do
21
27
  setup {
22
28
  Record.delete_all
@@ -37,6 +43,18 @@ class ActsAsHistoricalTest < ActiveSupport::TestCase
37
43
  assert_equal 5, Record.count
38
44
  end
39
45
 
46
+ context "newest" do
47
+ should "be friday" do
48
+ assert_equal @r_fri, Record.newest.first
49
+ end
50
+ end
51
+
52
+ context "oldest" do
53
+ should "be monday" do
54
+ assert_equal @r_mon, Record.oldest.first
55
+ end
56
+ end
57
+
40
58
  context "upto" do
41
59
  should "return records upto date excluding date" do
42
60
  assert Record.upto(@tue).include?(@r_mon)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_historical
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hasclass
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-19 00:00:00 +01:00
12
+ date: 2010-02-22 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency