acts-as-taggable-on-simonwh 2.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,113 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "acts_as_tagger" do
4
+ before(:each) do
5
+ clean_database!
6
+ end
7
+
8
+ context "Tagger Method Generation" do
9
+ before(:each) do
10
+ @tagger = TaggableUser.new()
11
+ end
12
+
13
+ it "should add #is_tagger? query method to the class-side" do
14
+ TaggableUser.should respond_to(:is_tagger?)
15
+ end
16
+
17
+ it "should return true from the class-side #is_tagger?" do
18
+ TaggableUser.is_tagger?.should be_true
19
+ end
20
+
21
+ it "should return false from the base #is_tagger?" do
22
+ ActiveRecord::Base.is_tagger?.should be_false
23
+ end
24
+
25
+ it "should add #is_tagger? query method to the singleton" do
26
+ @tagger.should respond_to(:is_tagger?)
27
+ end
28
+
29
+ it "should add #tag method on the instance-side" do
30
+ @tagger.should respond_to(:tag)
31
+ end
32
+
33
+ it "should generate an association for #owned_taggings and #owned_tags" do
34
+ @tagger.should respond_to(:owned_taggings, :owned_tags)
35
+ end
36
+ end
37
+
38
+ describe "#tag" do
39
+ context 'when called with a non-existent tag context' do
40
+ before(:each) do
41
+ @tagger = TaggableUser.new()
42
+ @taggable = TaggableModel.new(:name=>"Richard Prior")
43
+ end
44
+
45
+ it "should by default not throw an exception " do
46
+ @taggable.tag_list_on(:foo).should be_empty
47
+ lambda {
48
+ @tagger.tag(@taggable, :with=>'this, and, that', :on=>:foo)
49
+ }.should_not raise_error
50
+ end
51
+
52
+ it 'should by default create the tag context on-the-fly' do
53
+ @taggable.tag_list_on(:here_ond_now).should be_empty
54
+ @tagger.tag(@taggable, :with=>'that', :on => :here_ond_now)
55
+ @taggable.tag_list_on(:here_ond_now).should_not include('that')
56
+ @taggable.all_tags_list_on(:here_ond_now).should include('that')
57
+ end
58
+
59
+ it "should show all the tag list when both public and owned tags exist" do
60
+ @taggable.tag_list = 'ruby, python'
61
+ @tagger.tag(@taggable, :with => 'java, lisp', :on => :tags)
62
+ @taggable.all_tags_on(:tags).map(&:name).sort.should == %w(ruby python java lisp).sort
63
+ end
64
+
65
+ it "should not add owned tags to the common list" do
66
+ @taggable.tag_list = 'ruby, python'
67
+ @tagger.tag(@taggable, :with => 'java, lisp', :on => :foo)
68
+ @tagger.tag(@taggable, :with => '', :on => :foo)
69
+ @taggable.tag_list.should == %w(ruby python)
70
+ end
71
+
72
+ it "should throw an exception when the default is over-ridden" do
73
+ @taggable.tag_list_on(:foo_boo).should be_empty
74
+ lambda {
75
+ @tagger.tag(@taggable, :with=>'this, and, that', :on=>:foo_boo, :force=>false)
76
+ }.should raise_error
77
+ end
78
+
79
+ it "should not create the tag context on-the-fly when the default is over-ridden" do
80
+ @taggable.tag_list_on(:foo_boo).should be_empty
81
+ @tagger.tag(@taggable, :with=>'this, and, that', :on=>:foo_boo, :force=>false) rescue
82
+ @taggable.tag_list_on(:foo_boo).should be_empty
83
+ end
84
+ end
85
+
86
+ context "when called by multiple tagger's" do
87
+ before(:each) do
88
+ @user_x = TaggableUser.create(:name => "User X")
89
+ @user_y = TaggableUser.create(:name => "User Y")
90
+ @taggable = TaggableModel.create(:name => 'acts_as_taggable_on', :tag_list => 'plugin')
91
+
92
+ @user_x.tag(@taggable, :with => 'ruby, rails', :on => :tags)
93
+ @user_y.tag(@taggable, :with => 'ruby, plugin', :on => :tags)
94
+
95
+ @user_y.tag(@taggable, :with => '', :on => :tags)
96
+ @user_y.tag(@taggable, :with => '', :on => :tags)
97
+ end
98
+
99
+ it "should delete owned tags" do
100
+ @user_y.owned_tags.should == []
101
+ end
102
+
103
+ it "should not delete other taggers tags" do
104
+ @user_x.owned_tags.should have(2).items
105
+ end
106
+
107
+ it "should not delete original tags" do
108
+ @taggable.all_tags_list_on(:tags).should include('plugin')
109
+ end
110
+ end
111
+ end
112
+
113
+ end
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "Group Helper" do
4
+ before(:each) do
5
+ clean_database!
6
+ end
7
+
8
+ describe "grouped_column_names_for method" do
9
+ before(:each) do
10
+ @taggable = TaggableModel.new(:name => "Bob Jones")
11
+ end
12
+
13
+ it "should return all column names joined for Tag GROUP clause" do
14
+ @taggable.grouped_column_names_for(Tag).should == "tags.id, tags.name"
15
+ end
16
+
17
+ it "should return all column names joined for TaggableModel GROUP clause" do
18
+ @taggable.grouped_column_names_for(TaggableModel).should == "taggable_models.id, taggable_models.name, taggable_models.type"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,70 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe TagList do
4
+ before(:each) do
5
+ @tag_list = TagList.new("awesome","radical")
6
+ end
7
+
8
+ it "should be an array" do
9
+ @tag_list.is_a?(Array).should be_true
10
+ end
11
+
12
+ it "should be able to be add a new tag word" do
13
+ @tag_list.add("cool")
14
+ @tag_list.include?("cool").should be_true
15
+ end
16
+
17
+ it "should be able to add delimited lists of words" do
18
+ @tag_list.add("cool, wicked", :parse => true)
19
+ @tag_list.include?("cool").should be_true
20
+ @tag_list.include?("wicked").should be_true
21
+ end
22
+
23
+ it "should be able to add delimited list of words with quoted delimiters" do
24
+ @tag_list.add("'cool, wicked', \"really cool, really wicked\"", :parse => true)
25
+ @tag_list.include?("cool, wicked").should be_true
26
+ @tag_list.include?("really cool, really wicked").should be_true
27
+ end
28
+
29
+ it "should be able to handle other uses of quotation marks correctly" do
30
+ @tag_list.add("john's cool car, mary's wicked toy", :parse => true)
31
+ @tag_list.include?("john's cool car").should be_true
32
+ @tag_list.include?("mary's wicked toy").should be_true
33
+ end
34
+
35
+ it "should be able to add an array of words" do
36
+ @tag_list.add(["cool", "wicked"], :parse => true)
37
+ @tag_list.include?("cool").should be_true
38
+ @tag_list.include?("wicked").should be_true
39
+ end
40
+
41
+ it "should be able to remove words" do
42
+ @tag_list.remove("awesome")
43
+ @tag_list.include?("awesome").should be_false
44
+ end
45
+
46
+ it "should be able to remove delimited lists of words" do
47
+ @tag_list.remove("awesome, radical", :parse => true)
48
+ @tag_list.should be_empty
49
+ end
50
+
51
+ it "should be able to remove an array of words" do
52
+ @tag_list.remove(["awesome", "radical"], :parse => true)
53
+ @tag_list.should be_empty
54
+ end
55
+
56
+ it "should give a delimited list of words when converted to string" do
57
+ @tag_list.to_s.should == "awesome, radical"
58
+ end
59
+
60
+ it "should quote escape tags with commas in them" do
61
+ @tag_list.add("cool","rad,bodacious")
62
+ @tag_list.to_s.should == "awesome, radical, cool, \"rad,bodacious\""
63
+ end
64
+
65
+ it "should be able to call to_s on a frozen tag list" do
66
+ @tag_list.freeze
67
+ lambda { @tag_list.add("cool","rad,bodacious") }.should raise_error
68
+ lambda { @tag_list.to_s }.should_not raise_error
69
+ end
70
+ end
@@ -0,0 +1,104 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Tag do
4
+ before(:each) do
5
+ clean_database!
6
+ @tag = Tag.new
7
+ @user = TaggableModel.create(:name => "Pablo")
8
+ end
9
+
10
+ describe "named like any" do
11
+ before(:each) do
12
+ Tag.create(:name => "awesome")
13
+ Tag.create(:name => "epic")
14
+ end
15
+
16
+ it "should find both tags" do
17
+ Tag.named_like_any(["awesome", "epic"]).should have(2).items
18
+ end
19
+ end
20
+
21
+ describe "find or create by name" do
22
+ before(:each) do
23
+ @tag.name = "awesome"
24
+ @tag.save
25
+ end
26
+
27
+ it "should find by name" do
28
+ Tag.find_or_create_with_like_by_name("awesome").should == @tag
29
+ end
30
+
31
+ it "should find by name case insensitive" do
32
+ Tag.find_or_create_with_like_by_name("AWESOME").should == @tag
33
+ end
34
+
35
+ it "should create by name" do
36
+ lambda {
37
+ Tag.find_or_create_with_like_by_name("epic")
38
+ }.should change(Tag, :count).by(1)
39
+ end
40
+ end
41
+
42
+ describe "find or create all by any name" do
43
+ before(:each) do
44
+ @tag.name = "awesome"
45
+ @tag.save
46
+ end
47
+
48
+ it "should find by name" do
49
+ Tag.find_or_create_all_with_like_by_name("awesome").should == [@tag]
50
+ end
51
+
52
+ it "should find by name case insensitive" do
53
+ Tag.find_or_create_all_with_like_by_name("AWESOME").should == [@tag]
54
+ end
55
+
56
+ it "should create by name" do
57
+ lambda {
58
+ Tag.find_or_create_all_with_like_by_name("epic")
59
+ }.should change(Tag, :count).by(1)
60
+ end
61
+
62
+ it "should find or create by name" do
63
+ lambda {
64
+ Tag.find_or_create_all_with_like_by_name("awesome", "epic").map(&:name).should == ["awesome", "epic"]
65
+ }.should change(Tag, :count).by(1)
66
+ end
67
+
68
+ it "should return an empty array if no tags are specified" do
69
+ Tag.find_or_create_all_with_like_by_name([]).should == []
70
+ end
71
+ end
72
+
73
+ it "should require a name" do
74
+ @tag.valid?
75
+ @tag.errors[:name].should == ["can't be blank"]
76
+ @tag.name = "something"
77
+ @tag.valid?
78
+ @tag.errors[:name].should == []
79
+ end
80
+
81
+ it "should equal a tag with the same name" do
82
+ @tag.name = "awesome"
83
+ new_tag = Tag.new(:name => "awesome")
84
+ new_tag.should == @tag
85
+ end
86
+
87
+ it "should return its name when to_s is called" do
88
+ @tag.name = "cool"
89
+ @tag.to_s.should == "cool"
90
+ end
91
+
92
+ it "have named_scope named(something)" do
93
+ @tag.name = "cool"
94
+ @tag.save!
95
+ Tag.named('cool').should include(@tag)
96
+ end
97
+
98
+ it "have named_scope named_like(something)" do
99
+ @tag.name = "cool"
100
+ @tag.save!
101
+ @another_tag = Tag.create!(:name => "coolip")
102
+ Tag.named_like('cool').should include(@tag, @another_tag)
103
+ end
104
+ end
@@ -0,0 +1,253 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "Taggable" do
4
+ before(:each) do
5
+ clean_database!
6
+ @taggable = TaggableModel.new(:name => "Bob Jones")
7
+ end
8
+
9
+ it "should have tag types" do
10
+ for type in [:tags, :languages, :skills, :needs, :offerings]
11
+ TaggableModel.tag_types.should include type
12
+ end
13
+ @taggable.tag_types.should == TaggableModel.tag_types
14
+ end
15
+
16
+ it "should have tag_counts_on" do
17
+ TaggableModel.tag_counts_on(:tags).all.should be_empty
18
+
19
+ @taggable.tag_list = ["awesome", "epic"]
20
+ @taggable.save
21
+
22
+ TaggableModel.tag_counts_on(:tags).length.should == 2
23
+ @taggable.tag_counts_on(:tags).length.should == 2
24
+ end
25
+
26
+ it "should be able to create tags" do
27
+ @taggable.skill_list = "ruby, rails, css"
28
+ @taggable.instance_variable_get("@skill_list").instance_of?(Hash).should be_true
29
+ @taggable.instance_variable_get("@skill_list")[nil].instance_of?(TagList).should be_true
30
+ @taggable.save
31
+
32
+ Tag.find(:all).size.should == 3
33
+ end
34
+
35
+ it "should be able to create tags through the tag list directly" do
36
+ @taggable.tag_list_on(:test).add("hello")
37
+ @taggable.tag_list_cache_on(:test).should_not be_empty
38
+ @taggable.save
39
+ @taggable.save_tags
40
+ @taggable.reload
41
+ @taggable.tag_list_on(:test).should == ["hello"]
42
+ end
43
+
44
+ it "should differentiate between contexts" do
45
+ @taggable.skill_list = "ruby, rails, css"
46
+ @taggable.tag_list = "ruby, bob, charlie"
47
+ @taggable.save
48
+ @taggable.reload
49
+ @taggable.skill_list.should include("ruby")
50
+ @taggable.skill_list.should_not include("bob")
51
+ end
52
+
53
+ it "should be able to remove tags through list alone" do
54
+ @taggable.skill_list = "ruby, rails, css"
55
+ @taggable.save
56
+ @taggable.reload
57
+ @taggable.should have(3).skills
58
+ @taggable.skill_list = "ruby, rails"
59
+ @taggable.save
60
+ @taggable.reload
61
+ @taggable.should have(2).skills
62
+ end
63
+
64
+ it "should be able to find by tag" do
65
+ @taggable.skill_list = "ruby, rails, css"
66
+ @taggable.save
67
+
68
+ TaggableModel.tagged_with("ruby").first.should == @taggable
69
+ end
70
+
71
+ it "should be able to find by tag with context" do
72
+ @taggable.skill_list = "ruby, rails, css"
73
+ @taggable.tag_list = "bob, charlie"
74
+ @taggable.save
75
+
76
+ TaggableModel.tagged_with("ruby").first.should == @taggable
77
+ TaggableModel.tagged_with("ruby, css").first.should == @taggable
78
+ TaggableModel.tagged_with("bob", :on => :skills).first.should_not == @taggable
79
+ TaggableModel.tagged_with("bob", :on => :tags).first.should == @taggable
80
+ end
81
+
82
+ it "should not care about case" do
83
+ bob = TaggableModel.create(:name => "Bob", :tag_list => "ruby")
84
+ frank = TaggableModel.create(:name => "Frank", :tag_list => "Ruby")
85
+
86
+ Tag.find(:all).size.should == 1
87
+ TaggableModel.tagged_with("ruby").all.should == TaggableModel.tagged_with("Ruby").all
88
+ end
89
+
90
+ it "should be able to get tag counts on model as a whole" do
91
+ bob = TaggableModel.create(:name => "Bob", :tag_list => "ruby, rails, css")
92
+ frank = TaggableModel.create(:name => "Frank", :tag_list => "ruby, rails")
93
+ charlie = TaggableModel.create(:name => "Charlie", :skill_list => "ruby")
94
+ TaggableModel.tag_counts.all.should_not be_empty
95
+ TaggableModel.skill_counts.all.should_not be_empty
96
+ end
97
+
98
+ it "should be able to get all tag counts on model as whole" do
99
+ bob = TaggableModel.create(:name => "Bob", :tag_list => "ruby, rails, css")
100
+ frank = TaggableModel.create(:name => "Frank", :tag_list => "ruby, rails")
101
+ charlie = TaggableModel.create(:name => "Charlie", :skill_list => "ruby")
102
+
103
+ TaggableModel.all_tag_counts.all.should_not be_empty
104
+ TaggableModel.all_tag_counts.first.count.should == 3 # ruby
105
+ end
106
+
107
+ it "should not return read-only records" do
108
+ TaggableModel.create(:name => "Bob", :tag_list => "ruby, rails, css")
109
+
110
+ TaggableModel.tagged_with("ruby").first.should_not be_readonly
111
+ end
112
+
113
+ it "should be able to get scoped tag counts" do
114
+ bob = TaggableModel.create(:name => "Bob", :tag_list => "ruby, rails, css")
115
+ frank = TaggableModel.create(:name => "Frank", :tag_list => "ruby, rails")
116
+ charlie = TaggableModel.create(:name => "Charlie", :skill_list => "ruby")
117
+
118
+ TaggableModel.tagged_with("ruby").tag_counts.first.count.should == 2 # ruby
119
+ TaggableModel.tagged_with("ruby").skill_counts.first.count.should == 1 # ruby
120
+ end
121
+
122
+ it "should be able to get all scoped tag counts" do
123
+ bob = TaggableModel.create(:name => "Bob", :tag_list => "ruby, rails, css")
124
+ frank = TaggableModel.create(:name => "Frank", :tag_list => "ruby, rails")
125
+ charlie = TaggableModel.create(:name => "Charlie", :skill_list => "ruby")
126
+
127
+ TaggableModel.tagged_with("ruby").all_tag_counts.first.count.should == 3 # ruby
128
+ end
129
+
130
+ it "should be able to set a custom tag context list" do
131
+ bob = TaggableModel.create(:name => "Bob")
132
+ bob.set_tag_list_on(:rotors, "spinning, jumping")
133
+ bob.tag_list_on(:rotors).should == ["spinning","jumping"]
134
+ bob.save
135
+ bob.reload
136
+ bob.tags_on(:rotors).should_not be_empty
137
+ end
138
+
139
+ it "should be able to find tagged" do
140
+ bob = TaggableModel.create(:name => "Bob", :tag_list => "fitter, happier, more productive", :skill_list => "ruby, rails, css")
141
+ frank = TaggableModel.create(:name => "Frank", :tag_list => "weaker, depressed, inefficient", :skill_list => "ruby, rails, css")
142
+ steve = TaggableModel.create(:name => 'Steve', :tag_list => 'fitter, happier, more productive', :skill_list => 'c++, java, ruby')
143
+
144
+ TaggableModel.tagged_with("ruby", :order => 'taggable_models.name').all.should == [bob, frank, steve]
145
+ TaggableModel.tagged_with("ruby, rails", :order => 'taggable_models.name').all.should == [bob, frank]
146
+ TaggableModel.tagged_with(["ruby", "rails"], :order => 'taggable_models.name').all.should == [bob, frank]
147
+ end
148
+
149
+ it "should be able to find tagged with any tag" do
150
+ bob = TaggableModel.create(:name => "Bob", :tag_list => "fitter, happier, more productive", :skill_list => "ruby, rails, css")
151
+ frank = TaggableModel.create(:name => "Frank", :tag_list => "weaker, depressed, inefficient", :skill_list => "ruby, rails, css")
152
+ steve = TaggableModel.create(:name => 'Steve', :tag_list => 'fitter, happier, more productive', :skill_list => 'c++, java, ruby')
153
+
154
+ TaggableModel.tagged_with(["ruby", "java"], :order => 'taggable_models.name', :any => true).all.should == [bob, frank, steve]
155
+ TaggableModel.tagged_with(["c++", "fitter"], :order => 'taggable_models.name', :any => true).all.should == [bob, steve]
156
+ TaggableModel.tagged_with(["depressed", "css"], :order => 'taggable_models.name', :any => true).all.should == [bob, frank]
157
+ end
158
+
159
+ it "should be able to find tagged on a custom tag context" do
160
+ bob = TaggableModel.create(:name => "Bob")
161
+ bob.set_tag_list_on(:rotors, "spinning, jumping")
162
+ bob.tag_list_on(:rotors).should == ["spinning","jumping"]
163
+ bob.save
164
+
165
+ TaggableModel.tagged_with("spinning", :on => :rotors).all.should == [bob]
166
+ end
167
+
168
+ it "should be able to use named scopes to chain tag finds" do
169
+ bob = TaggableModel.create(:name => "Bob", :tag_list => "fitter, happier, more productive", :skill_list => "ruby, rails, css")
170
+ frank = TaggableModel.create(:name => "Frank", :tag_list => "weaker, depressed, inefficient", :skill_list => "ruby, rails, css")
171
+ steve = TaggableModel.create(:name => 'Steve', :tag_list => 'fitter, happier, more productive', :skill_list => 'c++, java, python')
172
+
173
+ # Let's only find those productive Rails developers
174
+ TaggableModel.tagged_with('rails', :on => :skills, :order => 'taggable_models.name').should == [bob, frank]
175
+ TaggableModel.tagged_with('happier', :on => :tags, :order => 'taggable_models.name').should == [bob, steve]
176
+ TaggableModel.tagged_with('rails', :on => :skills).tagged_with('happier', :on => :tags).should == [bob]
177
+ TaggableModel.tagged_with('rails').tagged_with('happier', :on => :tags).should == [bob]
178
+ end
179
+
180
+ it "should be able to find tagged with only the matching tags" do
181
+ bob = TaggableModel.create(:name => "Bob", :tag_list => "lazy, happier")
182
+ frank = TaggableModel.create(:name => "Frank", :tag_list => "fitter, happier, inefficient")
183
+ steve = TaggableModel.create(:name => 'Steve', :tag_list => "fitter, happier")
184
+
185
+ TaggableModel.tagged_with("fitter, happier", :match_all => true).all.should == [steve]
186
+ end
187
+
188
+ it "should be able to find tagged with some excluded tags" do
189
+ bob = TaggableModel.create(:name => "Bob", :tag_list => "happier, lazy")
190
+ frank = TaggableModel.create(:name => "Frank", :tag_list => "happier")
191
+ steve = TaggableModel.create(:name => 'Steve', :tag_list => "happier")
192
+
193
+ TaggableModel.tagged_with("lazy", :exclude => true).all.should == [frank, steve]
194
+ end
195
+
196
+ it "should not create duplicate taggings" do
197
+ bob = TaggableModel.create(:name => "Bob")
198
+ lambda {
199
+ bob.tag_list << "happier"
200
+ bob.tag_list << "happier"
201
+ bob.save
202
+ }.should change(Tagging, :count).by(1)
203
+ end
204
+
205
+ describe "Single Table Inheritance" do
206
+ before do
207
+ [TaggableModel, Tag, Tagging, TaggableUser].each(&:delete_all)
208
+ @taggable = TaggableModel.new(:name => "taggable")
209
+ @inherited_same = InheritingTaggableModel.new(:name => "inherited same")
210
+ @inherited_different = AlteredInheritingTaggableModel.new(:name => "inherited different")
211
+ end
212
+
213
+ it "should be able to save tags for inherited models" do
214
+ @inherited_same.tag_list = "bob, kelso"
215
+ @inherited_same.save
216
+ InheritingTaggableModel.tagged_with("bob").first.should == @inherited_same
217
+ end
218
+
219
+ it "should find STI tagged models on the superclass" do
220
+ @inherited_same.tag_list = "bob, kelso"
221
+ @inherited_same.save
222
+ TaggableModel.tagged_with("bob").first.should == @inherited_same
223
+ end
224
+
225
+ it "should be able to add on contexts only to some subclasses" do
226
+ @inherited_different.part_list = "fork, spoon"
227
+ @inherited_different.save
228
+ InheritingTaggableModel.tagged_with("fork", :on => :parts).should be_empty
229
+ AlteredInheritingTaggableModel.tagged_with("fork", :on => :parts).first.should == @inherited_different
230
+ end
231
+
232
+ it "should have different tag_counts_on for inherited models" do
233
+ @inherited_same.tag_list = "bob, kelso"
234
+ @inherited_same.save!
235
+ @inherited_different.tag_list = "fork, spoon"
236
+ @inherited_different.save!
237
+
238
+ InheritingTaggableModel.tag_counts_on(:tags).map(&:name).should == %w(bob kelso)
239
+ AlteredInheritingTaggableModel.tag_counts_on(:tags).map(&:name).should == %w(fork spoon)
240
+ TaggableModel.tag_counts_on(:tags).map(&:name).should == %w(bob kelso fork spoon)
241
+ end
242
+
243
+ it 'should store same tag without validation conflict' do
244
+ @taggable.tag_list = 'one'
245
+ @taggable.save!
246
+
247
+ @inherited_same.tag_list = 'one'
248
+ @inherited_same.save!
249
+
250
+ @inherited_same.update_attributes! :name => 'foo'
251
+ end
252
+ end
253
+ end