Sha256: b68affb88d668c5b77db146fce982a87626b2380cad649d5ecb1188c179e644a

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 Bytes

Contents

require 'test_helper'

class BitmaskAttributesTest < ActiveSupport::TestCase

  context 'validate_for' do
    context 'when missing column' do
      setup do
        @column = Class.new do
          attr_reader :name

          def initialize(name); @name = name end
        end

        @model = Class.new do
          attr_reader :columns

          def initialize(columns); @columns = columns end

          def table_exists?; true end

          def self.name; 'Model' end
        end
      end

      should 'not fail' do
        definition = BitmaskAttributes::Definition.new(:missing_column)

        some_model = @model.new([@column.new(:name)])
        definition.send(:validate_for, some_model)
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bitmask_attributes-1.0.0 test/bitmask_attributes/definition_test.rb
bitmask_attributes-0.4.0 test/bitmask_attributes/definition_test.rb