Sha256: 7d0f91c3d2e7ba23a52ffd12ed7b289a9f66447b600233953e1c48cef24d8ae9
Contents?: true
Size: 974 Bytes
Versions: 2
Compression:
Stored size: 974 Bytes
Contents
describe Liner::Hashable do subject { Beer.new(:hops => 'Cascade') } it "#[] should read attributes" do subject[:hops].must_equal "Cascade" subject[:yeast].must_equal nil end it "[] should not read invalid attributes" do Proc.new { subject[:foo] }.must_raise ArgumentError end it "#[]= should set attributes" do subject[:yeast]= "Top Fermenting" subject.yeast.must_equal "Top Fermenting" end it "#[]= should not set invalid attributes" do Proc.new { subject[:foo] = 'bar' }.must_raise ArgumentError end it "liner should be a hash of attributes" do subject.liner.must_equal({ :hops => 'Cascade', :yeast => nil }) end it "liner= should set the attributes" do hash = {:hops => 'Columbus', :yeast => 'Bottom Fermenting' } subject.liner = hash subject.liner.must_equal(hash) end it "#to_h should return the attribute hash" do subject.to_h.must_equal({ :hops => 'Cascade', :yeast => nil }) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
liner-0.2.4 | test/liner/hashable_test.rb |
liner-0.2.3 | test/liner/hashable_test.rb |