spec/lib/attachments_spec.rb in active_metadata-0.6.9 vs spec/lib/attachments_spec.rb in active_metadata-0.7.0
- old
+ new
@@ -174,9 +174,24 @@
att.starred?.should be_false
end
end
+ describe "#starred_attachments" do
+
+ it "should return all the starred attachments for any model field" do
+ @document.save_attachment_for(:name, @attachment, true)
+ @document.save_attachment_for(:title, @attachment, true)
+ @document.save_attachment_for(:title, @attachment2 )
+
+ starred = @document.starred_attachments
+ starred.count.should eq 2
+ starred.find{|att| att.attach.instance_read(:file_name) == "pdf_test_2.pdf"}.should be_nil
+ end
+
+ end
+
+
end
end
\ No newline at end of file