1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
Commit graph

24 commits

Author SHA1 Message Date
Olle Jonsson
1559a20b06 refactor: use __dir__ in File.expand_path
__dir__ is nice, and available.
2022-02-02 15:58:11 -05:00
Cadu Ribeiro
06e049c1a5
Include tests 2020-12-17 16:35:52 -03:00
Vipul A M
23c2e197c8 - Removed test-unit dependency
- updated minitest to 5.0
- Removed Test::Unit::TestCase and started using Minitest::Test instead
- Fixed usage of assert_raise
- Fixed usage of refute_nil
- Fixed and removed usage of assert_nothing_raised
2015-01-11 01:00:47 +05:30
Vipul A M
26a9d44b63 Kill empty test. 2014-08-31 20:11:33 -03:00
Vipul A M
b6648df1a9 Fix some warnings 2013-07-02 11:07:39 +05:30
Vipul A M
4fa3d9acb0 Just some typos, here and there! 2013-03-14 23:50:51 +05:30
Zachary Scott
46e8bd67b3 First pass at block styles for tests
TODO:
* test/routing_test.rb
* test/settings_test.rb
2012-05-21 17:21:59 -04:00
Konstantin Haase
f9b1c60ae4 wrap sinatra stack for nicer handling, fixes #496 2012-05-13 21:54:12 +02:00
Konstantin Haase
e001d62669 adjust require lines for test helper, so it also works properly on 1.9.2 2011-05-11 09:44:02 +02:00
Konstantin Haase
1d9034ff80 use new! rather than new for tests testing instance method
that way we ensure not to have any middleware in front of the Sinatra instance
2011-03-12 15:52:43 +01:00
Tim Carey-Smith
da37a88395 Less warnings to sate zenspider's needs 2009-05-18 03:36:03 -07:00
TJ Holowaychuk
54794fc823 Pass the class to configure blocks
This allows for the following idiom in top-level apps:

  configure do |app|
    set :foo, app.root + '/foo'
  end
2009-04-25 06:32:30 -07:00
Simon Rozet
ff0d068687 Use contest instead of test/spec/mini
See <http://github.com/citrusbyte/contest> for more info. The
contest.rb file is included under the test/ directory.
2009-03-31 02:23:48 -07:00
Ryan Tomayko
2d60f3ad94 Fix outdated bypassed specs - should have failed on last commit 2009-03-26 10:32:31 -07:00
Jon Crosby
0e6becf09d Add #bypassed callback before calling forward 2009-03-16 08:30:16 -07:00
Harry Vangberg
7196ea41c9 Fix issues with Content-Length after explicit forward [#159] 2009-02-25 09:36:56 -08:00
Ryan Tomayko
cf32f2e680 Middleware enhancements: automatic and explicit forward to downstream [#126] 2009-02-22 01:05:15 -08:00
Ryan Tomayko
6fd8aaadd1 Move a few specs out of base_test and into more appropriate tests 2009-02-22 01:04:01 -08:00
bmizerany
8019e117f8 Sugar added: redirect back 2009-01-29 19:37:20 -08:00
Ryan Tomayko
72a6e01daf use Test::Unit style assertions in Sinatra specs 2009-01-14 14:00:26 -08:00
Ryan Tomayko
c00a25ee41 Test framework refactoring
* Adds test/helper.rb and moves mock_app and other code specific
  to testing the framework out of Sinatra::Test.
* Do not require test/unit. The sinatra/test/unit,
  sinatra/test/spec, and sinatra/test/rspec files can be used to
  choose the framework.
* Add Sinatra::TestHarness, which should act similar to the
  Rack::Session proposal here: http://gist.github.com/41270
* Update the README with information on using the different test
  frameworks.
2009-01-14 07:52:04 -08:00
Ryan Tomayko
49c60151bf Fix ruby warnings
Cleans up all warnings generated from Sinatra. There's still
a bunch of warnings coming from HAML, though. It would be nice
if we could use Kernel#warn for deprecation notices but that's
going to be annoying if there's a bunch of unrelated warnings
from other libs.
2009-01-09 01:49:50 -08:00
Blake Mizerany
67906d391d A route can be redfined
This may need some clean-up
2009-01-08 18:35:00 -08:00
Ryan Tomayko
a734cf38ac I knew I shoulda taken that left turn at Hoboken
This is a fairly large reworking of Sinatra's innards. Although
most of the internal implementation has been modified, it
provides the same basic feature set and is meant to be compatible
with Sinatra 0.3.2.

* The Event and EventContext classes have been removed. Sinatra
  applications are now defined within the class context of a
  Sinatra::Base subclass; each request is processed within a new
  instance.

* Sinatra::Base can be used as a base class for multiple
  Rack applications within a single process and can be used as
  Rack middleware.

* The routing and result type processing implementation has been
  simplified and enhanced a bit. There's a new route conditions
  system for things like :agent/:host matching and a request
  level #pass method has been added to allow an event handler to
  exit immediately, passing control to the next matching route.

* Regular expressions may now be used in route patterns. Captures
  are available as an array from "params[:captures]".

* The #body helper method now takes a block. The block is not
  evaluated until an attempt is made to read the body.

* Options are now dynamically generated class attributes on the
  Sinatra::Base subclass (instead of OpenStruct); options are
  inherited by subclasses and may be overridden up the
  inheritance hierarchy. The Base.set manages all option related
  stuff.

* The application file (app_file) detection heuristics are bit
  more sane now. This fixes some bugs with reloading and
  public/views directory detection. All thin / passenger issues
  of these type should be better now.

* Error mappings are now split into to distinct layers: exception
  mappings and custom error pages. Exception mappings are registered
  with 'error(Exception)' and are run only when the app raises an
  exception. Custom error pages are registered with error(status_code)
  and are run any time the response has the status code specified.
  It's also possible to register an error page for a range of status
  codes: 'error(500..599)'.

* The spec and unit testing extensions have been modified to take
  advantage of the ability to have multiple Sinatra applications.
  The Sinatra::Test module must be included within the TestCase
  in order to take advantage of these methods (unless the
  'sinatra/compat' library has been required).

* Rebuilt specs from scratch for better coverage and
  organization. Sinatra 3.2 unit tests have been retained
  under ./compat to ensure a baseline level of compatibility with
  previous versions; use the 'rake compat' task to run these.

A large number of existing Sinatra idioms have been deprecated but
continue to be supported through the 'sinatra/compat' library.

* The "set_option" and "set_options" methods have been deprecated
  due to redundancy; use "set".

* The "env" option (Sinatra::Base.env) has been renamed to "environment"
  and deprecated because it's too easy to confuse with the request-level
  Rack environment Hash (Sinatra::Base#env).

* The request level "stop" method has been renamed "halt" and
  deprecated. This is for consistency with `throw :halt`.

* The request level "entity_tag" method has been renamed "etag" and
  deprecated. Both versions were previously supported.

* The request level "headers" method has been deprecated. Use
  response['Header-Name'] to access and modify response headers.

* Sinatra.application is deprecated. Use Sinatra::Application instead.

* Setting Sinatra.application = nil to reset an application is
  deprecated. You shouldn't have to reset objects anymore.

* The Sinatra.default_options Hash is deprecated. Modifying this object now
  results in "set(key, value)" invocations on the Sinatra::Base
  subclass.

* The "body.to_result" convention has been deprecated.

* The ServerError exception has been deprecated. Any Exception is now
  considered a ServerError.
2008-12-20 18:45:28 -08:00