Sha256: 45c2c04ed0bc04416e7d715328ff8d64df223396f581a495b3e196e7a55448ea

Contents?: true

Size: 712 Bytes

Versions: 2

Compression:

Stored size: 712 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 be(:id) }
  end

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

    it { should be(:id) }
  end

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

    it { should be(: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

2 entries across 2 versions & 1 rubygems

Version Path
axiom-0.2.0 spec/unit/axiom/attribute/class_methods/name_from_spec.rb
axiom-0.1.1 spec/unit/axiom/attribute/class_methods/name_from_spec.rb