test/test_joint.rb in joint-0.5.3 vs test/test_joint.rb in joint-0.5.4

- old
+ new

@@ -41,17 +41,25 @@ Joint.size(@image).should == 13661 end end context ".type" do - should "return type" do + should "return content_type if responds to it" do def @image.content_type 'plain/text' end Joint.type(@image).should == 'plain/text' end + should "fall back to Wand if content_type is blank" do + def @image.content_type; '' end + Joint.type(@image).should == 'image/jpeg' + + def @image.content_type; ' ' end + Joint.type(@image).should == 'image/jpeg' + end + should "fall back to Wand" do Joint.type(@image).should == 'image/jpeg' end end @@ -357,8 +365,38 @@ should "work" do @asset.file_name.should == 'foo.txt' @asset.file_size.should == 19 @asset.file_type.should == 'plain/text' @asset.file.read.should == 'This is my stuff' + end + end + + context "A font file" do + setup do + @file = open_file('font.eot') + @doc = Asset.create(:file => @file) + end + subject { @doc } + + should "assign joint keys" do + subject.file_size.should == 17610 + subject.file_type.should == "application/octet-stream" + subject.file_id.should_not be_nil + subject.file_id.should be_instance_of(BSON::ObjectId) + end + end + + context "A music file" do + setup do + @file = open_file('example.m4r') + @doc = Asset.create(:file => @file) + end + subject { @doc } + + should "assign joint keys" do + subject.file_size.should == 50790 + subject.file_type.should == "audio/mp4" + subject.file_id.should_not be_nil + subject.file_id.should be_instance_of(BSON::ObjectId) end end end \ No newline at end of file