Sha256: 89b2e2c2e1e424c24b8a8e32049c8abdaf65014cac4ad978cc43006d59bf43ff
Contents?: true
Size: 671 Bytes
Versions: 7
Compression:
Stored size: 671 Bytes
Contents
require File.expand_path('../../../spec_helper', __FILE__) require 'hamster/immutable' describe Hamster::Immutable do describe "#transform" do class Person < Struct.new(:first, :last) include Hamster::Immutable public :transform end before do @original = Person.new("Simon", "Harris") @result = @original.transform { self.first = "Sampy" } end it "preserves the original" do @original.first.should == "Simon" @original.last.should == "Harris" end it "returns a new instance with the updated values" do @result.first.should == "Sampy" @result.last.should == "Harris" end end end
Version data entries
7 entries across 7 versions & 1 rubygems