Sha256: da79a0bf4242d57fd4d7d444d3a9c939c798d33f677e15d154bd43f42d14e743

Contents?: true

Size: 873 Bytes

Versions: 9

Compression:

Stored size: 873 Bytes

Contents

require "test_helper"

class ImageTest < ActiveSupport::TestCase
  def setup
    super
    @image = Image.new(:name => "test")
  end

  test "should save image without resource" do
    assert @image.save
  end

  test "should save image with uploaded resource" do
    assert @image.update(:resource => fogged_resources(:resource_text_1))

  end

  test "should not save image with uploading resource" do
    resource = fogged_resources(:resource_text_1)
    resource.update!(:uploading => true)

    refute @image.update(:resource => resource)
  end

  test "image url changing the storage name" do
    d = "foobar"
    @image.update!(:resource => fogged_resources(:resource_png_1))
    Fogged.storage.directories.create(:key => d)

    url = Fogged.with_directory(d) { @image.resource.url }

    assert url.include?(d)
    refute @image.resource.url.include?(d)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fogged-0.0.13 test/dummy/test/models/image_test.rb
fogged-0.0.12 test/dummy/test/models/image_test.rb
fogged-0.0.11 test/dummy/test/models/image_test.rb
fogged-0.0.10 test/dummy/test/models/image_test.rb
fogged-0.0.9 test/dummy/test/models/image_test.rb
fogged-0.0.8 test/dummy/test/models/image_test.rb
fogged-0.0.7 test/dummy/test/models/image_test.rb
fogged-0.0.6 test/dummy/test/models/image_test.rb
fogged-0.0.5 test/dummy/test/models/image_test.rb