rtomayko-sinatra 0.8.10 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/sass_test.rb CHANGED
@@ -1,6 +1,10 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'test/spec'
2
+ require 'sinatra/base'
3
+ require 'sinatra/test'
2
4
 
3
5
  describe "Sass Templates" do
6
+ include Sinatra::Test
7
+
4
8
  def sass_app(&block)
5
9
  mock_app {
6
10
  set :views, File.dirname(__FILE__) + '/views'
@@ -11,26 +15,26 @@ describe "Sass Templates" do
11
15
 
12
16
  it 'renders inline Sass strings' do
13
17
  sass_app { sass "#sass\n :background-color #FFF\n" }
14
- assert ok?
15
- assert_equal "#sass {\n background-color: #FFF; }\n", body
18
+ should.be.ok
19
+ body.should.equal "#sass {\n background-color: #FFF; }\n"
16
20
  end
17
21
 
18
22
  it 'renders .sass files in views path' do
19
23
  sass_app { sass :hello }
20
- assert ok?
21
- assert_equal "#sass {\n background-color: #FFF; }\n", body
24
+ should.be.ok
25
+ body.should.equal "#sass {\n background-color: #FFF; }\n"
22
26
  end
23
27
 
24
28
  it 'ignores the layout option' do
25
29
  sass_app { sass :hello, :layout => :layout2 }
26
- assert ok?
27
- assert_equal "#sass {\n background-color: #FFF; }\n", body
30
+ should.be.ok
31
+ body.should.equal "#sass {\n background-color: #FFF; }\n"
28
32
  end
29
33
 
30
34
  it "raises error if template not found" do
31
35
  mock_app {
32
36
  get('/') { sass :no_such_template }
33
37
  }
34
- assert_raise(Errno::ENOENT) { get('/') }
38
+ lambda { get('/') }.should.raise(Errno::ENOENT)
35
39
  end
36
40
  end
data/test/sinatra_test.rb CHANGED
@@ -1,4 +1,6 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'test/spec'
2
+ require 'sinatra/base'
3
+ require 'sinatra/test'
2
4
 
3
5
  describe 'Sinatra' do
4
6
  it 'creates a new Sinatra::Base subclass on new' do
@@ -8,6 +10,6 @@ describe 'Sinatra' do
8
10
  'Hello World'
9
11
  end
10
12
  end
11
- assert_same Sinatra::Base, app.superclass
13
+ app.superclass.should.be Sinatra::Base
12
14
  end
13
15
  end
data/test/static_test.rb CHANGED
@@ -1,10 +1,13 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'test/spec'
2
+ require 'sinatra/base'
3
+ require 'sinatra/test'
2
4
 
3
5
  describe 'Static' do
6
+ include Sinatra::Test
4
7
  F = ::File
5
8
 
6
9
  before do
7
- mock_app {
10
+ @app = mock_app {
8
11
  set :static, true
9
12
  set :public, F.dirname(__FILE__)
10
13
  }
@@ -12,46 +15,46 @@ describe 'Static' do
12
15
 
13
16
  it 'serves GET requests for files in the public directory' do
14
17
  get "/#{F.basename(__FILE__)}"
15
- assert ok?
16
- assert_equal File.read(__FILE__), body
17
- assert_equal File.size(__FILE__).to_s, response['Content-Length']
18
- assert response.headers.include?('Last-Modified')
18
+ should.be.ok
19
+ body.should.equal File.read(__FILE__)
20
+ response['Content-Length'].should.equal File.size(__FILE__).to_s
21
+ response.headers.should.include 'Last-Modified'
19
22
  end
20
23
 
21
24
  it 'serves HEAD requests for files in the public directory' do
22
25
  head "/#{F.basename(__FILE__)}"
23
- assert ok?
24
- assert_equal '', body
25
- assert_equal File.size(__FILE__).to_s, response['Content-Length']
26
- assert response.headers.include?('Last-Modified')
26
+ should.be.ok
27
+ body.should.be.empty
28
+ response['Content-Length'].should.equal File.size(__FILE__).to_s
29
+ response.headers.should.include 'Last-Modified'
27
30
  end
28
31
 
29
32
  it 'serves files in preference to custom routes' do
30
33
  @app.get("/#{F.basename(__FILE__)}") { 'Hello World' }
31
34
  get "/#{F.basename(__FILE__)}"
32
- assert ok?
33
- assert body != 'Hello World'
35
+ should.be.ok
36
+ body.should.not.equal 'Hello World'
34
37
  end
35
38
 
36
39
  it 'does not serve directories' do
37
40
  get "/"
38
- assert not_found?
41
+ should.be.not_found
39
42
  end
40
43
 
41
44
  it 'passes to the next handler when the static option is disabled' do
42
45
  @app.set :static, false
43
46
  get "/#{F.basename(__FILE__)}"
44
- assert not_found?
47
+ should.be.not_found
45
48
  end
46
49
 
47
50
  it 'passes to the next handler when the public option is nil' do
48
51
  @app.set :public, nil
49
52
  get "/#{F.basename(__FILE__)}"
50
- assert not_found?
53
+ should.be.not_found
51
54
  end
52
55
 
53
56
  it '404s when a file is not found' do
54
57
  get "/foobarbaz.txt"
55
- assert not_found?
58
+ should.be.not_found
56
59
  end
57
60
  end
@@ -1,6 +1,10 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'test/spec'
2
+ require 'sinatra/base'
3
+ require 'sinatra/test'
2
4
 
3
5
  describe 'Templating' do
6
+ include Sinatra::Test
7
+
4
8
  def render_app(&block)
5
9
  mock_app {
6
10
  def render_test(template, data, options, &block)
@@ -24,56 +28,48 @@ describe 'Templating' do
24
28
 
25
29
  it 'renders String templates directly' do
26
30
  render_app { render :test, 'Hello World' }
27
- assert ok?
28
- assert_equal 'Hello World', body
31
+ should.be.ok
32
+ body.should.equal 'Hello World'
29
33
  end
30
34
 
31
35
  it 'renders Proc templates using the call result' do
32
36
  render_app { render :test, Proc.new {'Hello World'} }
33
- assert ok?
34
- assert_equal 'Hello World', body
37
+ should.be.ok
38
+ body.should.equal 'Hello World'
35
39
  end
36
40
 
37
41
  it 'looks up Symbol templates in views directory' do
38
42
  render_app { render :test, :hello }
39
- assert ok?
40
- assert_equal "Hello World!\n", body
43
+ should.be.ok
44
+ body.should.equal "Hello World!\n"
41
45
  end
42
46
 
43
47
  it 'uses the default layout template if not explicitly overridden' do
44
48
  with_default_layout do
45
49
  render_app { render :test, :hello }
46
- assert ok?
47
- assert_equal "Layout!\nHello World!\n", body
48
- end
49
- end
50
-
51
- it 'uses the default layout template if not really overriden' do
52
- with_default_layout do
53
- render_app { render :test, :hello, :layout => true }
54
- assert ok?
55
- assert_equal "Layout!\nHello World!\n", body
50
+ should.be.ok
51
+ body.should.equal "Layout!\nHello World!\n"
56
52
  end
57
53
  end
58
54
 
59
55
  it 'uses the layout template specified' do
60
56
  render_app { render :test, :hello, :layout => :layout2 }
61
- assert ok?
62
- assert_equal "Layout 2!\nHello World!\n", body
57
+ should.be.ok
58
+ body.should.equal "Layout 2!\nHello World!\n"
63
59
  end
64
60
 
65
61
  it 'uses layout templates defined with the #template method' do
66
62
  render_app { render :test, :hello, :layout => :layout3 }
67
- assert ok?
68
- assert_equal "Layout 3!\nHello World!\n", body
63
+ should.be.ok
64
+ body.should.equal "Layout 3!\nHello World!\n"
69
65
  end
70
66
 
71
67
  it 'loads templates from source file with use_in_file_templates!' do
72
68
  mock_app {
73
69
  use_in_file_templates!
74
70
  }
75
- assert_equal "this is foo\n\n", @app.templates[:foo]
76
- assert_equal "X\n= yield\nX\n", @app.templates[:layout]
71
+ @app.templates[:foo].should.equal "this is foo\n\n"
72
+ @app.templates[:layout].should.equal "X\n= yield\nX\n"
77
73
  end
78
74
  end
79
75
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtomayko-sinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.10
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Mizerany
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-16 00:00:00 -08:00
12
+ date: 2009-01-06 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -19,10 +19,10 @@ dependencies:
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.9.1
22
+ version: 0.9.0
23
23
  version:
24
24
  description: Classy web-development dressed in a DSL
25
- email: sinatrarb@googlegroups.com
25
+ email:
26
26
  executables: []
27
27
 
28
28
  extensions: []
@@ -31,8 +31,7 @@ extra_rdoc_files:
31
31
  - README.rdoc
32
32
  - LICENSE
33
33
  files:
34
- - AUTHORS
35
- - CHANGES
34
+ - ChangeLog
36
35
  - LICENSE
37
36
  - README.rdoc
38
37
  - Rakefile
@@ -76,8 +75,8 @@ files:
76
75
  - lib/sinatra/images/404.png
77
76
  - lib/sinatra/images/500.png
78
77
  - lib/sinatra/main.rb
78
+ - lib/sinatra/rack/methodoverride.rb
79
79
  - lib/sinatra/test.rb
80
- - lib/sinatra/test/bacon.rb
81
80
  - lib/sinatra/test/rspec.rb
82
81
  - lib/sinatra/test/spec.rb
83
82
  - lib/sinatra/test/unit.rb
@@ -88,7 +87,6 @@ files:
88
87
  - test/erb_test.rb
89
88
  - test/filter_test.rb
90
89
  - test/haml_test.rb
91
- - test/helper.rb
92
90
  - test/helpers_test.rb
93
91
  - test/mapped_error_test.rb
94
92
  - test/middleware_test.rb
data/AUTHORS DELETED
@@ -1,40 +0,0 @@
1
- Sinatra was designed and developed by Blake Mizerany (bmizerany) in
2
- California. Continued development would not be possible without the ongoing
3
- financial support provided by Heroku <heroku.com> and the emotional support
4
- provided by Adam Wiggins (adamwiggins), Chris Wanstrath (defunkt), PJ Hyett (pjhyett), and
5
- the rest of the Github crew.
6
-
7
- Special thanks to the following extraordinary individuals, who-out which
8
- Sinatra would not be possible:
9
-
10
- * Ryan Tomayko (rtomayko) for constantly fixing whitespace errors 60d5006
11
- * Ezra Zygmuntowicz (ezmobius) for initial help and letting Blake steal
12
- some of merbs internal code.
13
- * Christopher Schneid (cschneid) for The Book, the blog (gittr.com),
14
- irclogger.com, and a bunch of useful patches.
15
- * Markus Prinz (cypher) for patches over the years, caring about
16
- the README, and hanging in there when times were rough.
17
- * Simon Rozet (sr) for a ton of doc patches, HAML options, and all that
18
- advocacy stuff he's going to do for 1.0.
19
- * Erik Kastner (kastner) for fixing MIME_TYPES under Rack 0.5.
20
- * Ben Bleything (bleything) for caring about HTTP status codes and doc fixes.
21
- * Igal Koshevoy (igal) for root path detection under Thin/Passenger.
22
- * Jon Crosby (jcrosby) for coffee breaks, doc fixes, and just because, man.
23
- * Karel Minarik (karmi) for screaming until the website came back up.
24
- * Jeremy Evans (jeremyevans) for unbreaking optional path params (twice!)
25
- * The GitHub guys for stealing Blake's table.
26
- * Nickolas Means (nmeans) for Sass template support.
27
- * Victor Hugo Borja (vic) for splat'n routes specs and doco.
28
- * Avdi Grimm (avdi) for basic RSpec support.
29
- * Jack Danger Canty for a more accurate root directory and for making me
30
- watch this just now: http://www.youtube.com/watch?v=ueaHLHgskkw.
31
- * Mathew Walker for making escaped paths work with static files.
32
- * Millions of Us for having the problem that led to Sinatra's conception.
33
- * Songbird for the problems that helped Sinatra's future become realized.
34
- * Rick Olsen (technoweenie) for the killer plug at RailsConf '08.
35
- * Steven Garcia for the amazing custom artwork you see on 404's and 500's
36
-
37
- and last but not least:
38
-
39
- * Frank Sinatra (chairman of the board) for having so much class he
40
- deserves a web-framework named after him.
data/CHANGES DELETED
@@ -1,185 +0,0 @@
1
- = 0.9.0 (unreleased)
2
-
3
- * Works with and requires Rack >= 0.9.1
4
-
5
- * Multiple Sinatra applications can now co-exist peacefully within a
6
- single process. The new "Sinatra::Base" class can be subclassed to
7
- establish a blank-slate Rack application or middleware component.
8
- Documentation on using these features is forth-coming; the following
9
- provides the basic gist: http://gist.github.com/38605
10
-
11
- * Parameters with subscripts are now parsed into a nested/recursive
12
- Hash structure. e.g., "post[title]=Hello&post[body]=World" yields
13
- params: {'post' => {'title' => 'Hello', 'body' => 'World'}}.
14
-
15
- * Regular expressions may now be used in route pattens; captures are
16
- available at "params[:captures]".
17
-
18
- * New ":provides" route condition takes an array of mime types and
19
- matches only when an Accept request header is present with a
20
- corresponding type. [cypher]
21
-
22
- * New request-level "pass" method; immediately exits the current block
23
- and passes control to the next matching route.
24
-
25
- * The request-level "body" method now takes a block; evaluation is
26
- deferred until an attempt is made to read the body. The block must
27
- return a String or Array.
28
-
29
- * New "route conditions" system for attaching rules for when a route
30
- matches. The :agent and :host route options now use this system.
31
-
32
- * New "dump_errors" option controls whether the backtrace is dumped to
33
- rack.errors when an exception is raised from a route. The option is
34
- enabled by default for top-level apps.
35
-
36
- * Better default "app_file", "root", "public", and "views" location
37
- detection; changes to "root" and "app_file" automatically cascade to
38
- other options that depend on them.
39
-
40
- * Error mappings are now split into two distinct layers: exception
41
- mappings and custom error pages. Exception mappings are registered
42
- with "error(Exception)" and are run only when the app raises an
43
- exception. Custom error pages are registered with "error(status_code)",
44
- where "status_code" is an integer, and are run any time the response
45
- has the status code specified. It's also possible to register an error
46
- page for a range of status codes: "error(500..599)".
47
-
48
- * Sinatra's testing support is no longer dependent on Test::Unit. Requiring
49
- 'sinatra/test' adds the Sinatra::Test module and Sinatra::TestHarness
50
- class, which can be used with any test framework. The 'sinatra/test/unit',
51
- 'sinatra/test/spec', 'sinatra/test/rspec', or 'sinatra/test/bacon' files
52
- can be required to setup a framework-specific testing environment. See the
53
- README for more information.
54
-
55
- * Added support for Bacon (test framework). The 'sinatra/test/bacon' file
56
- can be required to setup Sinatra test helpers on Bacon::Context.
57
-
58
- * Deprecated "set_option" and "set_options"; use "set" instead.
59
-
60
- * Deprecated the "env" option ("options.env"); use "environment" instead.
61
-
62
- * Deprecated the request level "stop" method; use "halt" instead.
63
-
64
- * Deprecated the request level "entity_tag" method; use "etag" instead.
65
- Both "entity_tag" and "etag" were previously supported.
66
-
67
- * Deprecated the request level "headers" method (HTTP response headers);
68
- use "response['Header-Name']" instead.
69
-
70
- * Deprecated "Sinatra.application"; use "Sinatra::Application" instead.
71
-
72
- * Deprecated setting Sinatra.application = nil to reset an application.
73
- This should no longer be necessary.
74
-
75
- * Deprecated "Sinatra.default_options"; use
76
- "Sinatra::Default.set(key, value)" instead.
77
-
78
- * Deprecated the "ServerError" exception. All Exceptions are now
79
- treated as internal server errors and result in a 500 response
80
- status.
81
-
82
- * Deprecated the "get_it", "post_it", "put_it", "delete_it", and "head_it"
83
- test helper methods. Use "get", "post", "put", "delete", and "head",
84
- respectively, instead.
85
-
86
- * Removed Event and EventContext classes. Applications are defined in a
87
- subclass of Sinatra::Base; each request is processed within an
88
- instance.
89
-
90
- = 0.3.3 / 2009-01-06
91
-
92
- * Pin to Rack 0.4.0 (this is the last release on Rack 0.4)
93
-
94
- * Log unhandled exception backtraces to rack.errors.
95
-
96
- * Use RACK_ENV environment variable to establish Sinatra
97
- environment when given. Thin sets this when started with
98
- the -e argument.
99
-
100
- * BUG: raising Sinatra::NotFound resulted in a 500 response
101
- code instead of 404.
102
-
103
- * BUG: use_in_file_templates! fails with CR/LF (#45)
104
-
105
- * BUG: Sinatra detects the app file and root path when run under
106
- thin/passenger.
107
-
108
- = 0.3.2
109
-
110
- * BUG: Static and send_file read entire file into String before
111
- sending. Updated to stream with 8K chunks instead.
112
-
113
- * Rake tasks and assets for building basic documentation website.
114
- See http://sinatra.rubyforge.org
115
-
116
- * Various minor doc fixes.
117
-
118
- = 0.3.1
119
-
120
- * Unbreak optional path parameters [jeremyevans]
121
-
122
- = 0.3.0
123
-
124
- * Add sinatra.gemspec w/ support for github gem builds. Forks can now
125
- enable the build gem option in github to get free username-sinatra.gem
126
- builds: gem install username-sinatra.gem --source=http://gems.github.com/
127
-
128
- * Require rack-0.4 gem; removes frozen rack dir.
129
-
130
- * Basic RSpec support; require 'sinatra/test/rspec' instead of
131
- 'sinatra/test/spec' to use. [avdi]
132
-
133
- * before filters can modify request environment vars used for
134
- routing (e.g., PATH_INFO, REQUEST_METHOD, etc.) for URL rewriting
135
- type functionality.
136
-
137
- * In-file templates now uses @@ instead of ## as template separator.
138
-
139
- * Top-level environment test predicates: development?, test?, production?
140
-
141
- * Top-level "set", "enable", and "disable" methods for tweaking
142
- app options. [rtomayko]
143
-
144
- * Top-level "use" method for building Rack middleware pipelines
145
- leading to app. See README for usage. [rtomayko]
146
-
147
- * New "reload" option - set false to disable reloading in development.
148
-
149
- * New "host" option - host/ip to bind to [cschneid]
150
-
151
- * New "app_file" option - override the file to reload in development
152
- mode [cschneid]
153
-
154
- * Development error/not_found page cleanup [sr, adamwiggins]
155
-
156
- * Remove a bunch of core extensions (String#to_param, String#from_param,
157
- Hash#from_params, Hash#to_params, Hash#symbolize_keys, Hash#pass)
158
-
159
- * Various grammar and formatting fixes to README; additions on
160
- community and contributing [cypher]
161
-
162
- * Build RDoc using Hanna template: http://sinatrarb.rubyforge.org/api
163
-
164
- * Specs, documentation and fixes for splat'n routes [vic]
165
-
166
- * Fix whitespace errors across all source files. [rtomayko]
167
-
168
- * Fix streaming issues with Mongrel (body not closed). [bmizerany]
169
-
170
- * Fix various issues with environment not being set properly (configure
171
- blocks not running, error pages not registering, etc.) [cypher]
172
-
173
- * Fix to allow locals to be passed to ERB templates [cschneid]
174
-
175
- * Fix locking issues causing random errors during reload in development.
176
-
177
- * Fix for escaped paths not resolving static files [Matthew Walker]
178
-
179
- = 0.2.1
180
-
181
- * File upload fix and minor tweaks.
182
-
183
- = 0.2.0
184
-
185
- * Initial gem release of 0.2 codebase.