<commit_before>require 'spec_helper'

describe Spree::Address, :type => :model do

  subject { Spree::Address }

  context "aliased attributes" do
    let(:address) { Spree::Address.new }

    it "first_name" do
      address.firstname = "Ryan"
      expect(address.first_name).to eq("Ryan")
    end

    it "last_name" do
      address.lastname = "Bigg"
      expect(address.last_name).to eq("Bigg")
    end
  end

  context "validation" do
    before do
      configure_spree_preferences do |config|
        config.address_requires_state = true
      end
    end

    let(:country) { mock_model(Spree::Country, :states => [state], :states_required => true) }
    let(:state) { stub_model(Spree::State, :name => 'maryland', :abbr => 'md') }
    let(:address) { build(:address, :country => country) }<commit_msg>Set the names on initialization<commit_after>require 'spec_helper'

describe Spree::Address, :type => :model do

  subject { Spree::Address }

  context "aliased attributes" do
    let(:address) { Spree::Address.new firstname: 'Ryan', lastname: 'Bigg'}

    it " first_name" do
      expect(address.first_name).to eq("Ryan")
    end

    it "last_name" do
      expect(address.last_name).to eq("Bigg")
    end
  end

  context "validation" do
    before do
      configure_spree_preferences do |config|
        config.address_requires_state = true
      end
    end

    let(:country) { mock_model(Spree::Country, :states => [state], :states_required => true) }
    let(:state) { stub_model(Spree::State, :name => 'maryland', :abbr => 'md') }
    let(:address) { build(:address, :country => country) }
{'fraction_non_alphanumeric': 0.13825170489770613, 'fraction_numerical': 0.0, 'mean_word_length': 3.4958217270194987, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '510352', 'n_tokens_mistral': 532, 'n_tokens_neox': 507, 'n_words': 124}