Sha256: ba6dfcdc97b9fb4f18974129ba9f3c8213ff020579fb95264c22e382b99a2cdc

Contents?: true

Size: 521 Bytes

Versions: 7

Compression:

Stored size: 521 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)

require 'hamster/immutable'

describe Hamster::Immutable do

  describe "#new" do

    class Person < Struct.new(:first, :last)
      include Hamster::Immutable
    end

    before do
      @instance = Person.new("Simon", "Harris")
    end

    it "passes the constructor arguments" do
      @instance.first.should == "Simon"
      @instance.last.should == "Harris"
    end

    it "freezes the instance" do
      @instance.should be_frozen
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hamster-0.3.6 spec/hamster/immutable/new_spec.rb
hamster-0.3.5 spec/hamster/immutable/new_spec.rb
hamster-0.3.4 spec/hamster/immutable/new_spec.rb
hamster-0.3.3 spec/hamster/immutable/new_spec.rb
hamster-0.3.2 spec/hamster/immutable/new_spec.rb
hamster-0.3.1 spec/hamster/immutable/new_spec.rb
hamster-0.3.0 spec/hamster/immutable/new_spec.rb