Sha256: 468f1d887a5496ea80064740aa684df4a65b52fae43e99932509b8342b0e6b61
Contents?: true
Size: 835 Bytes
Versions: 3
Compression:
Stored size: 835 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 set attributes" do subject[:yeast]= "Top Fermenting" subject.yeast.must_equal "Top Fermenting" end it "#[]= should not set invalid attributes" do ->{ 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
liner-0.1.2 | test/liner/hashable_test.rb |
liner-0.1.1 | test/liner/hashable_test.rb |
liner-0.1.0 | test/liner/hashable_test.rb |