<commit_before>require 'spec_helper'
require 'benchmark'

describe Spree::Shipment, :type => :model do
  let(:order) { create(:order_ready_to_ship, line_items_count: 1) }
  let(:shipping_method) { create(:shipping_method, name: "UPS") }
  let(:shipment) do
    order.shipments.create!(
      state: 'pending',
      cost: 1,
      address: order.ship_address,
      inventory_units: order.inventory_units,
      shipping_rates: [
        Spree::ShippingRate.new(
          shipping_method: shipping_method,
          selected: true,
        ),
      ],
      stock_location: stock_location,
    )
  end

  let(:variant) { mock_model(Spree::Variant) }
  let(:line_item) { mock_model(Spree::LineItem, variant: variant) }

  # Regression test for #4063
  context "number generation" do
    before do
      allow(order).to receive :update!
    end<commit_msg>Fix a few specs<commit_after>require 'spec_helper'
require 'benchmark'

describe Spree::Shipment, :type => :model do
  let(:stock_location) { create(:stock_location) }
  let(:order) { create(:order_ready_to_ship, line_items_count: 1) }
  let(:shipping_method) { create(:shipping_method, name: "UPS") }
  let(:shipment) do
    order.shipments.create!(
      state: 'pending',
      cost: 1,
      address: order.ship_address,
      inventory_units: order.inventory_units,
      shipping_rates: [
        Spree::ShippingRate.new(
          shipping_method: shipping_method,
          selected: true,
        ),
      ],
      stock_location: stock_location,
    )
  end

  let(:variant) { mock_model(Spree::Variant) }
  let(:line_item) { mock_model(Spree::LineItem, variant: variant) }

  # Regression test for #4063
  context "number generation" do
    before do
      allow(order).to receive :update!
    end
{'fraction_non_alphanumeric': 0.1191151446398185, 'fraction_numerical': 0.006806579693703914, 'mean_word_length': 3.41, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2874716', 'n_tokens_mistral': 579, 'n_tokens_neox': 569, 'n_words': 118}