Sha256: ad254ab1f85ace568bfecbecad725d8607ef69036d5c441555c156a893c90096

Contents?: true

Size: 429 Bytes

Versions: 4

Compression:

Stored size: 429 Bytes

Contents

class InputFaker
  def initialize(strings)
    @strings = Array(strings)
  end

  def gets
    next_string = @strings.shift
    # Uncomment the following line if you'd like to see the faked $stdin#gets
    # puts "(DEBUG) Faking #gets with: #{next_string}"
    next_string
  end

  def noecho
    @strings.shift
  end

  def self.with_fake_input(strings)
    $stdin = new(strings)
    yield
  ensure
    $stdin = STDIN
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shelly-0.4.28 spec/input_faker.rb
shelly-0.4.28.pre2 spec/input_faker.rb
shelly-0.4.28.pre spec/input_faker.rb
shelly-0.4.27 spec/input_faker.rb