Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v1.3.0
Fetching contributors…

Cannot retrieve contributors at this time

file 33 lines (25 sloc) 0.681 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
require 'backports'
require_relative 'spec_helper'

describe Sinatra::Extension do
  module ExampleExtension
    extend Sinatra::Extension

    set :foo, :bar
    settings.set :bar, :blah

    configure :test, :production do
      set :reload_stuff, false
    end

    configure :development do
      set :reload_stuff, true
    end

    get '/' do
      "from extension, yay"
    end
  end

  before { mock_app { register ExampleExtension }}

  it('allows using set') { settings.foo.should == :bar }
  it('implements configure') { settings.reload_stuff.should be_false }

  it 'allows defing routes' do
    get('/').should be_ok
    body.should == "from extension, yay"
  end
end
Something went wrong with that request. Please try again.