Sha256: 1ea4b478431a64f7af7ec41a5e7466dbb69ecd1caab49f5e2ad5b8a184ae350d

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

describe Unidom::Inventory::GroupedInventoryItem, type: :model do

  before :each do
  end

  after :each do
  end

  context do

    model_attributes = {
      stored_id:   SecureRandom.uuid,
      stored_type: 'Unidom::Inventory::Stored::Mock',
      store_id:    SecureRandom.uuid,
      store_type:  'Unidom::Inventory::Store::Mock',
      lot_id:      SecureRandom.uuid,
      quantity:    120.000000
    }

    it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes

    it_behaves_like 'validates', model_attributes, :quantity,
      {                              } => 0,
      { quantity: nil                } => 2,
      { quantity: ''                 } => 2,
      { quantity: '1'                } => 0,
      { quantity: 1                  } => 0,
      { quantity: 'A'                } => 1,
      { quantity: '1.23'             } => 0,
      { quantity: 1.23               } => 0,
      { quantity: '-0.01'            } => 1,
      { quantity: -0.01              } => 1,
      { quantity: '0'                } => 0,
      { quantity: 0                  } => 0,
      { quantity: '0.01'             } => 0,
      { quantity: 0.01               } => 0,
      { quantity: '999_999_999.99'   } => 0,
      { quantity: 999_999_999.99     } => 0,
      { quantity: '1_000_000_000'    } => 1,
      { quantity: 1_000_000_000      } => 1,
      { quantity: '1_000_000_000.01' } => 1,
      { quantity: 1_000_000_000.01   } => 1

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unidom-inventory-1.0.1 lib/rspec/models/unidom/inventory/grouped_inventory_item_spec.rb