Created
January 2, 2013 05:13
-
-
Save myronmarston/4432380 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Hamster | |
def self.vector(*args) | |
Vector.new(args) | |
end | |
class Vector < ::Array | |
alias add << | |
end | |
end | |
describe Hamster::Vector do | |
describe "#add" do | |
def vector(*args) | |
Hamster.vector(*args) | |
end | |
let(:empty) { vector } | |
it "preserves the original" do | |
v = empty | |
v.add("A") | |
v.should == empty | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment