wbzyl-sinatra-rdiscount 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +4 -0
- data/examples/mapp.rb +15 -0
- data/test/sinatra_rdiscount_test.rb +18 -18
- data/test/test_helper.rb +4 -2
- metadata +26 -22
- data/.gitignore +0 -2
- data/sinatra-rdiscount.gemspec +0 -33
data/VERSION.yml
ADDED
data/examples/mapp.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sinatra/base'
|
3
|
+
require 'sinatra/rdiscount'
|
4
|
+
|
5
|
+
require 'rack'
|
6
|
+
|
7
|
+
class MApp < Sinatra::Base
|
8
|
+
helpers Sinatra::RDiscount
|
9
|
+
|
10
|
+
get '/' do
|
11
|
+
rdiscount "## hello form modular app"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Rack::Handler::Thin.run MApp.new, :Port => 4567
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper'
|
2
2
|
|
3
3
|
class SinatraRDiscountTest < Test::Unit::TestCase
|
4
|
-
include
|
4
|
+
include Rack::Test::Methods
|
5
5
|
|
6
6
|
def rdiscount_app(&block)
|
7
7
|
mock_app {
|
8
8
|
set :views, File.dirname(__FILE__) + '/views'
|
9
|
-
helpers Sinatra::
|
9
|
+
helpers Sinatra::RDiscount
|
10
10
|
set :show_exceptions, false
|
11
11
|
get '/', &block
|
12
12
|
}
|
@@ -15,20 +15,20 @@ class SinatraRDiscountTest < Test::Unit::TestCase
|
|
15
15
|
|
16
16
|
def test_renders_inline_strings
|
17
17
|
rdiscount_app { rdiscount 'hello world' }
|
18
|
-
assert ok?
|
19
|
-
assert_equal "<p>hello world</p>\n", body
|
18
|
+
assert last_response.ok?
|
19
|
+
assert_equal "<p>hello world</p>\n", last_response.body
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_renders_inline_erb_string
|
23
23
|
rdiscount_app { rdiscount '{%= 1 + 1 %}' }
|
24
|
-
assert ok?
|
25
|
-
assert_equal "<p>2</p>\n", body
|
24
|
+
assert last_response.ok?
|
25
|
+
assert_equal "<p>2</p>\n", last_response.body
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_renders_files_in_views_path
|
29
29
|
rdiscount_app { rdiscount :hello }
|
30
|
-
assert ok?
|
31
|
-
assert_equal "<h1>hello world</h1>\n", body
|
30
|
+
assert last_response.ok?
|
31
|
+
assert_equal "<h1>hello world</h1>\n", last_response.body
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_takes_locals_option
|
@@ -36,30 +36,30 @@ class SinatraRDiscountTest < Test::Unit::TestCase
|
|
36
36
|
locals = {:foo => 'Bar'}
|
37
37
|
rdiscount "{%= foo %}", :locals => locals
|
38
38
|
}
|
39
|
-
assert ok?
|
40
|
-
assert_equal "<p>Bar</p>\n", body
|
39
|
+
assert last_response.ok?
|
40
|
+
assert_equal "<p>Bar</p>\n", last_response.body
|
41
41
|
end
|
42
42
|
|
43
43
|
def test_renders_with_inline_layouts
|
44
44
|
rdiscount_app {
|
45
45
|
rdiscount 'Sparta', :layout => 'THIS. IS. <%= yield.upcase %>'
|
46
46
|
}
|
47
|
-
assert ok?
|
48
|
-
assert_equal "THIS. IS. <P>SPARTA</P>\n", body
|
47
|
+
assert last_response.ok?
|
48
|
+
assert_equal "THIS. IS. <P>SPARTA</P>\n", last_response.body
|
49
49
|
end
|
50
50
|
|
51
51
|
def test_renders_with_file_layouts
|
52
52
|
rdiscount_app {
|
53
53
|
rdiscount 'hello world', :layout => :layout2
|
54
54
|
}
|
55
|
-
assert ok?
|
56
|
-
assert_equal "erb layout\n<p>hello world</p>\n\n", body
|
55
|
+
assert last_response.ok?
|
56
|
+
assert_equal "erb layout\n<p>hello world</p>\n\n", last_response.body
|
57
57
|
end
|
58
58
|
|
59
59
|
def test_renders_erb_with_blocks
|
60
60
|
mock_app {
|
61
61
|
set :views, File.dirname(__FILE__) + '/views'
|
62
|
-
helpers Sinatra::
|
62
|
+
helpers Sinatra::RDiscount
|
63
63
|
|
64
64
|
def container
|
65
65
|
yield
|
@@ -74,14 +74,14 @@ class SinatraRDiscountTest < Test::Unit::TestCase
|
|
74
74
|
}
|
75
75
|
|
76
76
|
get '/'
|
77
|
-
assert ok?
|
78
|
-
assert_equal "<p> THIS. IS. SPARTA! </p>\n", body
|
77
|
+
assert last_response.ok?
|
78
|
+
assert_equal "<p> THIS. IS. SPARTA! </p>\n", last_response.body
|
79
79
|
end
|
80
80
|
|
81
81
|
def test_raises_error_if_template_not_found
|
82
82
|
mock_app {
|
83
83
|
set :views, File.dirname(__FILE__) + '/views'
|
84
|
-
helpers Sinatra::
|
84
|
+
helpers Sinatra::RDiscount
|
85
85
|
set :show_exceptions, false
|
86
86
|
|
87
87
|
get('/') { rdiscount :no_such_template }
|
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'test/unit'
|
3
|
-
require '
|
3
|
+
require 'rack/test'
|
4
4
|
|
5
5
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
6
|
require 'sinatra/rdiscount'
|
@@ -8,7 +8,9 @@ require 'sinatra/rdiscount'
|
|
8
8
|
require 'rdiscount'
|
9
9
|
|
10
10
|
class Test::Unit::TestCase
|
11
|
-
include
|
11
|
+
include Rack::Test::Methods
|
12
|
+
|
13
|
+
attr_reader :app
|
12
14
|
|
13
15
|
# Sets up a Sinatra::Base subclass defined with the block
|
14
16
|
# given. Used in setup or individual spec methods to establish
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wbzyl-sinatra-rdiscount
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "W\xC5\x82odek Bzyl"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-11 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,36 +22,37 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 2.6.4
|
24
24
|
version:
|
25
|
-
description:
|
25
|
+
description: An extension providing RDiscount templates for Sinatra applications.
|
26
26
|
email: matwb@univ.gda.pl
|
27
27
|
executables: []
|
28
28
|
|
29
29
|
extensions: []
|
30
30
|
|
31
|
-
extra_rdoc_files:
|
32
|
-
|
33
|
-
files:
|
34
|
-
- .gitignore
|
35
|
-
- sinatra-rdiscount.gemspec
|
36
|
-
- Rakefile
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
37
33
|
- README.markdown
|
34
|
+
files:
|
38
35
|
- LICENSE
|
36
|
+
- README.markdown
|
37
|
+
- Rakefile
|
38
|
+
- VERSION.yml
|
39
|
+
- examples/app.rb
|
40
|
+
- examples/config.ru
|
41
|
+
- examples/mapp.rb
|
42
|
+
- examples/public/stylesheets/application.css
|
43
|
+
- examples/views/hello.rdiscount
|
44
|
+
- examples/views/hello2.rdiscount
|
45
|
+
- examples/views/layout2.rdiscount
|
39
46
|
- lib/sinatra/rdiscount.rb
|
40
|
-
- test/test_helper.rb
|
41
47
|
- test/sinatra_rdiscount_test.rb
|
48
|
+
- test/test_helper.rb
|
42
49
|
- test/views/hello.rdiscount
|
43
50
|
- test/views/layout2.rdiscount
|
44
|
-
- examples/app.rb
|
45
|
-
- examples/config.ru
|
46
|
-
- examples/views/layout2.rdiscount
|
47
|
-
- examples/views/hello2.rdiscount
|
48
|
-
- examples/views/hello.rdiscount
|
49
|
-
- examples/public/stylesheets/application.css
|
50
51
|
has_rdoc: false
|
51
52
|
homepage: http://github.com/wbzyl/sinatra-rdiscount
|
52
53
|
post_install_message:
|
53
|
-
rdoc_options:
|
54
|
-
|
54
|
+
rdoc_options:
|
55
|
+
- --charset=UTF-8
|
55
56
|
require_paths:
|
56
57
|
- lib
|
57
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -71,7 +72,10 @@ requirements: []
|
|
71
72
|
rubyforge_project:
|
72
73
|
rubygems_version: 1.2.0
|
73
74
|
signing_key:
|
74
|
-
specification_version:
|
75
|
-
summary: RDiscount templates for Sinatra applications
|
76
|
-
test_files:
|
77
|
-
|
75
|
+
specification_version: 3
|
76
|
+
summary: An extension providing RDiscount templates for Sinatra applications.
|
77
|
+
test_files:
|
78
|
+
- test/test_helper.rb
|
79
|
+
- test/sinatra_rdiscount_test.rb
|
80
|
+
- examples/mapp.rb
|
81
|
+
- examples/app.rb
|
data/.gitignore
DELETED
data/sinatra-rdiscount.gemspec
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = "sinatra-rdiscount"
|
5
|
-
s.version = '0.1.0'
|
6
|
-
s.date = '2009-05-01'
|
7
|
-
|
8
|
-
s.summary = "RDiscount templates for Sinatra applications"
|
9
|
-
s.email = "matwb@univ.gda.pl"
|
10
|
-
s.homepage = "http://github.com/wbzyl/sinatra-rdiscount"
|
11
|
-
s.description = ""
|
12
|
-
s.authors = ["Włodek Bzyl"]
|
13
|
-
s.files = %w{.gitignore
|
14
|
-
sinatra-rdiscount.gemspec
|
15
|
-
Rakefile
|
16
|
-
README.markdown
|
17
|
-
LICENSE
|
18
|
-
lib/sinatra/rdiscount.rb
|
19
|
-
test/test_helper.rb
|
20
|
-
test/sinatra_rdiscount_test.rb
|
21
|
-
test/views/hello.rdiscount
|
22
|
-
test/views/layout2.rdiscount
|
23
|
-
examples/app.rb
|
24
|
-
examples/config.ru
|
25
|
-
examples/views/layout2.rdiscount
|
26
|
-
examples/views/hello2.rdiscount
|
27
|
-
examples/views/hello.rdiscount
|
28
|
-
examples/public/stylesheets/application.css}
|
29
|
-
|
30
|
-
s.add_dependency 'erubis', '>=2.6.4'
|
31
|
-
|
32
|
-
s.rubygems_version = '1.3.1'
|
33
|
-
end
|