markaby 0.9.0 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.travis.yml +3 -7
- data/CHANGELOG.rdoc +19 -0
- data/Gemfile +10 -8
- data/Gemfile.lock +63 -49
- data/Markaby.gemspec +13 -16
- data/README.rdoc +67 -13
- data/Rakefile +30 -24
- data/lib/markaby/builder.rb +50 -73
- data/lib/markaby/builder_tags.rb +6 -4
- data/lib/markaby/cssproxy.rb +5 -5
- data/lib/markaby/html5.rb +118 -0
- data/lib/markaby/kernel_method.rb +3 -3
- data/lib/markaby/rails.rb +6 -6
- data/lib/markaby/tagset.rb +89 -0
- data/lib/markaby/version.rb +7 -0
- data/lib/markaby/xhtml_frameset.rb +13 -0
- data/lib/markaby/xhtml_strict.rb +89 -0
- data/lib/markaby/xhtml_transitional.rb +61 -0
- data/lib/markaby/xml_tagset.rb +19 -0
- data/lib/markaby.rb +6 -10
- data/spec/markaby/builder_spec.rb +1 -1
- data/spec/markaby/css_proxy_spec.rb +13 -12
- data/spec/markaby/html5_spec.rb +59 -25
- data/spec/markaby/markaby_spec.rb +19 -19
- data/spec/markaby/markaby_test_unit_spec.rb +97 -38
- data/spec/markaby/rails_spec.rb +1 -1
- data/spec/spec_helper.rb +18 -11
- metadata +19 -22
- data/lib/markaby/tags.rb +0 -310
data/spec/markaby/html5_spec.rb
CHANGED
@@ -2,12 +2,12 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
2
2
|
|
3
3
|
describe Markaby do
|
4
4
|
it "should insert an html5 doctype" do
|
5
|
-
document = mab { html5 { head { title
|
5
|
+
document = mab { html5 { head { title "OKay" } } }
|
6
6
|
document.should include("<!DOCTYPE html>")
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should not have xmlns in html5 html tag" do
|
10
|
-
document = mab { html5 { head { title
|
10
|
+
document = mab { html5 { head { title "OKay" } } }
|
11
11
|
document.should_not include("xmlns")
|
12
12
|
end
|
13
13
|
|
@@ -27,14 +27,14 @@ describe Markaby do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should put correct xhtml charset meta" do
|
30
|
-
document = mab { xhtml_strict { head { title
|
31
|
-
document.should include(
|
30
|
+
document = mab { xhtml_strict { head { title "OKay" } } }
|
31
|
+
document.should include("<meta")
|
32
32
|
document.should include('http-equiv="Content-Type"')
|
33
33
|
document.should include('content="text/html; charset=utf-8"')
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should put correct html5 charset meta" do
|
37
|
-
document = mab { html5 { head { title
|
37
|
+
document = mab { html5 { head { title "OKay" } } }
|
38
38
|
document.should include('<meta charset="utf-8"/>')
|
39
39
|
end
|
40
40
|
|
@@ -50,38 +50,42 @@ describe Markaby do
|
|
50
50
|
|
51
51
|
it "should add a closing slash to self-closing tags in xhtml" do
|
52
52
|
document = mab { br }
|
53
|
-
document.should include(
|
53
|
+
document.should include("<br/>")
|
54
54
|
end
|
55
55
|
|
56
|
-
it "should not add a closing slash to self-closing tags in html5" do
|
57
|
-
|
58
|
-
document = mab { html5 { br } }
|
59
|
-
document.should include('<br>')
|
60
|
-
end
|
61
|
-
end
|
56
|
+
# it "should not add a closing slash to self-closing tags in html5" do
|
57
|
+
# pending
|
62
58
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
59
|
+
# document = mab { html5 { br } }
|
60
|
+
# document.should include("<br>")
|
61
|
+
# end
|
62
|
+
|
63
|
+
# it "should close empty non-self-closing tags in html5" do
|
64
|
+
# pending
|
65
|
+
# document = mab { html5 { header } }
|
66
|
+
# document.should include("<header></header>")
|
67
|
+
# end
|
68
|
+
|
69
|
+
it "should allow custom elements" do
|
70
|
+
document = mab { html5 { my_custom_element(id: "mce-123") { "Hello" } } }
|
71
|
+
document.should include("<my-custom-element id=\"mce-123\">Hello</my-custom-element>")
|
68
72
|
end
|
69
73
|
|
70
74
|
it "should not allow fake attributes" do
|
71
75
|
expect {
|
72
76
|
mab do
|
73
77
|
html5 do
|
74
|
-
input "something", :
|
78
|
+
input "something", fake: "fake", foo: "bar"
|
75
79
|
end
|
76
80
|
end
|
77
|
-
}.to raise_error
|
81
|
+
}.to raise_error(Markaby::InvalidXhtmlError)
|
78
82
|
end
|
79
83
|
|
80
84
|
it "should allow new attributes" do
|
81
85
|
expect {
|
82
86
|
mab do
|
83
87
|
html5 do
|
84
|
-
input "something", :
|
88
|
+
input "something", placeholder: "placeholder"
|
85
89
|
end
|
86
90
|
end
|
87
91
|
}.not_to raise_error
|
@@ -90,10 +94,10 @@ describe Markaby do
|
|
90
94
|
it "should allow a placeholder on an input" do
|
91
95
|
doc = mab do
|
92
96
|
html5 do
|
93
|
-
input :
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
+
input type: "text",
|
98
|
+
name: "foo",
|
99
|
+
value: "bar",
|
100
|
+
placeholder: "something"
|
97
101
|
end
|
98
102
|
end
|
99
103
|
|
@@ -106,10 +110,40 @@ describe Markaby do
|
|
106
110
|
it "should allow data attributes anywhere" do
|
107
111
|
doc = mab do
|
108
112
|
html5 do
|
109
|
-
div(
|
113
|
+
div("data-foo" => "bar")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
doc.should include('<div data-foo="bar"/>')
|
118
|
+
end
|
119
|
+
|
120
|
+
it "expands data attributes provided as a hash" do
|
121
|
+
doc = mab do
|
122
|
+
html5 do
|
123
|
+
div(data: {foo: "bar"})
|
110
124
|
end
|
111
125
|
end
|
112
126
|
|
113
127
|
doc.should include('<div data-foo="bar"/>')
|
114
128
|
end
|
129
|
+
|
130
|
+
it "dasherises data attributes provided as a hash" do
|
131
|
+
doc = mab do
|
132
|
+
html5 do
|
133
|
+
div(data: {some_attribute: "value"})
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
doc.should include('<div data-some-attribute="value"/>')
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should allow aria attributes everywhere" do
|
141
|
+
doc = mab do
|
142
|
+
html5 do
|
143
|
+
div("aria-foo" => "bar")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
doc.should include('<div aria-foo="bar"/>')
|
148
|
+
end
|
115
149
|
end
|
@@ -2,18 +2,18 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
2
2
|
|
3
3
|
describe Markaby do
|
4
4
|
it "should work with classes and ids" do
|
5
|
-
mab { div.one
|
6
|
-
mab { div.one.two
|
7
|
-
mab { div.three!
|
8
|
-
mab { hr.hidden }.should == %
|
5
|
+
mab { div.one "" }.should == %(<div class="one"></div>)
|
6
|
+
mab { div.one.two "" }.should == %(<div class="one two"></div>)
|
7
|
+
mab { div.three! "" }.should == %(<div id="three"></div>)
|
8
|
+
mab { hr.hidden }.should == %(<hr class="hidden"/>)
|
9
9
|
|
10
|
-
out = mab { input.foo :
|
10
|
+
out = mab { input.foo id: "bar" }
|
11
11
|
out.should match("<input.*class=\"foo\".*/>")
|
12
12
|
out.should match("<input.*name=\"bar\".*/>")
|
13
13
|
end
|
14
14
|
|
15
15
|
it "can assign helpers after instantiation" do
|
16
|
-
helper = double
|
16
|
+
helper = double "helper", foo: :bar
|
17
17
|
|
18
18
|
builder = Markaby::Builder.new
|
19
19
|
builder.helper = helper
|
@@ -22,26 +22,26 @@ describe Markaby do
|
|
22
22
|
|
23
23
|
it "should be able to set a local" do
|
24
24
|
builder = Markaby::Builder.new
|
25
|
-
builder.locals = {
|
25
|
+
builder.locals = {foo: "bar"}
|
26
26
|
builder.foo.should == "bar"
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should be able to set a different local value" do
|
30
30
|
builder = Markaby::Builder.new
|
31
|
-
builder.locals = {
|
31
|
+
builder.locals = {foo: "baz"}
|
32
32
|
builder.foo.should == "baz"
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should assign the correct key" do
|
36
36
|
builder = Markaby::Builder.new
|
37
|
-
builder.locals = {
|
37
|
+
builder.locals = {key: :value}
|
38
38
|
builder.key.should == :value
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should be able to assign multiple locals" do
|
42
42
|
builder = Markaby::Builder.new
|
43
43
|
|
44
|
-
builder.locals = {
|
44
|
+
builder.locals = {one: "two", three: "four"}
|
45
45
|
|
46
46
|
builder.one.should == "two"
|
47
47
|
builder.three.should == "four"
|
@@ -60,10 +60,10 @@ describe Markaby do
|
|
60
60
|
div {
|
61
61
|
h1 "Monkeys"
|
62
62
|
h2 {
|
63
|
-
"Giraffes #{small(
|
63
|
+
"Giraffes #{small("Miniature")} and #{strong "Large"}"
|
64
64
|
}
|
65
65
|
h3 "Donkeys"
|
66
|
-
h4 { "Parakeet #{b { i
|
66
|
+
h4 { "Parakeet #{b { i "Innocent IV" }} in Classic Chartreuse" }
|
67
67
|
}
|
68
68
|
}
|
69
69
|
|
@@ -88,7 +88,7 @@ describe Markaby do
|
|
88
88
|
end
|
89
89
|
|
90
90
|
it "can assign helpers after instantiation" do
|
91
|
-
helper = double
|
91
|
+
helper = double "helper", foo: :bar
|
92
92
|
|
93
93
|
builder = Markaby::Builder.new
|
94
94
|
builder.helper = helper
|
@@ -97,26 +97,26 @@ describe Markaby do
|
|
97
97
|
|
98
98
|
it "should be able to set a local" do
|
99
99
|
builder = Markaby::Builder.new
|
100
|
-
builder.locals = {
|
100
|
+
builder.locals = {foo: "bar"}
|
101
101
|
builder.foo.should == "bar"
|
102
102
|
end
|
103
103
|
|
104
104
|
it "should be able to set a different local value" do
|
105
105
|
builder = Markaby::Builder.new
|
106
|
-
builder.locals = {
|
106
|
+
builder.locals = {foo: "baz"}
|
107
107
|
builder.foo.should == "baz"
|
108
108
|
end
|
109
109
|
|
110
110
|
it "should assign the correct key" do
|
111
111
|
builder = Markaby::Builder.new
|
112
|
-
builder.locals = {
|
112
|
+
builder.locals = {key: :value}
|
113
113
|
builder.key.should == :value
|
114
114
|
end
|
115
115
|
|
116
116
|
it "should be able to assign multiple locals" do
|
117
117
|
builder = Markaby::Builder.new
|
118
118
|
|
119
|
-
builder.locals = {
|
119
|
+
builder.locals = {one: "two", three: "four"}
|
120
120
|
|
121
121
|
builder.one.should == "two"
|
122
122
|
builder.three.should == "four"
|
@@ -135,10 +135,10 @@ describe Markaby do
|
|
135
135
|
div {
|
136
136
|
h1 "Monkeys"
|
137
137
|
h2 {
|
138
|
-
"Giraffes #{small(
|
138
|
+
"Giraffes #{small("Miniature")} and #{strong "Large"}"
|
139
139
|
}
|
140
140
|
h3 "Donkeys"
|
141
|
-
h4 { "Parakeet #{b { i
|
141
|
+
h4 { "Parakeet #{b { i "Innocent IV" }} in Classic Chartreuse" }
|
142
142
|
}
|
143
143
|
}
|
144
144
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
-
require 'test/unit'
|
3
2
|
|
4
3
|
class MarkabyTest < Test::Unit::TestCase
|
5
4
|
include TestHelpers
|
@@ -10,41 +9,86 @@ class MarkabyTest < Test::Unit::TestCase
|
|
10
9
|
|
11
10
|
def test_simple
|
12
11
|
assert_equal "<hr/>", mab { hr }
|
13
|
-
assert_equal "<hr/><br/>", mab {
|
14
|
-
|
15
|
-
|
12
|
+
assert_equal "<hr/><br/>", mab {
|
13
|
+
hr
|
14
|
+
br
|
15
|
+
}
|
16
|
+
assert_equal "<p>foo</p>", mab { p "foo" }
|
17
|
+
assert_equal "<p>foo</p>", mab { p { "foo" } }
|
16
18
|
end
|
17
19
|
|
18
20
|
def test_escaping
|
19
|
-
assert_equal "<h1>Apples & Oranges</h1>", mab { h1
|
20
|
-
assert_equal "<h1>Apples & Oranges</h1>", mab { h1 {
|
21
|
-
assert_equal "<h1 class=\"fruits&floots\">Apples</h1>", mab { h1
|
21
|
+
assert_equal "<h1>Apples & Oranges</h1>", mab { h1 "Apples & Oranges" }
|
22
|
+
assert_equal "<h1>Apples & Oranges</h1>", mab { h1 { "Apples & Oranges" } }
|
23
|
+
assert_equal "<h1 class=\"fruits&floots\">Apples</h1>", mab { h1 "Apples", class: "fruits&floots" }
|
22
24
|
end
|
23
25
|
|
24
26
|
def test_capture
|
25
27
|
builder = Markaby::Builder.new
|
26
28
|
assert builder.to_s.empty?
|
27
|
-
assert_equal "<h1>TEST</h1>", builder.capture { h1
|
29
|
+
assert_equal "<h1>TEST</h1>", builder.capture { h1 "TEST" }
|
28
30
|
assert builder.to_s.empty?
|
29
|
-
assert mab {
|
30
|
-
|
31
|
+
assert mab {
|
32
|
+
capture { h1 "hello world" }
|
33
|
+
nil
|
34
|
+
}.empty?
|
35
|
+
assert_equal mab { div { h1 "TEST" } }, mab { div { capture { h1 "TEST" } } }
|
31
36
|
end
|
32
37
|
|
33
38
|
def test_ivars
|
34
39
|
html = "<div><h1>Steve</h1><div><h2>Gerald</h2></div><h3>Gerald</h3></div>"
|
35
|
-
assert_equal html, mab {
|
36
|
-
|
37
|
-
|
40
|
+
assert_equal html, mab {
|
41
|
+
div {
|
42
|
+
@name = "Steve"
|
43
|
+
h1 @name
|
44
|
+
div {
|
45
|
+
@name = "Gerald"
|
46
|
+
h2 @name
|
47
|
+
}
|
48
|
+
h3 @name
|
49
|
+
}
|
50
|
+
}
|
51
|
+
assert_equal html, mab {
|
52
|
+
div {
|
53
|
+
@name = "Steve"
|
54
|
+
h1 @name
|
55
|
+
self << capture {
|
56
|
+
div {
|
57
|
+
@name = "Gerald"
|
58
|
+
h2 @name
|
59
|
+
}
|
60
|
+
}
|
61
|
+
h3 @name
|
62
|
+
}
|
63
|
+
}
|
64
|
+
assert_equal html, mab(name: "Steve") {
|
65
|
+
div {
|
66
|
+
h1 @name
|
67
|
+
self << capture {
|
68
|
+
div {
|
69
|
+
@name = "Gerald"
|
70
|
+
h2 @name
|
71
|
+
}
|
72
|
+
}
|
73
|
+
h3 @name
|
74
|
+
}
|
75
|
+
}
|
38
76
|
end
|
39
77
|
|
40
78
|
def test_ivars_without_at_symbol
|
41
|
-
assert_equal "<h1>Hello World</h1>", mab {
|
79
|
+
assert_equal "<h1>Hello World</h1>", mab {
|
80
|
+
@message = "Hello World"
|
81
|
+
h1 message
|
82
|
+
}
|
42
83
|
end
|
43
84
|
|
44
85
|
def test_helpers
|
45
|
-
assert_equal %
|
46
|
-
assert_equal %
|
47
|
-
assert mab({}, MarkabyTestHelpers) {
|
86
|
+
assert_equal %(squirrels), mab({}, MarkabyTestHelpers) { pluralize("squirrel") }
|
87
|
+
assert_equal %(<a href="">edit</a>), mab({}, MarkabyTestHelpers) { link_to("edit") }
|
88
|
+
assert mab({}, MarkabyTestHelpers) {
|
89
|
+
link_to("edit")
|
90
|
+
nil
|
91
|
+
}.empty?
|
48
92
|
end
|
49
93
|
|
50
94
|
def test_uses_helper_instance_variable
|
@@ -61,45 +105,60 @@ class MarkabyTest < Test::Unit::TestCase
|
|
61
105
|
end
|
62
106
|
|
63
107
|
def test_fragments
|
64
|
-
assert_equal %
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
108
|
+
assert_equal %(<div><h1>Monkeys</h1><h2>Giraffes <strong>Miniature</strong></h2><h3>Donkeys</h3></div>),
|
109
|
+
mab {
|
110
|
+
div {
|
111
|
+
h1 "Monkeys"
|
112
|
+
h2 { "Giraffes #{strong "Miniature"}" }
|
113
|
+
h3 "Donkeys"
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
assert_equal %(<div><h1>Monkeys</h1><h2>Giraffes <small>Miniature</small> and <strong>Large</strong></h2><h3>Donkeys</h3><h4>Parakeet <strong>Large</strong> as well...</h4></div>),
|
118
|
+
mab {
|
119
|
+
div {
|
120
|
+
@a = small "Miniature"
|
121
|
+
@b = strong "Large"
|
122
|
+
h1 "Monkeys"
|
123
|
+
h2 { "Giraffes #{@a} and #{@b}" }
|
124
|
+
h3 "Donkeys"
|
125
|
+
h4 { "Parakeet #{@b} as well..." }
|
126
|
+
}
|
127
|
+
}
|
69
128
|
end
|
70
129
|
|
71
130
|
def test_invalid_xhtml
|
72
131
|
assert_exception(NoMethodError, "undefined method `dav'") { dav {} }
|
73
|
-
assert_exception(Markaby::InvalidXhtmlError, "no attribute `styl' on div elements") { div(:
|
132
|
+
assert_exception(Markaby::InvalidXhtmlError, "no attribute `styl' on div elements") { div(styl: "ok") {} }
|
74
133
|
assert_exception(Markaby::InvalidXhtmlError, "no attribute `class' on tbody elements") { tbody.okay {} }
|
75
134
|
end
|
76
135
|
|
77
136
|
def test_full_doc_transitional
|
78
|
-
doc = mab { xhtml_transitional { head { title
|
137
|
+
doc = mab { xhtml_transitional { head { title "OKay" } } }
|
79
138
|
assert doc =~ /^<\?xml version="1.0" encoding="UTF-8"\?>/
|
80
|
-
assert doc.include?(%
|
81
|
-
assert doc.include?(%
|
139
|
+
assert doc.include?(%("-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">))
|
140
|
+
assert doc.include?(%(<title>OKay</title>))
|
82
141
|
end
|
83
142
|
|
84
143
|
def test_full_doc_strict
|
85
|
-
doc = mab { xhtml_strict { head { title
|
144
|
+
doc = mab { xhtml_strict { head { title "OKay" } } }
|
86
145
|
assert doc =~ /^<\?xml version="1.0" encoding="UTF-8"\?>/
|
87
|
-
assert doc.include?(%
|
88
|
-
assert doc.include?(%
|
146
|
+
assert doc.include?(%("-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">))
|
147
|
+
assert doc.include?(%(<title>OKay</title>))
|
89
148
|
end
|
90
149
|
|
91
150
|
def test_full_doc_frameset
|
92
|
-
doc = mab { xhtml_frameset { head { title
|
151
|
+
doc = mab { xhtml_frameset { head { title "OKay" } } }
|
93
152
|
assert doc =~ /^<\?xml version="1.0" encoding="UTF-8"\?>/
|
94
|
-
assert doc.include?(%
|
95
|
-
assert doc.include?(%
|
153
|
+
assert doc.include?(%("-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">))
|
154
|
+
assert doc.include?(%(<title>OKay</title>))
|
96
155
|
end
|
97
156
|
|
98
157
|
def test_root_attributes_can_be_changed
|
99
|
-
doc = mab { xhtml_strict(:
|
100
|
-
assert doc.include?(%
|
101
|
-
assert doc.include?(%
|
102
|
-
assert doc.include?(%
|
158
|
+
doc = mab { xhtml_strict(lang: "fr") { head { title { "Salut!" } } } }
|
159
|
+
assert doc.include?(%("-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">))
|
160
|
+
assert doc.include?(%(<title>Salut!</title>))
|
161
|
+
assert doc.include?(%( lang="fr"))
|
103
162
|
end
|
104
163
|
|
105
164
|
def version_file
|
@@ -107,7 +166,7 @@ class MarkabyTest < Test::Unit::TestCase
|
|
107
166
|
end
|
108
167
|
|
109
168
|
def test_markaby_should_have_correct_version
|
110
|
-
assert_equal Markaby::VERSION,
|
169
|
+
assert_equal Markaby::VERSION, "0.9.0"
|
111
170
|
end
|
112
171
|
|
113
172
|
def test_duplicate_usage_of_same_id
|
@@ -139,7 +198,7 @@ class MarkabyTest < Test::Unit::TestCase
|
|
139
198
|
end
|
140
199
|
|
141
200
|
def test_local_assigning
|
142
|
-
builder = Markaby::Builder.new(:
|
201
|
+
builder = Markaby::Builder.new(variable: :a_value)
|
143
202
|
|
144
203
|
assert_equal :a_value, builder.variable
|
145
204
|
end
|
data/spec/markaby/rails_spec.rb
CHANGED
@@ -23,7 +23,7 @@ describe Markaby::Rails do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should be able to pass options" do
|
26
|
-
Markaby::Rails::TemplateHandler.register!(:
|
26
|
+
Markaby::Rails::TemplateHandler.register!(indent: 2)
|
27
27
|
Markaby::Rails::TemplateHandler.options[:indent].should == 2
|
28
28
|
end
|
29
29
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,19 @@
|
|
1
|
-
require
|
1
|
+
require "rspec"
|
2
2
|
|
3
|
-
$:.unshift File.expand_path(File.join(File.dirname(__FILE__),
|
3
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "markaby"
|
6
|
+
require "markaby/kernel_method"
|
7
7
|
require "markaby/rails"
|
8
|
+
require "test/unit"
|
9
|
+
|
10
|
+
# need to set this to true otherwise Test::Unit goes berserk + tries to run
|
11
|
+
# see https://jonleighton.name/2012/stop-test-unit-autorun/
|
12
|
+
Test::Unit.run = true
|
8
13
|
|
9
14
|
module MarkabyTestHelpers
|
10
15
|
def link_to(obj)
|
11
|
-
%
|
16
|
+
%(<a href="">#{obj}</a>)
|
12
17
|
end
|
13
18
|
|
14
19
|
def pluralize(string)
|
@@ -20,11 +25,13 @@ end
|
|
20
25
|
|
21
26
|
module TestHelpers
|
22
27
|
def assert_exception(exclass, exmsg, *mab_args, &block)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
assert_match /#{exmsg}/, e.message
|
28
|
-
end
|
28
|
+
mab(*mab_args, &block)
|
29
|
+
rescue => e
|
30
|
+
assert_equal exclass, e.class
|
31
|
+
assert_match(/#{exmsg}/, e.message)
|
29
32
|
end
|
30
33
|
end
|
34
|
+
|
35
|
+
RSpec.configure do |c|
|
36
|
+
c.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
|
37
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markaby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Taylor
|
8
8
|
- judofyr
|
9
9
|
- _why
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-12-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: builder
|
@@ -30,16 +30,16 @@ dependencies:
|
|
30
30
|
name: bundler
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- - "
|
33
|
+
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 2.2.10
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - "
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 2.2.10
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rake
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,9 +76,15 @@ files:
|
|
76
76
|
- lib/markaby/builder.rb
|
77
77
|
- lib/markaby/builder_tags.rb
|
78
78
|
- lib/markaby/cssproxy.rb
|
79
|
+
- lib/markaby/html5.rb
|
79
80
|
- lib/markaby/kernel_method.rb
|
80
81
|
- lib/markaby/rails.rb
|
81
|
-
- lib/markaby/
|
82
|
+
- lib/markaby/tagset.rb
|
83
|
+
- lib/markaby/version.rb
|
84
|
+
- lib/markaby/xhtml_frameset.rb
|
85
|
+
- lib/markaby/xhtml_strict.rb
|
86
|
+
- lib/markaby/xhtml_transitional.rb
|
87
|
+
- lib/markaby/xml_tagset.rb
|
82
88
|
- spec/markaby/builder_spec.rb
|
83
89
|
- spec/markaby/css_proxy_spec.rb
|
84
90
|
- spec/markaby/fragment_spec.rb
|
@@ -91,7 +97,7 @@ homepage: ''
|
|
91
97
|
licenses:
|
92
98
|
- MIT
|
93
99
|
metadata: {}
|
94
|
-
post_install_message:
|
100
|
+
post_install_message:
|
95
101
|
rdoc_options: []
|
96
102
|
require_paths:
|
97
103
|
- lib
|
@@ -99,24 +105,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
105
|
requirements:
|
100
106
|
- - ">="
|
101
107
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
108
|
+
version: 2.7.0
|
103
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
110
|
requirements:
|
105
111
|
- - ">="
|
106
112
|
- !ruby/object:Gem::Version
|
107
113
|
version: '0'
|
108
114
|
requirements: []
|
109
|
-
|
110
|
-
|
111
|
-
signing_key:
|
115
|
+
rubygems_version: 3.4.22
|
116
|
+
signing_key:
|
112
117
|
specification_version: 4
|
113
118
|
summary: A pure ruby based, html markup language
|
114
|
-
test_files:
|
115
|
-
- spec/markaby/builder_spec.rb
|
116
|
-
- spec/markaby/css_proxy_spec.rb
|
117
|
-
- spec/markaby/fragment_spec.rb
|
118
|
-
- spec/markaby/html5_spec.rb
|
119
|
-
- spec/markaby/markaby_spec.rb
|
120
|
-
- spec/markaby/markaby_test_unit_spec.rb
|
121
|
-
- spec/markaby/rails_spec.rb
|
122
|
-
- spec/spec_helper.rb
|
119
|
+
test_files: []
|