html-pipeline 2.4.1 → 2.4.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.
- checksums.yaml +4 -4
- data/.travis.yml +15 -4
- data/Appraisals +13 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -1
- data/Rakefile +4 -1
- data/html-pipeline.gemspec +2 -3
- data/lib/html/pipeline/emoji_filter.rb +22 -1
- data/lib/html/pipeline/version.rb +1 -1
- metadata +4 -46
- data/script/changelog +0 -47
- data/script/package +0 -7
- data/script/release +0 -16
- data/test/helpers/mocked_instrumentation_service.rb +0 -17
- data/test/html/pipeline/absolute_source_filter_test.rb +0 -55
- data/test/html/pipeline/autolink_filter_test.rb +0 -35
- data/test/html/pipeline/camo_filter_test.rb +0 -77
- data/test/html/pipeline/email_reply_filter_test.rb +0 -66
- data/test/html/pipeline/emoji_filter_test.rb +0 -65
- data/test/html/pipeline/https_filter_test.rb +0 -53
- data/test/html/pipeline/image_filter_test.rb +0 -39
- data/test/html/pipeline/image_max_width_filter_test.rb +0 -50
- data/test/html/pipeline/markdown_filter_test.rb +0 -101
- data/test/html/pipeline/mention_filter_test.rb +0 -212
- data/test/html/pipeline/plain_text_input_filter_test.rb +0 -22
- data/test/html/pipeline/sanitization_filter_test.rb +0 -166
- data/test/html/pipeline/syntax_highlight_filter_test.rb +0 -22
- data/test/html/pipeline/toc_filter_test.rb +0 -134
- data/test/html/pipeline_test.rb +0 -74
- data/test/test_helper.rb +0 -16
data/test/html/pipeline_test.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "helpers/mocked_instrumentation_service"
|
3
|
-
|
4
|
-
class HTML::PipelineTest < Minitest::Test
|
5
|
-
Pipeline = HTML::Pipeline
|
6
|
-
class TestFilter
|
7
|
-
def self.call(input, context, result)
|
8
|
-
input.reverse
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def setup
|
13
|
-
@context = {}
|
14
|
-
@result_class = Hash
|
15
|
-
@pipeline = Pipeline.new [TestFilter], @context, @result_class
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_filter_instrumentation
|
19
|
-
service = MockedInstrumentationService.new
|
20
|
-
events = service.subscribe "call_filter.html_pipeline"
|
21
|
-
@pipeline.instrumentation_service = service
|
22
|
-
filter(body = "hello")
|
23
|
-
event, payload, res = events.pop
|
24
|
-
assert event, "event expected"
|
25
|
-
assert_equal "call_filter.html_pipeline", event
|
26
|
-
assert_equal TestFilter.name, payload[:filter]
|
27
|
-
assert_equal @pipeline.class.name, payload[:pipeline]
|
28
|
-
assert_equal body.reverse, payload[:result][:output]
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_pipeline_instrumentation
|
32
|
-
service = MockedInstrumentationService.new
|
33
|
-
events = service.subscribe "call_pipeline.html_pipeline"
|
34
|
-
@pipeline.instrumentation_service = service
|
35
|
-
filter(body = "hello")
|
36
|
-
event, payload, res = events.pop
|
37
|
-
assert event, "event expected"
|
38
|
-
assert_equal "call_pipeline.html_pipeline", event
|
39
|
-
assert_equal @pipeline.filters.map(&:name), payload[:filters]
|
40
|
-
assert_equal @pipeline.class.name, payload[:pipeline]
|
41
|
-
assert_equal body.reverse, payload[:result][:output]
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_default_instrumentation_service
|
45
|
-
service = 'default'
|
46
|
-
Pipeline.default_instrumentation_service = service
|
47
|
-
pipeline = Pipeline.new [], @context, @result_class
|
48
|
-
assert_equal service, pipeline.instrumentation_service
|
49
|
-
ensure
|
50
|
-
Pipeline.default_instrumentation_service = nil
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_setup_instrumentation
|
54
|
-
assert_nil @pipeline.instrumentation_service
|
55
|
-
|
56
|
-
service = MockedInstrumentationService.new
|
57
|
-
events = service.subscribe "call_pipeline.html_pipeline"
|
58
|
-
@pipeline.setup_instrumentation name = 'foo', service
|
59
|
-
|
60
|
-
assert_equal service, @pipeline.instrumentation_service
|
61
|
-
assert_equal name, @pipeline.instrumentation_name
|
62
|
-
|
63
|
-
filter(body = 'foo')
|
64
|
-
|
65
|
-
event, payload, res = events.pop
|
66
|
-
assert event, "expected event"
|
67
|
-
assert_equal name, payload[:pipeline]
|
68
|
-
assert_equal body.reverse, payload[:result][:output]
|
69
|
-
end
|
70
|
-
|
71
|
-
def filter(input)
|
72
|
-
@pipeline.call(input)
|
73
|
-
end
|
74
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'bundler/setup'
|
2
|
-
require 'html/pipeline'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
|
5
|
-
require 'active_support/core_ext/string'
|
6
|
-
|
7
|
-
module TestHelpers
|
8
|
-
# Asserts that two html fragments are equivalent. Attribute order
|
9
|
-
# will be ignored.
|
10
|
-
def assert_equal_html(expected, actual)
|
11
|
-
assert_equal Nokogiri::HTML::DocumentFragment.parse(expected).to_hash,
|
12
|
-
Nokogiri::HTML::DocumentFragment.parse(actual).to_hash
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
Minitest::Test.send(:include, TestHelpers)
|