Sha256: 3bbec4deee9d6dd63d537979a65b2af9b088635f0ea9c0ad780cb723f83e4082
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
require_relative "../../../test_helper" class ContentTagsFilesTest < ActiveSupport::TestCase delegate :rails_blob_path, to: "Rails.application.routes.url_helpers" setup do @page = comfy_cms_pages(:default) end # -- Tests ------------------------------------------------------------------- def test_init tag = ComfortableMexicanSofa::Content::Tag::Files.new(@page, "test") assert_equal "test", tag.identifier assert_equal "url", tag.as end def test_init_with_params string = "test, as: image, resize: 100x100, gravity: center, crop: '100x100+0+0'" tag = ComfortableMexicanSofa::Content::Tag::Files.new(@page, string) assert_equal "test", tag.identifier assert_equal "image", tag.as assert_equal ({ "resize" => "100x100", "gravity" => "center", "crop" => "100x100+0+0" }), tag.variant_attrs end def test_content frag = comfy_cms_fragments(:file) frag.update_attribute(:tag, "files") frag.update_attribute(:files, fixture_file_upload("files/image.jpg", "image/jpeg")) tag = ComfortableMexicanSofa::Content::Tag::Files.new(@page, frag.identifier) out = frag.attachments.map { |a| rails_blob_path(a, only_path: true) }.join(" ") assert_equal out, tag.content end def test_content_no_attachments tag = ComfortableMexicanSofa::Content::Tag::Files.new(@page, "test") assert_equal "", tag.content end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
comfortable_mexican_sofa-2.0.8 | test/lib/content/tags/files_test.rb |