<commit_before># encoding: utf-8

require 'spec_helper'

describe Relation::Header, '#project' do
  subject { object.project(attributes) }

  let(:object) { described_class.coerce([ [ :id, Integer ], [ :name, String ] ], :keys => keys)          }
  let(:keys)   { Relation::Keys.new([ described_class.coerce([ [ :id, Integer ], [ :name, String ] ]) ]) }

  context 'with attribute objects' do
    let(:attributes) { [ attribute ]               }
    let(:attribute)  { Attribute::Integer.new(:id) }

    it { should be_instance_of(described_class) }

    it 'uses the attribute object' do
      subject[:id].should equal(attribute)
    end

    its(:to_ary) { should == [ [ :id, Integer ] ] }
  end

  context 'with Symbol attributes' do
    let(:attributes) { [ :id ] }

    it { should be_instance_of(described_class) }

    its(:to_ary) { should == [ [ :id, Integer ] ] }

    its(:keys) { should eql(Relation::Keys.new([ described_class.coerce([ [ :id, Integer ] ]) ])) }
  end
end
<commit_msg>Fix Header#project spec to kill mutation<commit_after># encoding: utf-8

require 'spec_helper'

describe Relation::Header, '#project' do
  subject { object.project(attributes) }

  let(:object) { described_class.coerce([ [ :id, Integer ], [ :name, String ] ], :keys => keys)          }
  let(:keys)   { Relation::Keys.new([ described_class.coerce([ [ :id, Integer ], [ :name, String ] ]) ]) }

  context 'with attribute objects' do
    let(:attributes) { [ attribute ]               }
    let(:attribute)  { Attribute::Integer.new(:id) }

    it { should be_instance_of(described_class) }

    it 'uses the attribute object' do
      subject[:id].should equal(attribute)
    end

    its(:to_ary) { should == [ [ :id, Integer ] ] }

    its(:keys) { should eql(Relation::Keys.new([ described_class.coerce([ [ :id, Integer ] ]) ])) }
  end

  context 'with Symbol attributes' do
    let(:attributes) { [ :id ] }

    it { should be_instance_of(described_class) }

    its(:to_ary) { should == [ [ :id, Integer ] ] }

    its(:keys) { should eql(Relation::Keys.new([ described_class.coerce([ [ :id, Integer ] ]) ])) }
  end

  context 'when the header has no keys' do
    let(:keys)       { Relation::Keys.new }
    let(:attributes) { [ :id ]            }

    it { should be_instance_of(described_class) }

    its(:to_ary) { should == [ [ :id, Integer ] ] }

    its(:keys) { should be_empty }
  end
end

{'fraction_non_alphanumeric': 0.1623646960865945, 'fraction_numerical': 0.0008326394671107411, 'mean_word_length': 3.179130434782609, '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': '1363980', 'n_tokens_mistral': 809, 'n_tokens_neox': 770, 'n_words': 182}