Sha256: f0d57b68f1ded6b06e36e7b0cf50c256e319ff3f989da054956dd542a5b47e0c

Contents?: true

Size: 1.22 KB

Versions: 23

Compression:

Stored size: 1.22 KB

Contents

require 'test_helper'
require File.expand_path('../mock_model.rb', __dir__)
require File.expand_path('../../file_column_helpers.rb', __dir__)

class DeleteFileColumnTest < MiniTest::Test
  def setup
    MockModel.extend ActiveScaffold::Bridges::FileColumn::FileColumnHelpers
    ActiveScaffold::Bridges::FileColumn::FileColumnHelpers.generate_delete_helpers(MockModel)
    @model = MockModel.new
    @model.band_image = 'coolio.jpg'
  end

  def test__file_column_fields
    assert_equal(1, @model.class.file_column_fields.length)
  end

  def test__delete_band_image__boolean__should_delete
    @model.delete_band_image = true
    assert_nil @model.band_image
  end

  def test__delete_band_image__string__should_delete
    @model.delete_band_image = 'true'
    assert_nil @model.band_image
  end

  def test__delete_band_image__boolean_false__shouldnt_delete
    @model.delete_band_image = false
    refute_nil @model.band_image
  end

  def test__delete_band_image__string_false__shouldnt_delete
    @model.delete_band_image = 'false'
    refute_nil @model.band_image
  end

  def test__just_uploaded__shouldnt_delete
    @model.band_image_just_uploaded = true
    @model.delete_band_image = 'true'
    refute_nil(@model.band_image)
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
active_scaffold-3.7.0 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.20 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.19 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.17 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.15 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.14 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.13 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.12 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.11.1 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.11 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.10 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.9 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.8 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.6 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.5 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.4.1 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.4 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.3 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.2 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
active_scaffold-3.6.1 lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb