Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Creat a blog post bug (774727)

  • Loading branch information...
commit f585f85fd661d2588836460b562ee51014249807 1 parent 0b90201
@leshill leshill authored
Showing with 11 additions and 1 deletion.
  1. +1 −1  app/models/pitch.rb
  2. +10 −0 spec/models/pitch_spec.rb
View
2  app/models/pitch.rb
@@ -91,7 +91,7 @@ def total_amount_for_user(user)
end
end
has_many :supporters, :through => :donations, :source => :user, :order => "donations.created_at", :uniq => true
- has_many :posts do
+ has_many :posts, :dependent => :destroy do
def first(number)
find(:all, :limit => number, :order => 'created_at DESC')
end
View
10 spec/models/pitch_spec.rb
@@ -878,5 +878,15 @@
@pitch.donating_groups.should_not include(nil)
end
end
+
+ describe "Remove blog posts with pitches" do
+ it "posts are dependent destroy" do
+ pitch = active_pitch
+ post = stub('post')
+ pitch.stub!(:posts).and_return([post])
+ post.should_receive(:destroy)
+ pitch.destroy
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.