Sha256: 6606bebc4cae62095c54551c3b17f385b98e6a5cafee45e21033d19879ebb5e4

Contents?: true

Size: 711 Bytes

Versions: 4

Compression:

Stored size: 711 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:object) { described_class }

  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

4 entries across 4 versions & 1 rubygems

Version Path
veritas-0.0.7 spec/unit/veritas/attribute/class_methods/name_from_spec.rb
veritas-0.0.6 spec/unit/veritas/attribute/class_methods/name_from_spec.rb
veritas-0.0.5 spec/unit/veritas/attribute/class_methods/name_from_spec.rb
veritas-0.0.4 spec/unit/veritas/attribute/class_methods/name_from_spec.rb