attribute_changer 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,6 +18,13 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
+ Create and run migration:
22
+
23
+ rails g attribute_changer
24
+ rake db:migrate
25
+
26
+ Example usage:
27
+
21
28
  class Dummy < ActiveRecord::Base
22
29
  include AttributeChanger::Allower
23
30
 
@@ -1,3 +1,3 @@
1
1
  module AttributeChanger
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -39,4 +39,36 @@ describe AttributeChanger::AttributeChange do
39
39
  it "returns dependent attributes"
40
40
  end
41
41
  end
42
+
43
+ describe "after create" do
44
+ describe "changing status" do
45
+ context "changing the same object" do
46
+ context "changing the same attribute" do
47
+ it "changes status to obsolete" do
48
+ change1 = FactoryGirl.create :attribute_change
49
+ change2 = FactoryGirl.create :attribute_change, obj: change1.obj, value: 'Jane'
50
+ change1.reload.status.should == 'obsolete'
51
+ end
52
+ end
53
+
54
+ context "changing different attributes" do
55
+ it "does not change status of previous different attribute's change" do
56
+ change1 = FactoryGirl.create :attribute_change
57
+ change2 = FactoryGirl.create :attribute_change, obj: change1.obj, attrib: 'last_name', value: 'Jane'
58
+ change1.reload.status.should == 'pending'
59
+ end
60
+ end
61
+ end
62
+
63
+ context "changing different objects" do
64
+ context "changing the same attribute" do
65
+ it "does not change status" do
66
+ change1 = FactoryGirl.create :attribute_change
67
+ change2 = FactoryGirl.create :attribute_change
68
+ change1.reload.status.should == 'pending'
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
42
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attribute_changer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.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: 2013-05-09 00:00:00.000000000 Z
12
+ date: 2013-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -199,12 +199,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
199
199
  - - ! '>='
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
+ segments:
203
+ - 0
204
+ hash: 1739398993112188867
202
205
  required_rubygems_version: !ruby/object:Gem::Requirement
203
206
  none: false
204
207
  requirements:
205
208
  - - ! '>='
206
209
  - !ruby/object:Gem::Version
207
210
  version: '0'
211
+ segments:
212
+ - 0
213
+ hash: 1739398993112188867
208
214
  requirements: []
209
215
  rubyforge_project:
210
216
  rubygems_version: 1.8.24