Browse files

Updated the specs.

  • Loading branch information...
1 parent 22def5b commit e27a170e870cfe1421066573eeed9620ab00f157 @postmodern committed Jul 17, 2010
Showing with 10 additions and 10 deletions.
  1. +10 −10 spec/integration/counter_cacheable_spec.rb
View
20 spec/integration/counter_cacheable_spec.rb
@@ -24,7 +24,7 @@
end
it "should optionally define a counter index column" do
- Comment.properties.should be_named('users_index')
+ Comment.properties.should be_named('user_comments_index')
end
it "should have a counter cache of 0 by default" do
@@ -44,15 +44,6 @@
(new_counter - orig_counter).should == 1
end
- it "should increment the counter cache by 1 when a new resource is created" do
- @post.comments.create(
- :body => 'lol',
- :user => @user
- )
-
- @post.comments.last.users_index.should == 1
- end
-
it "should increment the counter cache by 1 when a new resource is saved" do
orig_counter = @post.comments_counter
@@ -66,6 +57,15 @@
(new_counter - orig_counter).should == 1
end
+ it "should set the counter index to the counter value when a new resource is created" do
+ @post.comments.create(
+ :body => 'lol',
+ :user => @user
+ )
+
+ @post.comments.last.user_comments_index.should == @user.post_comments_counter
+ end
+
it "should decrement the counter cache by 1 when a resource is destroyed" do
@post.comments.create(
:body => 'wtf',

0 comments on commit e27a170

Please sign in to comment.