Sha256: 6c3882f6c0f8ef20d535d944811d69c0e14431126891eee51c2a4fdda7824a98

Contents?: true

Size: 383 Bytes

Versions: 165

Compression:

Stored size: 383 Bytes

Contents

class InputFaker
  def initialize(strings)
    @strings = 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 self.with_fake_input(strings)
    $stdin = new(strings)
    yield
  ensure
    $stdin = STDIN
  end
end

Version data entries

165 entries across 165 versions & 1 rubygems

Version Path
shelly-0.3.8 spec/input_faker.rb
shelly-0.3.7 spec/input_faker.rb
shelly-0.3.6 spec/input_faker.rb
shelly-0.3.5 spec/input_faker.rb
shelly-0.3.5.pre spec/input_faker.rb
shelly-0.3.4 spec/input_faker.rb
shelly-0.3.3 spec/input_faker.rb
shelly-0.3.2 spec/input_faker.rb
shelly-0.3.1 spec/input_faker.rb
shelly-0.3.0 spec/input_faker.rb
shelly-0.2.28 spec/input_faker.rb
shelly-0.2.27 spec/input_faker.rb
shelly-0.2.26 spec/input_faker.rb
shelly-0.2.25 spec/input_faker.rb
shelly-0.2.24 spec/input_faker.rb
shelly-0.2.23 spec/input_faker.rb
shelly-0.2.22 spec/input_faker.rb
shelly-0.2.21 spec/input_faker.rb
shelly-0.2.20 spec/input_faker.rb
shelly-0.2.19 spec/input_faker.rb