Sha256: 9251a2546b0a9fc2a5a6740640e7dd75b900c4ca1a25c44cc6323d480a795389

Contents?: true

Size: 686 Bytes

Versions: 2

Compression:

Stored size: 686 Bytes

Contents

require 'spec_helper'

describe Hashme do
  
  before :each do
    @model = Class.new do
      include Hashme
      property :name, String
    end
  end
  
  describe '.build' do
    it "should create a Model and give a block to build it" do
      @model.should_receive(:call_in_block)
      @model.build do |model|
        @model.call_in_block
        model.should be_kind_of(@model)
      end
    end
  end

  describe "#initialize" do

    it "should accept nil" do
      expect {
        @obj = @model.new
      }.to_not raise_error
    end

    it "should accept and set attributes" do
      @obj = @model.new(:name => "Sam")
      @obj.name.should eql("Sam")
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hashme-0.1.1 spec/hashme/base_spec.rb
hashme-0.1.0 spec/hashme/base_spec.rb