<commit_before>require 'spec_helper'

RSpec.describe Spree::Tax::ItemAdjuster do
  subject(:adjuster) { described_class.new(item) }
  let(:order) { create(:order) }
  let(:item) { create(:line_item, order: order) }

  def tax_adjustments
    item.adjustments.tax.to_a
  end

  describe 'initialization' do
    it 'sets order to item order' do
      expect(adjuster.order).to eq(item.order)
    end

    it 'sets adjustable' do
      expect(adjuster.item).to eq(item)
    end
  end

  shared_examples_for 'untaxed item' do
    it 'creates no adjustments' do
      adjuster.adjust!
      expect(tax_adjustments).to eq([])<commit_msg>Use in-memory objects in specs<commit_after>require 'spec_helper'

RSpec.describe Spree::Tax::ItemAdjuster do
  subject(:adjuster) { described_class.new(item) }
  let(:order) { create(:order) }
  let(:item) { create(:line_item, order: order) }

  def tax_adjustments
    item.adjustments.select(&:tax?).to_a
  end

  describe 'initialization' do
    it 'sets order to item order' do
      expect(adjuster.order).to eq(item.order)
    end

    it 'sets adjustable' do
      expect(adjuster.item).to eq(item)
    end
  end

  shared_examples_for 'untaxed item' do
    it 'creates no adjustments' do
      adjuster.adjust!
      expect(tax_adjustments).to eq([])
{'fraction_non_alphanumeric': 0.11472868217054263, 'fraction_numerical': 0.0, 'mean_word_length': 3.643884892086331, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6073913', 'n_tokens_mistral': 446, 'n_tokens_neox': 425, 'n_words': 103}