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

28 commits

Author SHA1 Message Date
Philippe Durix
5beba64731 Used URI_INSTANCE unescape method instead of wild unescape function in the static files path computation 2015-07-20 17:10:34 +02: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
954d813f94 Quelch all warnings from static test. 2014-03-28 12:09:42 +08:00
Blake Watters
8fb79acb99 Add support for supplying options to static!, enabling the use of custom status codes, etc.
Add test case highlighting the breakage when attempting to use `send_file` with a specific status code. refs sinatra/sinatra#749
2013-09-27 11:05:29 -04:00
Jordan Moncharmont
00b63ec5a5 HEAD requests on static files should have proper Content-Length
Code originally intending to fix byte encodings was overwriting the
proper Content-Length headers set by send_file

also contains 2 trailing whitespace fixes
2012-05-23 13:43:23 -07:00
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
31a4f31569 Rack 1.4 returns Content-Length: 0 for HEAD requests 2011-12-30 12:15:09 +01:00
Konstantin Haase
d1ab58deb3 rename public to public_folder, fixes #301 2011-06-16 00:24:27 +02:00
kenichi nakamura
9dc155f3e9 adds check for :static_cache_control setting to Sinatra::Base.static! 2011-06-06 11:09:41 -07: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
Krekoten' Marjan
3ef3c0952f Rename test_valid_range to assert_valid_range
MiniTets treats all /test.*/ methods as test examples.

Signed-off-by: Konstantin Haase <konstantin.mailinglists@googlemail.com>
2010-10-19 16:26:43 +02:00
Jens Alfke
9a01e3d492 Re-implement byte-range support for static files.
Correct handling of "Range:" request header. Replaces buggy implementation (480b1e8, 44ab090) that was recently backed out.
Fixes #93.

NOTE: Does not yet support multiple ranges (e.g. "bytes=1-10,20-30") because that requires sending a multipart response, which is more complex than I want to get into now.

Signed-off-by: Konstantin Haase <konstantin.mailinglists@googlemail.com>
2010-10-17 21:50:27 +02:00
Konstantin Haase
1d993c8053 Remove buggy support for range requests for now. Reverts 480b1e8 and 44ab090. 2010-10-17 09:38:22 +02:00
JP Hastings-Spital
480b1e8ebe send_file now copes with 'Range: bytes=100-400,500-600' headers
Signed-off-by: Konstantin Haase <konstantin.mailinglists@googlemail.com>
2010-10-10 10:44:09 +02:00
Ryan Tomayko
84b82a3712 set sinara.static_file env var when serving static files 2010-01-28 09:00:56 -08:00
Ryan Tomayko
d5c5aca35f Better route and filter inheritance [#180] 2009-06-07 04:11:14 -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
ed98aed36f Fix directory traversal vulnerability in static file route [#177] 2009-03-09 14:56:38 -07:00
Ryan Tomayko
d074e0c6f0 Fix constant resolution in specs under 1.9
The way constants are set/resolved in class_eval blocks seems
to have changed significantly. Move constants to top-level to
remedy the situation for now.
2009-02-02 18:49:11 -08:00
Ryan Tomayko
c0a2fbc8b1 Make static files work with Rack::Lint in the pipeline [#121] 2009-01-21 11:37:56 -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
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
Blake Mizerany
fbdf982f42 Streaming 2008-02-24 16:04:18 -08:00
Blake Mizerany
a203474d47 tests 2007-12-02 15:41:58 -08:00
Blake Mizerany
5e5f0c021a starting 2007-11-27 19:12:06 -08:00
Blake Mizerany
eb3ab51e72 * reset! for tests
* logging
2007-11-25 16:29:11 -08:00
Blake Mizerany
1a02907a2b static files 2007-11-23 17:32:21 -08:00