Skip to content

Instantly share code, notes, and snippets.

@rtomayko
Forked from jmhodges/gist:113417
Created May 18, 2009 11:06
Show Gist options
  • Select an option

  • Save rtomayko/113420 to your computer and use it in GitHub Desktop.

Select an option

Save rtomayko/113420 to your computer and use it in GitHub Desktop.

Revisions

  1. rtomayko revised this gist May 18, 2009. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -8,11 +8,12 @@ class Foobar < Sinatra::Base
    end

    # The tests in test/test_foobar.rb
    require "sinatra/base"
    Sinatra::Base.set :environment, :test

    require "test/unit"
    require "foobar"

    Foobar.set :environment, :test

    class TestFoobar < Test::Unit::TestCase
    def setup
    @app = Foobar
  2. @jmhodges jmhodges revised this gist May 18, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,6 @@ def setup

    def test_sanity
    assert_equal :test, @app.environment
    assert_equal :test, @app.foobar
    assert_equal :test, @app.foobar, "this is the one that fails. it's :development"
    end
    end
  3. @jmhodges jmhodges created this gist May 18, 2009.
    25 changes: 25 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    # The code in lib/foobar.rb
    require 'sinatra/base'
    class Foobar < Sinatra::Base
    VERSION = '1.0.0'
    configure do
    set :foobar, environment
    end
    end

    # The tests in test/test_foobar.rb
    require "test/unit"
    require "foobar"

    Foobar.set :environment, :test

    class TestFoobar < Test::Unit::TestCase
    def setup
    @app = Foobar
    end

    def test_sanity
    assert_equal :test, @app.environment
    assert_equal :test, @app.foobar
    end
    end