Sha256: 8a024d3d8a6a3da23a4cb9e79dfe42b2bd2737be42f573d6cae887b0aee2c503

Contents?: true

Size: 805 Bytes

Versions: 6

Compression:

Stored size: 805 Bytes

Contents

require 'rubygems'
require 'require_relative' if RUBY_VERSION < '1.9'

require_relative 'common'

describe BaseModel do

  before do
    class CustomModel < BaseModel
      attr_accessor :name
      attr_accessor :custom
    end
    @model = CustomModel.new(:id => 'm1', :name => 'Model1', :custom => '1')
  end

  describe 'initialize' do

    it 'should properly advertise given attributes' do
      @model.must_respond_to :id
      @model.must_respond_to :name
      @model.must_respond_to :custom
      @model.id.must_equal 'm1'
      @model.name.must_equal 'Model1'
      @model.custom.must_equal '1'
    end

    it 'should report all attributes' do
      @model.attributes.must_include :id
      @model.attributes.must_include :name
      @model.attributes.must_include :custom
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
deltacloud-core-1.1.2 tests/drivers/models/base_test.rb
deltacloud-core-1.1.1 tests/drivers/models/base_test.rb
deltacloud-core-1.1.0 tests/drivers/models/base_test.rb
deltacloud-core-1.0.5 tests/drivers/models/base_test.rb
deltacloud-core-1.0.4 tests/drivers/models/base_test.rb
deltacloud-core-1.0.3 tests/drivers/models/base_test.rb