Sha256: eeae551cbd22eb4827172eead7bcfd402793cfe3c6caa194a771fb70354f8119

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

<%- if vendor -%>
$:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'sinatra', 'lib')
<%- end -%>
require 'sinatra'
require 'rack/test'

Sinatra::Default.set(
  :environment => :test,
  :run => false,
  :raise_errors => true,
  :logging => false
)

require File.join(File.dirname(__FILE__), '..', '<%= app_name %>.rb')

module TestHelper
  
  def app
    # change to your app class if using the 'classy' style
    Sinatra::Application.new
  end
  
  def body
    last_response.body
  end
  
  def status
    last_response.status
  end
  
  include Rack::Test::Methods

end

<%- case test_framework  -%>
<%- when 'rspec' -%>
require 'spec'
require 'spec/interop/test'

Spec::Runner.configure do |config|
  include TestHelper
end
<%- when 'bacon' -%>
require 'bacon'

Bacon::Context.send(:include, TestHelper)
<%- when 'spec' -%>
require 'test/spec'
<%- when 'shoulda' -%>
require 'test/unit'
require 'shoulda'

Test::Unit::TestCase.send(:include, TestHelper)
<%- when 'unit' -%>
require 'test/unit'

Test::Unit::TestCase.send(:include, TestHelper)
<%- end -%>

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
quirkey-sinatra-gen-0.3.0 app_generators/sinatra_app/templates/test/test_helper.rb.erb
sinatra-gen-0.3.0 app_generators/sinatra_app/templates/test/test_helper.rb.erb