Sha256: 39673d9937c2c53b8f3d05cf77e722ea9ffab2440689640f76d13f06aed4d358

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

dependencies = %w{
  bacon
  mocha/standalone
  mocha/object
  sinatra
}

begin
  dependencies.each {|f| require f }
rescue LoadError
  require 'rubygems'
  dependencies.each {|f| require f }
end

require File.join(File.dirname(__FILE__), '..', 'lib', 'vegas.rb')
require File.join(File.dirname(__FILE__), 'apps.rb')


module TestHelper
  
  def vegas(*args, &block)
    Vegas::Runner.any_instance.stubs(:daemonize!).once
    Rack::Handler::Thin.stubs(:run).once
    @vegas = Vegas::Runner.new(*args, &block)
  end
  
  def body
    last_response.body.to_s
  end

  def instance_of(klass)
    lambda {|obj| obj.is_a?(klass) }
  end
  
  def exist_as_file
    lambda {|obj| File.exist?(obj) }
  end
  
  def have_matching_file_content(content_regex)
    lambda {|obj| 
      File.exist?(obj) && File.read(obj).match(content_regex) 
    }
  end

  def html_body
    body =~ /^\<html/ ? body : "<html><body>#{body}</body></html>"
  end

end

module Bacon
  summary_on_exit
  # extend TestUnitOutput
  class Context; include TestHelper; end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vegas-0.1.7 test/test_helper.rb
vegas-0.1.6 test/test_helper.rb
vegas-0.1.5 test/test_helper.rb
vegas-0.1.4 test/test_helper.rb
vegas-0.1.3 test/test_helper.rb