Sha256: 79e689bea9da2d432d580c2a97fa703b83dff2de459e311e1805fe4826a275d9

Contents?: true

Size: 823 Bytes

Versions: 3

Compression:

Stored size: 823 Bytes

Contents

require 'logirel/q_model'
describe Logirel::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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
logirel-0.0.15 spec/queries/bool_query_spec.rb
logirel-0.0.14 spec/queries/bool_query_spec.rb
logirel-0.0.8 spec/queries/bool_query_spec.rb