bmizerany-sinatra 0.9.0 → 0.9.0.2

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/static_test.rb CHANGED
@@ -1,13 +1,10 @@
1
- require 'test/spec'
2
- require 'sinatra/base'
3
- require 'sinatra/test'
1
+ require File.dirname(__FILE__) + '/helper'
4
2
 
5
3
  describe 'Static' do
6
- include Sinatra::Test
7
4
  F = ::File
8
5
 
9
6
  before do
10
- @app = mock_app {
7
+ mock_app {
11
8
  set :static, true
12
9
  set :public, F.dirname(__FILE__)
13
10
  }
@@ -15,46 +12,46 @@ describe 'Static' do
15
12
 
16
13
  it 'serves GET requests for files in the public directory' do
17
14
  get "/#{F.basename(__FILE__)}"
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'
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')
22
19
  end
23
20
 
24
21
  it 'serves HEAD requests for files in the public directory' do
25
22
  head "/#{F.basename(__FILE__)}"
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'
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')
30
27
  end
31
28
 
32
29
  it 'serves files in preference to custom routes' do
33
30
  @app.get("/#{F.basename(__FILE__)}") { 'Hello World' }
34
31
  get "/#{F.basename(__FILE__)}"
35
- should.be.ok
36
- body.should.not.equal 'Hello World'
32
+ assert ok?
33
+ assert body != 'Hello World'
37
34
  end
38
35
 
39
36
  it 'does not serve directories' do
40
37
  get "/"
41
- should.be.not_found
38
+ assert not_found?
42
39
  end
43
40
 
44
41
  it 'passes to the next handler when the static option is disabled' do
45
42
  @app.set :static, false
46
43
  get "/#{F.basename(__FILE__)}"
47
- should.be.not_found
44
+ assert not_found?
48
45
  end
49
46
 
50
47
  it 'passes to the next handler when the public option is nil' do
51
48
  @app.set :public, nil
52
49
  get "/#{F.basename(__FILE__)}"
53
- should.be.not_found
50
+ assert not_found?
54
51
  end
55
52
 
56
53
  it '404s when a file is not found' do
57
54
  get "/foobarbaz.txt"
58
- should.be.not_found
55
+ assert not_found?
59
56
  end
60
57
  end
@@ -1,10 +1,6 @@
1
- require 'test/spec'
2
- require 'sinatra/base'
3
- require 'sinatra/test'
1
+ require File.dirname(__FILE__) + '/helper'
4
2
 
5
3
  describe 'Templating' do
6
- include Sinatra::Test
7
-
8
4
  def render_app(&block)
9
5
  mock_app {
10
6
  def render_test(template, data, options, &block)
@@ -28,48 +24,56 @@ describe 'Templating' do
28
24
 
29
25
  it 'renders String templates directly' do
30
26
  render_app { render :test, 'Hello World' }
31
- should.be.ok
32
- body.should.equal 'Hello World'
27
+ assert ok?
28
+ assert_equal 'Hello World', body
33
29
  end
34
30
 
35
31
  it 'renders Proc templates using the call result' do
36
32
  render_app { render :test, Proc.new {'Hello World'} }
37
- should.be.ok
38
- body.should.equal 'Hello World'
33
+ assert ok?
34
+ assert_equal 'Hello World', body
39
35
  end
40
36
 
41
37
  it 'looks up Symbol templates in views directory' do
42
38
  render_app { render :test, :hello }
43
- should.be.ok
44
- body.should.equal "Hello World!\n"
39
+ assert ok?
40
+ assert_equal "Hello World!\n", body
45
41
  end
46
42
 
47
43
  it 'uses the default layout template if not explicitly overridden' do
48
44
  with_default_layout do
49
45
  render_app { render :test, :hello }
50
- should.be.ok
51
- body.should.equal "Layout!\nHello World!\n"
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
52
56
  end
53
57
  end
54
58
 
55
59
  it 'uses the layout template specified' do
56
60
  render_app { render :test, :hello, :layout => :layout2 }
57
- should.be.ok
58
- body.should.equal "Layout 2!\nHello World!\n"
61
+ assert ok?
62
+ assert_equal "Layout 2!\nHello World!\n", body
59
63
  end
60
64
 
61
65
  it 'uses layout templates defined with the #template method' do
62
66
  render_app { render :test, :hello, :layout => :layout3 }
63
- should.be.ok
64
- body.should.equal "Layout 3!\nHello World!\n"
67
+ assert ok?
68
+ assert_equal "Layout 3!\nHello World!\n", body
65
69
  end
66
70
 
67
71
  it 'loads templates from source file with use_in_file_templates!' do
68
72
  mock_app {
69
73
  use_in_file_templates!
70
74
  }
71
- @app.templates[:foo].should.equal "this is foo\n\n"
72
- @app.templates[:layout].should.equal "X\n= yield\nX\n"
75
+ assert_equal "this is foo\n\n", @app.templates[:foo]
76
+ assert_equal "X\n= yield\nX\n", @app.templates[:layout]
73
77
  end
74
78
  end
75
79
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bmizerany-sinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.0.2
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-06 00:00:00 -08:00
12
+ date: 2009-01-18 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.0
22
+ version: 0.9.1
23
23
  version:
24
24
  description: Classy web-development dressed in a DSL
25
- email:
25
+ email: sinatrarb@googlegroups.com
26
26
  executables: []
27
27
 
28
28
  extensions: []
@@ -31,6 +31,7 @@ extra_rdoc_files:
31
31
  - README.rdoc
32
32
  - LICENSE
33
33
  files:
34
+ - AUTHORS
34
35
  - CHANGES
35
36
  - LICENSE
36
37
  - README.rdoc
@@ -76,6 +77,7 @@ files:
76
77
  - lib/sinatra/images/500.png
77
78
  - lib/sinatra/main.rb
78
79
  - lib/sinatra/test.rb
80
+ - lib/sinatra/test/bacon.rb
79
81
  - lib/sinatra/test/rspec.rb
80
82
  - lib/sinatra/test/spec.rb
81
83
  - lib/sinatra/test/unit.rb
@@ -86,6 +88,7 @@ files:
86
88
  - test/erb_test.rb
87
89
  - test/filter_test.rb
88
90
  - test/haml_test.rb
91
+ - test/helper.rb
89
92
  - test/helpers_test.rb
90
93
  - test/mapped_error_test.rb
91
94
  - test/middleware_test.rb