Sha256: ac3f0af7ac407d2853e725970326c46768f46469264c46e016582248cb06c59d

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 Bytes

Contents

require 'minitest/autorun'

require 'rr'

class MiniTest::Spec
  include RR::Adapters::RRMethods
end

require 'config/environment'

# Pry testing stuff (taken from Pry itself)

Pry.color = false

def redirect_pry_io(new_in, new_out = StringIO.new)
  old_in  = Pry.input
  old_out = Pry.output

  Pry.input  = new_in
  Pry.output = new_out

  begin
    yield
  ensure
    Pry.input  = old_in
    Pry.output = old_out
  end
end

def mock_pry(*args)
  binding = args.first.is_a?(Binding) ? args.shift : binding()
  input   = StringIO.new(args.join("\n"))
  output  = StringIO.new

  redirect_pry_io(input, output) do
    Pry.start(binding, :hooks => Pry::Hooks.new)
  end

  output.string
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pry-rails-0.3.2 spec/spec_helper.rb
pry-rails-0.3.1 spec/spec_helper.rb