keynote 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of keynote might be problematic. Click here for more details.
- data/.gitignore +19 -0
- data/.yardopts +4 -0
- data/Appraisals +20 -0
- data/Gemfile +4 -0
- data/LICENSE +27 -0
- data/README.md +8 -0
- data/Rakefile +17 -0
- data/keynote.gemspec +26 -0
- data/lib/generators/presenter_generator.rb +70 -0
- data/lib/generators/templates/keynote_mini_test_spec.rb +11 -0
- data/lib/generators/templates/keynote_mini_test_unit.rb +11 -0
- data/lib/generators/templates/keynote_presenter.rb +7 -0
- data/lib/generators/templates/keynote_rspec.rb +5 -0
- data/lib/generators/templates/keynote_test_unit.rb +11 -0
- data/lib/keynote.rb +65 -0
- data/lib/keynote/cache.rb +53 -0
- data/lib/keynote/controller.rb +14 -0
- data/lib/keynote/helper.rb +14 -0
- data/lib/keynote/presenter.rb +90 -0
- data/lib/keynote/railtie.rb +40 -0
- data/lib/keynote/rumble.rb +369 -0
- data/lib/keynote/testing/minitest_rails.rake +2 -0
- data/lib/keynote/testing/minitest_rails.rb +22 -0
- data/lib/keynote/testing/rspec.rb +16 -0
- data/lib/keynote/testing/test_unit.rb +6 -0
- data/lib/keynote/version.rb +6 -0
- data/spec/generator_spec.rb +106 -0
- data/spec/helper.rb +84 -0
- data/spec/keynote_spec.rb +98 -0
- data/spec/presenter_spec.rb +116 -0
- data/spec/railtie_spec.rb +32 -0
- data/spec/rumble_spec.rb +201 -0
- data/spec/test_case_spec.rb +12 -0
- metadata +204 -0
data/spec/rumble_spec.rb
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Original Rumble tests (c) 2011 Magnus Holm (https://github.com/judofyr).
|
4
|
+
|
5
|
+
require 'helper'
|
6
|
+
|
7
|
+
Rumble = Keynote::Rumble
|
8
|
+
|
9
|
+
class TestRumble < MiniTest::Unit::TestCase
|
10
|
+
include Rumble
|
11
|
+
|
12
|
+
def assert_rumble(str, &blk)
|
13
|
+
exp = str.gsub(/(\s+(<)|>\s+)/) { $2 || '>' }
|
14
|
+
res = nil
|
15
|
+
html {
|
16
|
+
res = yield.to_s
|
17
|
+
}
|
18
|
+
assert_equal exp, res
|
19
|
+
assert_instance_of ActiveSupport::SafeBuffer, res
|
20
|
+
end
|
21
|
+
|
22
|
+
def setup
|
23
|
+
super
|
24
|
+
assert_nil @rumble_context
|
25
|
+
end
|
26
|
+
|
27
|
+
def teardown
|
28
|
+
super
|
29
|
+
assert_nil @rumble_context
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_simple
|
33
|
+
str = <<-HTML
|
34
|
+
<form>
|
35
|
+
<div id="wrapper">
|
36
|
+
<h1>My Site</h1>
|
37
|
+
</div>
|
38
|
+
<div class="input">
|
39
|
+
<input type="text" name="value">
|
40
|
+
</div>
|
41
|
+
</form>
|
42
|
+
HTML
|
43
|
+
|
44
|
+
assert_rumble str do
|
45
|
+
form do
|
46
|
+
div.wrapper! do
|
47
|
+
h1 "My Site"
|
48
|
+
end
|
49
|
+
|
50
|
+
div.input do
|
51
|
+
input type: 'text', name: 'value'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_several
|
58
|
+
str = <<-HTML
|
59
|
+
<p>Hello</p>
|
60
|
+
<p>World</p>
|
61
|
+
HTML
|
62
|
+
|
63
|
+
assert_rumble str do
|
64
|
+
p "Hello"
|
65
|
+
p "World"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_several_capture
|
70
|
+
str = <<-HTML
|
71
|
+
<div>
|
72
|
+
<p>Hello</p>
|
73
|
+
<p>Hello</p>
|
74
|
+
|
|
75
|
+
<p>World</p>
|
76
|
+
<p>World</p>
|
77
|
+
</div>
|
78
|
+
HTML
|
79
|
+
|
80
|
+
assert_rumble str do
|
81
|
+
div do
|
82
|
+
(%w[Hello World].map { |x| html { p x; p x } } * '|').html_safe
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_capture_raise
|
88
|
+
assert_raises RuntimeError do
|
89
|
+
html {
|
90
|
+
div do
|
91
|
+
html { raise }
|
92
|
+
end
|
93
|
+
}
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_escape
|
98
|
+
str = <<-HTML
|
99
|
+
<p class=""test"">Hello & World</p>
|
100
|
+
HTML
|
101
|
+
|
102
|
+
assert_rumble str do
|
103
|
+
p "Hello & World", :class => '"test"'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_multiple_css_classes
|
108
|
+
str = <<-HTML
|
109
|
+
<p class="one two three"></p>
|
110
|
+
HTML
|
111
|
+
|
112
|
+
assert_rumble str do
|
113
|
+
p.one.two.three
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_selfclosing
|
118
|
+
assert_rumble "<br>" do
|
119
|
+
br
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_text
|
124
|
+
assert_rumble "hello" do
|
125
|
+
text "hello"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_escaping_unsafe_input
|
130
|
+
str = "<br>"
|
131
|
+
|
132
|
+
assert_rumble "<div><br></div>" do
|
133
|
+
div { str }
|
134
|
+
end
|
135
|
+
|
136
|
+
assert_rumble "<div><br></div>" do
|
137
|
+
div str
|
138
|
+
end
|
139
|
+
|
140
|
+
assert_rumble "<div><br></div>" do
|
141
|
+
div { text { str } }
|
142
|
+
end
|
143
|
+
|
144
|
+
assert_rumble "<div><br></div>" do
|
145
|
+
div { text str }
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_not_escaping_safe_input
|
150
|
+
str = "<br>".html_safe
|
151
|
+
|
152
|
+
assert_rumble "<div><br></div>" do
|
153
|
+
div { str }
|
154
|
+
end
|
155
|
+
|
156
|
+
assert_rumble "<div><br></div>" do
|
157
|
+
div str
|
158
|
+
end
|
159
|
+
|
160
|
+
assert_rumble "<div><br></div>" do
|
161
|
+
div { text { str } }
|
162
|
+
end
|
163
|
+
|
164
|
+
assert_rumble "<div><br></div>" do
|
165
|
+
div { text str }
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_error_tags_outside_rumble_context
|
170
|
+
assert_raises Rumble::Error do
|
171
|
+
div "content"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def test_error_selfclosing_content
|
176
|
+
assert_raises Rumble::Error do
|
177
|
+
html {
|
178
|
+
br "content"
|
179
|
+
}
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_error_css_proxy_continue
|
184
|
+
assert_raises Rumble::Error do
|
185
|
+
html {
|
186
|
+
p.one("test").two
|
187
|
+
}
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# The real test here is if @rumble_context is nil in the teardown.
|
192
|
+
def test_error_general
|
193
|
+
assert_raises RuntimeError do
|
194
|
+
html {
|
195
|
+
div do
|
196
|
+
raise
|
197
|
+
end
|
198
|
+
}
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
class Keynote::NestedPresenterTest < Keynote::TestCase
|
4
|
+
setup do
|
5
|
+
@presenter = Keynote::NestedPresenter.new(view, :model)
|
6
|
+
end
|
7
|
+
|
8
|
+
test "presenter has view context" do
|
9
|
+
assert_equal "<div id=\"hi\"><a href=\"Hello\">#</a></div>",
|
10
|
+
@presenter.generate_div
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: keynote
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ryan Fitzgerald
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: appraisal
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: minitest
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: mocha
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: pry
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: redcarpet
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: yard
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: ''
|
127
|
+
email:
|
128
|
+
- rwfitzge@gmail.com
|
129
|
+
executables: []
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- .gitignore
|
134
|
+
- .yardopts
|
135
|
+
- Appraisals
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE
|
138
|
+
- README.md
|
139
|
+
- Rakefile
|
140
|
+
- keynote.gemspec
|
141
|
+
- lib/generators/presenter_generator.rb
|
142
|
+
- lib/generators/templates/keynote_mini_test_spec.rb
|
143
|
+
- lib/generators/templates/keynote_mini_test_unit.rb
|
144
|
+
- lib/generators/templates/keynote_presenter.rb
|
145
|
+
- lib/generators/templates/keynote_rspec.rb
|
146
|
+
- lib/generators/templates/keynote_test_unit.rb
|
147
|
+
- lib/keynote.rb
|
148
|
+
- lib/keynote/cache.rb
|
149
|
+
- lib/keynote/controller.rb
|
150
|
+
- lib/keynote/helper.rb
|
151
|
+
- lib/keynote/presenter.rb
|
152
|
+
- lib/keynote/railtie.rb
|
153
|
+
- lib/keynote/rumble.rb
|
154
|
+
- lib/keynote/testing/minitest_rails.rake
|
155
|
+
- lib/keynote/testing/minitest_rails.rb
|
156
|
+
- lib/keynote/testing/rspec.rb
|
157
|
+
- lib/keynote/testing/test_unit.rb
|
158
|
+
- lib/keynote/version.rb
|
159
|
+
- spec/generator_spec.rb
|
160
|
+
- spec/helper.rb
|
161
|
+
- spec/keynote_spec.rb
|
162
|
+
- spec/presenter_spec.rb
|
163
|
+
- spec/railtie_spec.rb
|
164
|
+
- spec/rumble_spec.rb
|
165
|
+
- spec/test_case_spec.rb
|
166
|
+
homepage: ''
|
167
|
+
licenses: []
|
168
|
+
post_install_message:
|
169
|
+
rdoc_options: []
|
170
|
+
require_paths:
|
171
|
+
- lib
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
174
|
+
requirements:
|
175
|
+
- - ! '>='
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
segments:
|
179
|
+
- 0
|
180
|
+
hash: -4215378202038736203
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
segments:
|
188
|
+
- 0
|
189
|
+
hash: -4215378202038736203
|
190
|
+
requirements: []
|
191
|
+
rubyforge_project:
|
192
|
+
rubygems_version: 1.8.24
|
193
|
+
signing_key:
|
194
|
+
specification_version: 3
|
195
|
+
summary: ''
|
196
|
+
test_files:
|
197
|
+
- spec/generator_spec.rb
|
198
|
+
- spec/helper.rb
|
199
|
+
- spec/keynote_spec.rb
|
200
|
+
- spec/presenter_spec.rb
|
201
|
+
- spec/railtie_spec.rb
|
202
|
+
- spec/rumble_spec.rb
|
203
|
+
- spec/test_case_spec.rb
|
204
|
+
has_rdoc:
|