Sha256: aab4df056c13d0f28c51c3b9f14546b026e73a4c75629642e3dceaa934782a17

Contents?: true

Size: 988 Bytes

Versions: 9

Compression:

Stored size: 988 Bytes

Contents

require 'logirel/queries'

module Logirel
  module Queries
    describe BoolQ, "when given input" do
      before(:each) { @out = StringIO.new }

      it "input says no, second time" do
        io = StringIO.new "x\nn"
        b = BoolQ.new "Yes or no?", true, io, @out
        b.exec.should be_false
      end
      it "input says yet, second time" do
        io = StringIO.new "x\ny"
        b = BoolQ.new "Yes or no?", false, io, @out
        b.exec.should be_true
      end
      it "input says yes" do
        io = StringIO.new "y"
        b = BoolQ.new "Yes or no?", false, io, @out
        b.exec.should be_true
      end
      it "input says no" do
        io = StringIO.new "n"
        b = BoolQ.new("Yes or no?", true, io, @out)
        b.exec.should be_false
      end
      it "input is default" do
        io = StringIO.new "\n"
        b = BoolQ.new("Yes or no?", true, io, @out)
        b.exec.should be_true
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logirel-0.1.6 spec/queries/bool_query_spec.rb
logirel-0.1.5 spec/queries/bool_query_spec.rb
logirel-0.1.4 spec/queries/bool_query_spec.rb
logirel-0.1.3 spec/queries/bool_query_spec.rb
logirel-0.1.2 spec/queries/bool_query_spec.rb
logirel-0.1.1 spec/queries/bool_query_spec.rb
logirel-0.1.0 spec/queries/bool_query_spec.rb
logirel-0.0.18 spec/queries/bool_query_spec.rb
logirel-0.0.17 spec/queries/bool_query_spec.rb