Sha256: f252e99ddedc9e39197db61c9f2c9621c82bf7875b64407e9c7e53122468bded

Contents?: true

Size: 973 Bytes

Versions: 1

Compression:

Stored size: 973 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Attribute, '.new' do
  subject { object.new(name, options) }

  let(:name)    { :id }
  let(:options) { {}  }

  [
    Attribute::Boolean,
    Attribute::Class,
    Attribute::Date,
    Attribute::DateTime,
    Attribute::Decimal,
    Attribute::Float,
    Attribute::Integer,
    Attribute::Numeric,
    Attribute::Object,
    Attribute::String,
    Attribute::Time,
  ].each do |described_class|
    context "when called on the Attribute subclass #{described_class}" do
      let(:object) { described_class }

      it 'does not freeze the options' do
        options.should_not be_frozen
        expect { subject }.to_not change(options, :frozen?)
      end

      it { should be_instance_of(object) }
    end
  end

  context 'when called on the Attribute class' do
    let(:object) { described_class }

    specify { expect { subject }.to raise_error(NotImplementedError, "#{object} is an abstract type") }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/attribute/class_methods/new_spec.rb