Sha256: 467de5aa3c5ee363dab1d9597cc1822d6d419e31cc0319129eb50718f7c3c88e
Contents?: true
Size: 971 Bytes
Versions: 17
Compression:
Stored size: 971 Bytes
Contents
require 'spec_helper' describe CouchPotato, 'attachments' do it "should persist an attachment" do comment = Comment.new :title => 'nil' comment._attachments['body'] = {'data' => 'a useful comment', 'content_type' => 'text/plain'} CouchPotato.database.save! comment expect(CouchPotato.couchrest_database.fetch_attachment(comment.to_hash, 'body').to_s).to eq('a useful comment') end it "should give me information about the attachments of a document" do comment = Comment.new :title => 'nil' comment._attachments = {'body' => {'data' => 'a useful comment', 'content_type' => 'text/plain'}} CouchPotato.database.save! comment comment_reloaded = CouchPotato.database.load comment.id expect(comment_reloaded._attachments["body"]).to include({"content_type" => "text/plain", "stub" => true, "length" => 16}) end it "should have an empty array for a new object" do expect(Comment.new._attachments).to eq({}) end end
Version data entries
17 entries across 17 versions & 1 rubygems