spec/unboolean/maybe_spec.rb in unboolean-0.0.1 vs spec/unboolean/maybe_spec.rb in unboolean-0.0.2

- old
+ new

@@ -1,24 +1,37 @@ require 'spec_helper' -describe Unboolean::Maybe do - subject(:maybe) { described_class.new } +describe 'maybe' do + subject(:maybe) { Unboolean::Maybe.new } - specify('maybe MAY BE maybe') { expect(maybe).to eql(maybe) } - specify('NOT maybe may be maybe') { expect(!maybe).to eql(maybe) } + its(:inspect) { should == 'maybe' } - specify('maybe MAY BE equal to maybe') { expect(maybe == maybe).to eql(maybe) } - specify('maybe MAY BE equal to true') { expect(maybe == true).to eql(maybe) } - specify('maybe MAY BE equal to false') { expect(maybe == false).to eql(maybe) } + specify('#=> maybe') { expect(subject).to eql(maybe) } - specify('maybe AND true may be maybe') { expect(maybe & true).to eql(maybe) } - specify('maybe AND false may be false') { expect(maybe & false).to eql(false) } - specify('maybe AND maybe may be maybe') { expect(maybe & maybe).to eql(maybe) } + context '!' do + specify('#=> maybe') { expect(!subject).to eql(maybe) } + end - specify('maybe OR true should be true') { expect(maybe | true).to eql(true) } - specify('maybe OR false may be maybe') { expect(maybe | false).to eql(maybe) } - specify('maybe OR maybe may be maybe') { expect(maybe | maybe).to eql(maybe) } + context '==' do + specify('true #=> maybe') { expect(subject == true).to eql(maybe) } + specify('false #=> maybe') { expect(subject == false).to eql(maybe) } + specify('maybe #=> maybe') { expect(subject == maybe).to eql(maybe) } + end - specify('maybe XOR true may be maybe') { expect(maybe ^ true).to eql(maybe) } - specify('maybe XOR false may be maybe') { expect(maybe ^ false).to eql(maybe) } - specify('maybe XOR maybe may be maybe') { expect(maybe ^ maybe).to eql(maybe) } + context '&' do + specify('true #=> maybe') { expect(subject & true).to eql(maybe) } + specify('false #=> false') { expect(subject & false).to eql(false) } + specify('maybe #=> maybe') { expect(subject & maybe).to eql(maybe) } + end + + context '|' do + specify('true #=> true') { expect(subject | true).to eql(true) } + specify('false #=> maybe') { expect(subject | false).to eql(maybe) } + specify('maybe #=> maybe') { expect(subject | maybe).to eql(maybe) } + end + + context '^' do + specify('true #=> maybe') { expect(subject ^ true).to eql(maybe) } + specify('false #=> maybe') { expect(subject ^ false).to eql(maybe) } + specify('maybe #=> maybe') { expect(subject ^ maybe).to eql(maybe) } + end end