Sha256: f290e658ed2b0c5a40a6dbae09f9e3359bce2d4d5a2c8f82a48edd20bd62b18a
Contents?: true
Size: 1.56 KB
Versions: 11
Compression:
Stored size: 1.56 KB
Contents
require 'test_helper' module Workarea module Admin class AssetsIntegrationTest < Workarea::IntegrationTest include Admin::IntegrationTest def test_ensures_cors_policy_for_bulk_upload DirectUpload.expects(:ensure_cors!).once get admin.content_assets_path assert(response.ok?) DirectUpload.expects(:ensure_cors!).never get admin.content_assets_path, xhr: true assert(response.ok?) end def test_can_create_an_asset post admin.content_assets_path, params: { asset: { name: 'Test Asset', file: product_image_file, tag_list: 'foo,bar,baz' } } assert_equal(1, Content::Asset.count) asset = Content::Asset.first assert_equal('Test Asset', asset.name) assert_equal(%w(foo bar baz), asset.tags) end def test_can_update_an_asset asset = create_asset( name: 'Test Asset', file: product_image_file, tag_list: 'foo,bar,baz' ) patch admin.content_asset_path(asset), params: { asset: { name: 'New Name', tag_list: 'other,tags' } } asset.reload assert_equal('New Name', asset.name) assert_equal(%w(other tags), asset.tags) end def test_can_destroy_an_asset asset = create_asset(file: product_image_file) delete admin.content_asset_path(asset) assert(Content::Asset.empty?) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems