spec/lib/attachments_spec.rb in active_metadata-0.7.8 vs spec/lib/attachments_spec.rb in active_metadata-0.7.9
- old
+ new
@@ -140,11 +140,11 @@
end
it "should update an attachment as starred" do
@document.save_attachment_for(:name, @attachment)
attachment = @document.attachments_for(:name).first
- @document.update_attachment(attachment.id, attachment.attach, true)
+ @document.update_attachment(attachment.id, attachment.attach, starred: true)
@document.attachments_for(:name).first.starred?.should be_true
end
it "should retrieve only starred attachments for a given label" do
@document.save_attachment_for(:name, @attachment, true)
@@ -171,9 +171,42 @@
@document.unstar_attachment(att.id)
att = @document.find_attachment_by_id(att.id)
att.starred?.should be_false
end
+
+ context "when starring" do
+
+ it "should send a notification of type star_attachment_message" do
+ #watch
+ user = User.create!(:email => "email@email.it", :firstname => 'John', :lastname => 'smith' )
+ @document.create_watcher_for(:name, user)
+ # create note and star it
+ @document.save_attachment_for(:name, @attachment, true)
+ att = @document.attachments_for(:name).first
+
+ @document.star_attachment(att.id)
+ @document.notifier.type.should eq :star_attachment_message
+ end
+
+ end
+
+ context "when unstarring" do
+
+ it "should send a notification of type unstar_attachment_message" do
+ #watch
+ user = User.create!(:email => "email@email.it", :firstname => 'John', :lastname => 'smith' )
+ @document.create_watcher_for(:name, user)
+ # create note and star it
+ @document.save_attachment_for(:name, @attachment, true)
+ att = @document.attachments_for(:name).first
+
+ @document.unstar_attachment(att.id)
+ @document.notifier.type.should eq :unstar_attachment_message
+ end
+
+ end
+
end
describe "#starred_attachments" do
\ No newline at end of file