Sha256: 216cdc61bf52096fe3d62669b2793ccf81e5f7eab5c5e80e907b0647ac1701d3

Contents?: true

Size: 693 Bytes

Versions: 1

Compression:

Stored size: 693 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Attribute.name_from' do
  subject { object.name_from(argument) }

  let(:object) { Attribute }

  context 'argument is an Attribute' do
    let(:argument) { Attribute::Integer.new(:id) }

    it { should == :id }
  end

  context 'argument that responds to #to_ary' do
    let(:argument) { [ :id, Integer ] }

    it { should == :id }
  end

  context 'argument that responds to #to_sym' do
    let(:argument) { 'id' }

    it { should == :id }
  end

  context 'argument that is not an Attribute, does not respond to #to_ary or #to_sym' do
    let(:argument) { Object.new }

    specify { expect { subject }.to raise_error(NoMethodError) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/attribute/class_methods/name_from_spec.rb