Sha256: a9dda12c696854bb9a66ff417ebab01ed260ec6d775d5916f9e61870149e5317
Contents?: true
Size: 425 Bytes
Versions: 7
Compression:
Stored size: 425 Bytes
Contents
describe "Ternary condition operator" do it "returns the second argument if the condition is true" do (true ? 1 : 2).should == 1 end it "returns the third argument if the condition is false" do (false ? 1 : 2).should == 2 end it "doesn't get confused if : follows a string literal" do # this could be interpreted as a Ruby 1.9 symbol hash key (true ?'str':'another str').should == 'str' end end
Version data entries
7 entries across 7 versions & 1 rubygems