Module: BigBand::Integration::Test

Includes:
Rack::Test::Methods
Included in:
Bacon, RSpec, TestUnit
Defined in:
lib/big_band/integration/test.rb

Overview

This encapsulates general test helpers. See Bacon, RSpec, Test::Spec and Test::Unit for examples.

Constant Summary collapse

Spec =
BigBand::Integration::TestSpec
Unit =
BigBand::Integration::TestUnit

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app(*options, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/big_band/integration/test.rb', line 19

def app(*options, &block)
  unless block.nil? and options.empty?
    superclass   = options.first if options.size == 1 and options.first.is_a? Class
    superclass ||= BigBand(*options)
    @app         = Class.new(superclass, &block)
    inspection   = "app"
    inspection << "(" << options.map { |o| o.inspect }.join(", ") << ")" unless options.empty?
    inspection << " { ... }" if block
    @app.class_eval "def self.inspect; #{inspection.inspect}; end"
  end
  @app || BigBand.applications.last || Sinatra::Application
end

Instance Method Details

#browse_route(verb, *args, &block) ⇒ Object



36
37
38
39
# File 'lib/big_band/integration/test.rb', line 36

def browse_route(verb, *args, &block)
  send(verb, *args, &block)
  last_response
end

#define_route(verb, *args, &block) ⇒ Object



32
33
34
# File 'lib/big_band/integration/test.rb', line 32

def define_route(verb, *args, &block)
  app.send(verb, *args, &block)
end