Sha256: 4a38bd1227dd19453ec76989f1460459d519d08bbcd6f67d2715f11a8650d9fe

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

require 'spec_helper'

RSpec.describe Yaks::Mapper::ClassMethods do
  subject { Class.new { extend Yaks::Mapper::ClassMethods } }

  describe 'attributes' do
    before do
      subject.attributes(:foo, :bar)
    end

    it 'should allow setting them' do
      expect( subject.attributes ).to eq [:foo, :bar]
    end

    describe 'with inheritance' do
      let(:child) { Class.new(subject) }
      before { child.attributes(:baz) }

      it 'should inherit attributes from the parent' do
        expect(child.attributes).to eq [:foo, :bar, :baz]
      end

      it 'should not alter the parent' do
        expect(subject.attributes).to eq [:foo, :bar]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yaks-0.4.2 spec/unit/yaks/mapper/class_methods_spec.rb
yaks-0.4.1 spec/unit/yaks/mapper/class_methods_spec.rb
yaks-0.4.0 spec/unit/yaks/mapper/class_methods_spec.rb
yaks-0.4.0.rc1 spec/unit/yaks/mapper/class_methods_spec.rb