rtomayko-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/sass_test.rb CHANGED
@@ -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 "Sass Templates" do
6
- include Sinatra::Test
7
-
8
4
  def sass_app(&block)
9
5
  mock_app {
10
6
  set :views, File.dirname(__FILE__) + '/views'
@@ -15,26 +11,26 @@ describe "Sass Templates" do
15
11
 
16
12
  it 'renders inline Sass strings' do
17
13
  sass_app { sass "#sass\n :background-color #FFF\n" }
18
- should.be.ok
19
- body.should.equal "#sass {\n background-color: #FFF; }\n"
14
+ assert ok?
15
+ assert_equal "#sass {\n background-color: #FFF; }\n", body
20
16
  end
21
17
 
22
18
  it 'renders .sass files in views path' do
23
19
  sass_app { sass :hello }
24
- should.be.ok
25
- body.should.equal "#sass {\n background-color: #FFF; }\n"
20
+ assert ok?
21
+ assert_equal "#sass {\n background-color: #FFF; }\n", body
26
22
  end
27
23
 
28
24
  it 'ignores the layout option' do
29
25
  sass_app { sass :hello, :layout => :layout2 }
30
- should.be.ok
31
- body.should.equal "#sass {\n background-color: #FFF; }\n"
26
+ assert ok?
27
+ assert_equal "#sass {\n background-color: #FFF; }\n", body
32
28
  end
33
29
 
34
30
  it "raises error if template not found" do
35
31
  mock_app {
36
32
  get('/') { sass :no_such_template }
37
33
  }
38
- lambda { get('/') }.should.raise(Errno::ENOENT)
34
+ assert_raise(Errno::ENOENT) { get('/') }
39
35
  end
40
36
  end
data/test/sinatra_test.rb CHANGED
@@ -1,6 +1,4 @@
1
- require 'test/spec'
2
- require 'sinatra/base'
3
- require 'sinatra/test'
1
+ require File.dirname(__FILE__) + '/helper'
4
2
 
5
3
  describe 'Sinatra' do
6
4
  it 'creates a new Sinatra::Base subclass on new' do
@@ -10,6 +8,6 @@ describe 'Sinatra' do
10
8
  'Hello World'
11
9
  end
12
10
  end
13
- app.superclass.should.be Sinatra::Base
11
+ assert_same Sinatra::Base, app.superclass
14
12
  end
15
13
  end
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: rtomayko-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,7 +31,8 @@ extra_rdoc_files:
31
31
  - README.rdoc
32
32
  - LICENSE
33
33
  files:
34
- - ChangeLog
34
+ - AUTHORS
35
+ - CHANGES
35
36
  - LICENSE
36
37
  - README.rdoc
37
38
  - Rakefile
@@ -75,8 +76,8 @@ files:
75
76
  - lib/sinatra/images/404.png
76
77
  - lib/sinatra/images/500.png
77
78
  - lib/sinatra/main.rb
78
- - lib/sinatra/rack/methodoverride.rb
79
79
  - lib/sinatra/test.rb
80
+ - lib/sinatra/test/bacon.rb
80
81
  - lib/sinatra/test/rspec.rb
81
82
  - lib/sinatra/test/spec.rb
82
83
  - lib/sinatra/test/unit.rb
@@ -87,6 +88,7 @@ files:
87
88
  - test/erb_test.rb
88
89
  - test/filter_test.rb
89
90
  - test/haml_test.rb
91
+ - test/helper.rb
90
92
  - test/helpers_test.rb
91
93
  - test/mapped_error_test.rb
92
94
  - test/middleware_test.rb
data/ChangeLog DELETED
@@ -1,96 +0,0 @@
1
- = 0.3.3 / 2009-01-06
2
-
3
- * Pin to Rack 0.4.0 (this is the last release on Rack 0.4)
4
-
5
- * Log unhandled exception backtraces to rack.errors.
6
-
7
- * Use RACK_ENV environment variable to establish Sinatra
8
- environment when given. Thin sets this when started with
9
- the -e argument.
10
-
11
- * BUG: raising Sinatra::NotFound resulted in a 500 response
12
- code instead of 404.
13
-
14
- * BUG: use_in_file_templates! failes with CR/LF (#45)
15
-
16
- * BUG: Sinatra detects the app file and root path when run under
17
- thin/passenger.
18
-
19
- = 0.3.2
20
-
21
- * BUG: Static and send_file read entire file into String before
22
- sending. Updated to stream with 8K chunks instead.
23
-
24
- * Rake tasks and assets for building basic documentation website.
25
- See http://sinatra.rubyforge.org
26
-
27
- * Various minor doc fixes.
28
-
29
- = 0.3.1
30
-
31
- * Unbreak optional path parameters [jeremyevans]
32
-
33
- = 0.3.0
34
-
35
- * Add sinatra.gemspec w/ support for github gem builds. Forks can now
36
- enable the build gem option in github to get free username-sinatra.gem
37
- builds: gem install username-sinatra.gem --source=http://gems.github.com/
38
-
39
- * Require rack-0.4 gem; removes frozen rack dir.
40
-
41
- * Basic RSpec support; require 'sinatra/test/rspec' instead of
42
- 'sinatra/test/spec' to use. [avdi]
43
-
44
- * before filters can modify request environment vars used for
45
- routing (e.g., PATH_INFO, REQUEST_METHOD, etc.) for URL rewriting
46
- type functionality.
47
-
48
- * In-file templates now uses @@ instead of ## as template separator.
49
-
50
- * Top-level environment test predicates: development?, test?, production?
51
-
52
- * Top-level "set", "enable", and "disable" methods for tweaking
53
- app options. [rtomayko]
54
-
55
- * Top-level "use" method for building Rack middleware pipelines
56
- leading to app. See README for usage. [rtomayko]
57
-
58
- * New "reload" option - set false to disable reloading in development.
59
-
60
- * New "host" option - host/ip to bind to [cschneid]
61
-
62
- * New "app_file" option - override the file to reload in development
63
- mode [cschneid]
64
-
65
- * Development error/not_found page cleanup [sr, adamwiggins]
66
-
67
- * Remove a bunch of core extensions (String#to_param, String#from_param,
68
- Hash#from_params, Hash#to_params, Hash#symbolize_keys, Hash#pass)
69
-
70
- * Various grammar and formatting fixes to README; additions on
71
- community and contributing [cypher]
72
-
73
- * Build RDoc using Hanna template: http://sinatrarb.rubyforge.org/api
74
-
75
- * Specs, documentation and fixes for splat'n routes [vic]
76
-
77
- * Fix whitespace errors across all source files. [rtomayko]
78
-
79
- * Fix streaming issues with Mongrel (body not closed). [bmizerany]
80
-
81
- * Fix various issues with environment not being set properly (configure
82
- blocks not running, error pages not registering, etc.) [cypher]
83
-
84
- * Fix to allow locals to be passed to ERB templates [cschneid]
85
-
86
- * Fix locking issues causing random errors during reload in development.
87
-
88
- * Fix for escaped paths not resolving static files [Matthew Walker]
89
-
90
- = 0.2.1
91
-
92
- * File upload fix and minor tweaks.
93
-
94
- = 0.2.0
95
-
96
- * Initial gem release of 0.2 coebase.