Some specs for file Attachment

This commit is contained in:
Marc Remolt 2011-06-06 19:45:34 +02:00
parent 2581895c7c
commit 7265d31f62

View File

@ -1,6 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe Refinery::WordPress::Attachment, :type => :model do describe Refinery::WordPress::Attachment, :type => :model do
context "an image attchment" do
let(:attachment) { test_dump.attachments.first } let(:attachment) { test_dump.attachments.first }
specify { attachment.title.should == '200px-Tux.svg' } specify { attachment.title.should == '200px-Tux.svg' }
@ -42,3 +43,14 @@ describe Refinery::WordPress::Attachment, :type => :model do
end end
end end
context "a file attachment" do
let(:attachment) { test_dump.attachments.last }
specify { attachment.title.should == 'cv' }
specify { attachment.url.should == 'http://localhost/wordpress/wp-content/uploads/2011/05/cv.txt' }
specify { attachment.file_name.should == 'cv.txt' }
specify { attachment.post_date.should == DateTime.new(2011, 6, 6, 17, 27, 50) }
specify { attachment.should_not be_an_image }
end
end