public
Description: IRB Power User Utility Belt
Homepage: http://utilitybelt.rubyforge.org
Clone URL: git://github.com/gilesbowkett/utility-belt.git
Search Repo:
Giles Bowkett (author)
Tue Feb 26 11:27:51 -0800 2008
utility-belt / spec / hash_math_spec.rb
100644 17 lines (13 sloc) 0.429 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require File.join(File.dirname(__FILE__), "spec_helper")
require "lib/utility_belt/hash_math"
describe "Hash math" do
 
  it "should add hashes" do
    ({:a => :b} + {:c => :d}).should == {:a => :b, :c => :d}
  end
 
  it "should subtract hashes" do
    ({:a => :b, :c => :d} - {:c => :d}).should == {:a => :b}
  end
 
  it "should subtract key/value pairs by key" do
    ({:a => :b, :c => :d} - :c).should == {:a => :b}
  end
 
end