From 212bc79f3e9f9a102564008ab161c91b383172f2 Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Thu, 6 Aug 2009 13:04:17 -0700 Subject: [PATCH] fix content_type handling for attachments --- lib/couchrest/mixins/extended_attachments.rb | 2 +- spec/couchrest/more/extended_doc_attachment_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/couchrest/mixins/extended_attachments.rb b/lib/couchrest/mixins/extended_attachments.rb index dd78644..8dbac45 100644 --- a/lib/couchrest/mixins/extended_attachments.rb +++ b/lib/couchrest/mixins/extended_attachments.rb @@ -64,7 +64,7 @@ module CouchRest def set_attachment_attr(args) content_type = args[:content_type] ? args[:content_type] : get_mime_type(args[:file]) self['_attachments'][args[:name]] = { - 'content-type' => content_type, + 'content_type' => content_type, 'data' => encode_attachment(args[:file].read) } end diff --git a/spec/couchrest/more/extended_doc_attachment_spec.rb b/spec/couchrest/more/extended_doc_attachment_spec.rb index e73db96..96a8fa3 100644 --- a/spec/couchrest/more/extended_doc_attachment_spec.rb +++ b/spec/couchrest/more/extended_doc_attachment_spec.rb @@ -66,7 +66,7 @@ describe "ExtendedDocument attachments" do it 'should set the content-type if passed' do @obj.create_attachment(:file => @file_ext, :name => @attachment_name, :content_type => @content_type) - @obj['_attachments'][@attachment_name]['content-type'].should == @content_type + @obj['_attachments'][@attachment_name]['content_type'].should == @content_type end end @@ -100,7 +100,7 @@ describe "ExtendedDocument attachments" do file = File.open(FIXTURE_PATH + '/attachments/README') @file.should_not == file @obj.update_attachment(:file => file, :name => @attachment_name, :content_type => @content_type) - @obj['_attachments'][@attachment_name]['content-type'].should == @content_type + @obj['_attachments'][@attachment_name]['content_type'].should == @content_type end it 'should delete an attachment that exists' do