Sha256: 52c2f72bc6e2ff7895782aabc43cba33c57cf77e44cd212fb0e67b612a471587

Contents?: true

Size: 684 Bytes

Versions: 10

Compression:

Stored size: 684 Bytes

Contents

require 'spec_helper'

describe "Jason Blob" do

  class Update < Medea::JasonObject
    has_attachment :avatar
  end

  before :each do
    @update = Update.new
  end

  after :each do
    @update.delete!
  end

  it "should be persisted" do
    @update.avatar = "Here's some text!"
    @update.save!
    u2 = Update.get_by_key(@update.jason_key)
    u2.avatar.contents.should eq("Here's some text!")
    u2.avatar.contents.size.should eq("Here's some text!".size)
  end

  it "should work for larger images" do
    f = File.new("./spec/test.jpg", "r")
    @update.avatar = f
    @update.save!
    Update.get_by_key(@update.jason_key).avatar.contents.size.should eq(f.size)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
medea-0.7.2 spec/jason_blob_spec.rb
medea-0.7.1 spec/jason_blob_spec.rb
medea-0.7.0 spec/jason_blob_spec.rb
medea-0.6.9 spec/jason_blob_spec.rb
medea-0.6.8 spec/jason_blob_spec.rb
medea-0.6.7 spec/jason_blob_spec.rb
medea-0.6.6 spec/jason_blob_spec.rb
medea-0.6.5 spec/jason_blob_spec.rb
medea-0.6.4 spec/jason_blob_spec.rb
medea-0.6.3 spec/jason_blob_spec.rb