Sha256: 30797424028b6810829ee4ebb8f02668198cfd3f1d64571f25fcaaf5a7ab4690
Contents?: true
Size: 949 Bytes
Versions: 1
Compression:
Stored size: 949 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe Relation::Header, '.new' do subject { object.new(argument) } let(:object) { described_class } context 'with no arguments' do subject { object.new } it { should be_kind_of(object) } it { should be_empty } end context 'with an argument that responds to #to_ary and do not contain duplicates' do let(:argument) { [ [ :id ], [ :name ] ] } it { should be_kind_of(object) } it { should == argument } end context 'with an argument that responds to #to_ary and contain duplicates' do let(:argument) { [ [ :id ], [ :id ], [ :name ], [ :name ], [ :age ] ] } specify { expect { subject }.to raise_error(DuplicateAttributeError, 'duplicate attributes: id, name') } end context 'with an argument that does not respond to #to_ary' do let(:argument) { { :id => Integer } } specify { expect { subject }.to raise_error(NoMethodError) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.4 | spec/unit/veritas/relation/header/class_methods/new_spec.rb |