has_wysiwyg_content 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/has_wysiwyg_content.gemspec +1 -0
- data/lib/has_wysiwyg_content/version.rb +1 -1
- data/test/test_has_wysiwyg_content.rb +0 -19
- data/test/test_has_wysiwyg_content_helper.rb +60 -0
- metadata +11 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9b66d053307600f150dca308aeec0f37e0372678
|
4
|
+
data.tar.gz: 4b3572d3c277a18416f280ec4e613095c88e0944
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0fbfb7d7aa7a01a6c00b077ec46b9d06e17ddf649d977adae610bebff94e96875ba1d9c6dbc6683c06defdf7e3003219d907f9275d0dbba3c03be741e529b6a4
|
7
|
+
data.tar.gz: 4649ddc214d59953de5a7aee757cbcb67403d2b96bc61f6b0b9e54c0b5e85e761fcab082e64149964d013fb917d770db0a38a4c08ec28de7b5a8cca124d9d7a9
|
data/has_wysiwyg_content.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.description = %q{}
|
12
12
|
gem.summary = %q{}
|
13
13
|
gem.homepage = "https://github.com/phallstrom/has_wysiwyg_content"
|
14
|
+
gem.license = 'MIT'
|
14
15
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -69,24 +69,5 @@ class TestHasWysiwygContent < ActiveSupport::TestCase
|
|
69
69
|
assert_equal %w[content], Widget.wysiwyg_attributes
|
70
70
|
end
|
71
71
|
|
72
|
-
#
|
73
|
-
# Testing the helper...
|
74
|
-
#
|
75
|
-
|
76
|
-
def test_parsed_content_encodes_emails
|
77
|
-
assert_no_match /philip@pjkh.com/, wysiwyg(@widget.content)
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_parsed_content_converts_valid_substitutions
|
81
|
-
@my_var = Object.new
|
82
|
-
def @my_var.foo; "VALUE_OF_MY_VAR"; end
|
83
|
-
assert_no_match /\{\{some_var.foo\}\}/, wysiwyg(@widget.content, :some_var => @my_var)
|
84
|
-
assert_match /VALUE_OF_MY_VAR/, wysiwyg(@widget.content, :some_var => @my_var)
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_parsed_content_does_not_convert_nonexistent_substitutions
|
88
|
-
assert_match /\{\{invalid.foo\}\}/, wysiwyg(@widget.content)
|
89
|
-
end
|
90
|
-
|
91
72
|
end
|
92
73
|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'has_wysiwyg_content'
|
4
|
+
|
5
|
+
class TestHasWysiwygContentHelper < ActiveSupport::TestCase
|
6
|
+
include ActionView::Context
|
7
|
+
include ActionView::Helpers
|
8
|
+
include HasWysiwygContent::TagHelper
|
9
|
+
|
10
|
+
def test_simple_string
|
11
|
+
assert_equal "simple", wysiwyg("simple")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_intact_yield_if_no_block_given
|
15
|
+
assert_equal "start {{yield}} end", wysiwyg("start {{yield}} end")
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_yield_to_the_block_if_yield_provided_and_block_is_given
|
19
|
+
result = wysiwyg("start {{yield}} end") { "block" }
|
20
|
+
assert_equal "start block end", result
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_append_the_block_if_no_yield_provided_and_block_is_given
|
24
|
+
result = wysiwyg("start end") { "block" }
|
25
|
+
assert_equal "start endblock", result
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_not_append_the_block_if_yield_provided_and_block_is_given
|
29
|
+
result = wysiwyg("start {{yield}} end") { "block" }
|
30
|
+
assert_equal "start block end", result
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_not_quelch_obj_meth_if_no_match_is_found
|
34
|
+
result = wysiwyg("start {{obj.meth}} end")
|
35
|
+
assert_equal "start {{obj.meth}} end", result
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_replace_obj_meth_if_match_is_found
|
39
|
+
obj = Object.new
|
40
|
+
def obj.meth; 'foobar'; end
|
41
|
+
result = wysiwyg("start {{obj.meth}} end", :obj => obj)
|
42
|
+
assert_equal "start foobar end", result
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_handle_mailto_philip_pjkh_com
|
46
|
+
assert_equal "start #{mail_to 'philip@pjkh.com', nil, :encode => :javascript} end",
|
47
|
+
wysiwyg("start {{mailto:philip@pjkh.com}} end")
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_handle_mailto_philip_pjkh_com_click_me
|
51
|
+
assert_equal "start #{mail_to 'philip@pjkh.com', 'click me', :encode => :javascript} end",
|
52
|
+
wysiwyg("start {{mailto:philip@pjkh.com:click me}} end")
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_should_handle_spaces_in_mailto
|
56
|
+
assert_equal "start #{mail_to 'philip@pjkh.com', 'click me', :encode => :javascript} end",
|
57
|
+
wysiwyg("start {{mailto : philip@pjkh.com : click me}} end")
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_wysiwyg_content
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Philip Hallstrom
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: ''
|
15
14
|
email:
|
@@ -29,35 +28,31 @@ files:
|
|
29
28
|
- lib/has_wysiwyg_content/action_view_helper.rb
|
30
29
|
- lib/has_wysiwyg_content/version.rb
|
31
30
|
- test/test_has_wysiwyg_content.rb
|
31
|
+
- test/test_has_wysiwyg_content_helper.rb
|
32
32
|
homepage: https://github.com/phallstrom/has_wysiwyg_content
|
33
|
-
licenses:
|
33
|
+
licenses:
|
34
|
+
- MIT
|
35
|
+
metadata: {}
|
34
36
|
post_install_message:
|
35
37
|
rdoc_options: []
|
36
38
|
require_paths:
|
37
39
|
- lib
|
38
40
|
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
41
|
requirements:
|
41
|
-
- -
|
42
|
+
- - '>='
|
42
43
|
- !ruby/object:Gem::Version
|
43
44
|
version: '0'
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
hash: 1817417977407933255
|
47
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
-
none: false
|
49
46
|
requirements:
|
50
|
-
- -
|
47
|
+
- - '>='
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: '0'
|
53
|
-
segments:
|
54
|
-
- 0
|
55
|
-
hash: 1817417977407933255
|
56
50
|
requirements: []
|
57
51
|
rubyforge_project:
|
58
|
-
rubygems_version:
|
52
|
+
rubygems_version: 2.0.6
|
59
53
|
signing_key:
|
60
|
-
specification_version:
|
54
|
+
specification_version: 4
|
61
55
|
summary: ''
|
62
56
|
test_files:
|
63
57
|
- test/test_has_wysiwyg_content.rb
|
58
|
+
- test/test_has_wysiwyg_content_helper.rb
|