Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.