<commit_before>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<commit_msg>1, Improve the Grouped Inventory Item spec for the validations on the #quantity attribute.<commit_after>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 numericality', model_attributes, :quantity,
      range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true

  end

end
{'fraction_non_alphanumeric': 0.1248339973439575, 'fraction_numerical': 0.06108897742363878, 'mean_word_length': 1.9388816644993498, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5562969', 'n_tokens_mistral': 849, 'n_tokens_neox': 725, 'n_words': 150}