cia 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cia (0.2.1)
4
+ cia (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -1,6 +1,6 @@
1
1
  create_table :cia_transactions do |t|
2
- t.integer :actor_id, :null => false
3
- t.string :actor_type, :null => false
2
+ t.integer :actor_id
3
+ t.string :actor_type
4
4
  t.string :ip_address
5
5
  t.timestamp :created_at
6
6
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/cia
3
3
  specs:
4
- cia (0.2.0)
4
+ cia (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/cia
3
3
  specs:
4
- cia (0.2.0)
4
+ cia (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -14,5 +14,9 @@ module CIA
14
14
  end
15
15
 
16
16
  delegate :created_at, :to => :event
17
+
18
+ def self.on_attribute(attribute)
19
+ scoped(:conditions => {:attribute_name => attribute})
20
+ end
17
21
  end
18
22
  end
@@ -1,3 +1,3 @@
1
1
  module CIA
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -10,9 +10,18 @@ describe CIA::AttributeChange do
10
10
 
11
11
  describe ".previous" do
12
12
  it "finds by id desc" do
13
+ CIA::AttributeChange.delete_all
13
14
  a = create_change
14
15
  b = create_change
15
16
  CIA::AttributeChange.previous.should == [b,a]
16
17
  end
17
18
  end
19
+
20
+ describe ".on_attribute" do
21
+ it "finds with attribute" do
22
+ a = create_change :attribute_name => :xxx
23
+ b = create_change :attribute_name => :yyy
24
+ CIA::AttributeChange.on_attribute(:xxx).all.should == [a]
25
+ end
26
+ end
18
27
  end
@@ -55,7 +55,7 @@ def create_event
55
55
  CIA::UpdateEvent.create!(:source => Car.create!, :transaction => transaction)
56
56
  end
57
57
 
58
- def create_change
58
+ def create_change(options={})
59
59
  event = create_event
60
- CIA::AttributeChange.create!(:event => event, :source => event.source, :attribute_name => "bar")
60
+ CIA::AttributeChange.create!({:event => event, :source => event.source, :attribute_name => "bar"}.merge(options))
61
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-21 00:00:00.000000000 Z
12
+ date: 2012-06-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: michael@grosser.it
@@ -59,7 +59,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
59
  version: '0'
60
60
  segments:
61
61
  - 0
62
- hash: 562244213003532092
62
+ hash: -3438842526212601421
63
63
  required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  version: '0'
69
69
  segments:
70
70
  - 0
71
- hash: 562244213003532092
71
+ hash: -3438842526212601421
72
72
  requirements: []
73
73
  rubyforge_project:
74
74
  rubygems_version: 1.8.24