Sha256: 4ae060e1a5d31a3980f2624f755b5e672bbe10c2a521a8734ef4385bc371da86

Contents?: true

Size: 1.1 KB

Versions: 53

Compression:

Stored size: 1.1 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.expand_path(File.dirname(__FILE__)), '..', 'lib', 'vegas.rb')
require File.join(File.expand_path(File.dirname(__FILE__)), 'apps.rb')


module TestHelper

  def vegas(*args, &block)
    Vegas::Runner.any_instance.stubs(:daemonize!).once

    Vegas::JRUBY ? Rack::Handler::WEBrick.stubs(:run).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

53 entries across 53 versions & 6 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/vegas-0.1.11/test/test_helper.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.7.5 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.7.4 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.7.3 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.7.2 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.7.1 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.7.0 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.6.9 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.6.8 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.6.7 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.6.6 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.6.5 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.6.4 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.6.3 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.6.2 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.6.1 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.6.0 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb
classiccms-0.5.17 vendor/bundle/gems/vegas-0.1.11/test/test_helper.rb