Sha256: 9c610d5ec9c242323da97dbbb7984c6232df403712ace00b1dd25571467e7769
Contents?: true
Size: 773 Bytes
Versions: 1
Compression:
Stored size: 773 Bytes
Contents
require 'spec_helper' describe StreetFighter do it "returns the final Right value if sequence only results in Rights" do fight1 = Proc.new{|_| Right.new("hey") } fight2 = Proc.new{|_| Right.new("hey") } StreetFighter.tournament(Object.new, fight1, fight2). must_equal Right.new("hey") end it "returns the first Left value if a computation fails in the sequence" do fight1 = Proc.new{|_| Right.new("hey") } fight2 = Proc.new{|_| Left.new("fail!") } StreetFighter.tournament(Object.new, fight1, fight2).must_equal Left.new("fail!") end it "raises an ArgumentError if the function doesn't return an EitherValue" do proc { StreetFighter.tournament(Object.new, Proc.new{ Object.new }) }. must_raise ArgumentError end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
street_fighter-0.0.1 | spec/street_fighter_spec.rb |