Skip to content
Extraits de code Groupes Projets
Valider a415ff5c rédigé par maxwell's avatar maxwell
Parcourir les fichiers

fixed the build. made photos dependent destroy with parent status message

parent cc3db3d2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -12,7 +12,7 @@ class StatusMessage < Post ...@@ -12,7 +12,7 @@ class StatusMessage < Post
xml_reader :message xml_reader :message
key :message, String key :message, String
many :photos, :class => Photo, :foreign_key => :status_message_id many :photos, :class => Photo, :foreign_key => :status_message_id, :dependent => :destroy
validate :message_or_photos_present? validate :message_or_photos_present?
attr_accessible :message attr_accessible :message
......
...@@ -13,14 +13,10 @@ describe PublicsController do ...@@ -13,14 +13,10 @@ describe PublicsController do
describe '#receive' do describe '#receive' do
let(:xml) { "<walruses></walruses>" } let(:xml) { "<walruses></walruses>" }
context 'success cases' do context 'success cases' do
it 'should 200 on successful receipt of a request' do it 'should 200 on successful receipt of a request, and queues a job' do
post :receive, :id =>user.person.id, :xml => xml
response.code.should == '200'
end
it 'enqueues a receive job' do
Resque.should_receive(:enqueue).with(Jobs::ReceiveSalmon, user.id, xml).once Resque.should_receive(:enqueue).with(Jobs::ReceiveSalmon, user.id, xml).once
post :receive, :id =>user.person.id, :xml => xml post :receive, :id =>user.person.id, :xml => xml
response.code.should == '200'
end end
end end
......
...@@ -121,7 +121,6 @@ describe Photo do ...@@ -121,7 +121,6 @@ describe Photo do
it 'should set the remote_photo on marshalling' do it 'should set the remote_photo on marshalling' do
@photo.image.store! File.open(@fixture_name) @photo.image.store! File.open(@fixture_name)
#security hax #security hax
user2 = Factory.create(:user) user2 = Factory.create(:user)
aspect2 = user2.aspects.create(:name => "foobars") aspect2 = user2.aspects.create(:name => "foobars")
...@@ -157,4 +156,16 @@ describe Photo do ...@@ -157,4 +156,16 @@ describe Photo do
proc{ @user.comment("big willy style", :on => @photo) }.should change(@photo.comments, :count).by(1) proc{ @user.comment("big willy style", :on => @photo) }.should change(@photo.comments, :count).by(1)
end end
end end
context "deletion" do
it 'is deleted with parent status message' do
status_message = @user.build_post(:status_message, :message => "whattup", :to => @aspect.id)
status_message.photos << @photo2
status_message.save
proc {
status_message.destroy
}.should change(Photo, :count).by(-1)
end
end
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter