rack-plastic 0.1.0 → 0.1.1
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/CHANGELOG +3 -0
- data/Rakefile +1 -1
- data/lib/plastic_test_helper.rb +23 -6
- metadata +3 -3
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/lib/plastic_test_helper.rb
CHANGED
@@ -5,7 +5,7 @@ require 'colored'
|
|
5
5
|
# Mix this module into Test::Unit::TestCase to have access to these
|
6
6
|
# test helpers when using Test::Unit.
|
7
7
|
#
|
8
|
-
# Here's an example of how you can use these
|
8
|
+
# Here's an example of how you can use these helper methods:
|
9
9
|
#
|
10
10
|
# def test_basic_document
|
11
11
|
# before_html = %Q{
|
@@ -38,20 +38,37 @@ require 'colored'
|
|
38
38
|
# assert_html_equal expected_html, after_html
|
39
39
|
# end
|
40
40
|
#
|
41
|
+
# And here's an example of how you'd mix these helper methods into
|
42
|
+
# Test::Unit::TestCase:
|
43
|
+
#
|
44
|
+
# require 'test/unit'
|
45
|
+
# require 'rubygems'
|
46
|
+
# require 'plastic_test_helper'
|
47
|
+
#
|
48
|
+
# module Test
|
49
|
+
# module Unit
|
50
|
+
# class TestCase
|
51
|
+
#
|
52
|
+
# include PlasticTestHelper
|
53
|
+
#
|
54
|
+
# end
|
55
|
+
# end
|
56
|
+
# end
|
57
|
+
#
|
41
58
|
module PlasticTestHelper
|
42
59
|
|
43
60
|
# This takes care of the "plumbing" involved in testing your middleware.
|
44
|
-
# All you have to provide is an HTML string, the class of
|
61
|
+
# All you have to provide is an input HTML string, the class of
|
45
62
|
# your middleware (not the name of your class or an object, but
|
46
63
|
# the class itself), and finally some optional options to use when
|
47
64
|
# instantiating your middleware class.
|
48
65
|
#
|
49
|
-
# This method will
|
50
|
-
# middleware's response).
|
66
|
+
# This method will run the input HTML string through the middleware
|
67
|
+
# and return the resulting HTML string (the body of the middleware's response).
|
51
68
|
#
|
52
69
|
# Examples:
|
53
|
-
# resulting_html = process_html(
|
54
|
-
# resulting_html = process_html(
|
70
|
+
# resulting_html = process_html(input_html, Rack::Linkify)
|
71
|
+
# resulting_html = process_html(input_html, Rack::Linkify, :twitter => true)
|
55
72
|
#
|
56
73
|
def process_html(html, middleware_class, options={})
|
57
74
|
app = lambda { |env| [200, {'Content-Type' => 'text/html'}, html] }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-plastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Wyatt Greene
|