<commit_before><commit_msg>Add test for Attribute.build<commit_after>require 'spec_helper'

describe DataMapper::Mapper::Attribute, '.build' do
  subject { described_class.build(name, options) }

  let(:name)       { :title }
  let(:collection) { false }
  let(:options)    { { :type => type, :collection => collection } }

  context "when type is a veritas primitive attribute" do
    let(:type) { String }

    it { should be_instance_of(described_class::Primitive) }
  end

  context "when type is not a primitive" do
    let(:type)       { mock_model(:TestModel) }
    let(:collection) { false }

    it { should be_instance_of(described_class::Mapper) }
  end

  context "when collection is set" do
    let(:type)       { mock_model(:TestModel) }
    let(:collection) { true }

    it { should be_instance_of(described_class::Collection) }
  end
end
{'fraction_non_alphanumeric': 0.12060889929742388, 'fraction_numerical': 0.0, 'mean_word_length': 3.776536312849162, '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': '4230326', 'n_tokens_mistral': 267, 'n_tokens_neox': 256, 'n_words': 67}