navigation_builder 1.0.0.beta6 → 2.0.0.beta1
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/Gemfile +3 -2
- data/Gemfile.lock +34 -7
- data/VERSION +1 -1
- data/lib/action_view/helpers/navigation_builder.rb +3 -1
- data/navigation_builder.gemspec +3 -3
- data/test/helper.rb +32 -3
- data/test/test_navigation_builder.rb +229 -171
- metadata +18 -18
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,29 +1,56 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionpack (3.0.11)
|
6
|
+
activemodel (= 3.0.11)
|
7
|
+
activesupport (= 3.0.11)
|
8
|
+
builder (~> 2.1.2)
|
9
|
+
erubis (~> 2.6.6)
|
10
|
+
i18n (~> 0.5.0)
|
11
|
+
rack (~> 1.2.1)
|
12
|
+
rack-mount (~> 0.6.14)
|
13
|
+
rack-test (~> 0.5.7)
|
14
|
+
tzinfo (~> 0.3.23)
|
15
|
+
activemodel (3.0.11)
|
16
|
+
activesupport (= 3.0.11)
|
17
|
+
builder (~> 2.1.2)
|
18
|
+
i18n (~> 0.5.0)
|
19
|
+
activesupport (3.0.11)
|
20
|
+
builder (2.1.2)
|
21
|
+
erubis (2.6.6)
|
22
|
+
abstract (>= 1.0.0)
|
8
23
|
git (1.2.5)
|
24
|
+
i18n (0.5.0)
|
9
25
|
jeweler (1.6.0)
|
10
26
|
bundler (~> 1.0.0)
|
11
27
|
git (>= 1.2.5)
|
12
28
|
rake
|
13
|
-
|
29
|
+
nokogiri (1.4.7)
|
30
|
+
nokogiri-diff (0.1.0)
|
31
|
+
nokogiri (~> 1.4.1)
|
32
|
+
tdiff (~> 0.3.2)
|
33
|
+
rack (1.2.5)
|
34
|
+
rack-mount (0.6.14)
|
35
|
+
rack (>= 1.0.0)
|
36
|
+
rack-test (0.5.7)
|
37
|
+
rack (>= 1.0)
|
14
38
|
rake (0.9.0)
|
15
39
|
rcov (0.9.9)
|
16
40
|
redgreen (1.2.2)
|
17
41
|
shoulda (2.11.3)
|
42
|
+
tdiff (0.3.2)
|
43
|
+
tzinfo (0.3.31)
|
18
44
|
|
19
45
|
PLATFORMS
|
20
46
|
ruby
|
21
47
|
|
22
48
|
DEPENDENCIES
|
23
|
-
actionpack (~>
|
24
|
-
activesupport (~>
|
49
|
+
actionpack (~> 3.0.10)
|
50
|
+
activesupport (~> 3.0.10)
|
25
51
|
bundler (~> 1.0.0)
|
26
52
|
jeweler (~> 1.6.0)
|
53
|
+
nokogiri-diff
|
27
54
|
rcov
|
28
55
|
redgreen (~> 1.2.2)
|
29
56
|
shoulda (~> 2.11.3)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0.beta1
|
@@ -116,8 +116,10 @@ module ActionView
|
|
116
116
|
set_selected_link( name, html_options, item_html_options ) if is_selected?( name )
|
117
117
|
|
118
118
|
@template.concat( @template.tag( @options[:nav_item_tag], item_html_options, true) ) if @options[:nav_item_tag]
|
119
|
-
@template.link_to(options, html_options, &link_block)
|
119
|
+
link_html = @template.link_to(options, html_options, &link_block)
|
120
|
+
@template.concat(link_html)
|
120
121
|
@template.concat( "</#{@options[:nav_item_tag]}>".html_safe ) if @options[:nav_item_tag]
|
122
|
+
nil # have to return nil here so that the generated HTML is not added twice
|
121
123
|
end
|
122
124
|
|
123
125
|
def link_to_in_html( name, options, html_options )
|
data/navigation_builder.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{navigation_builder}
|
8
|
-
s.version = "
|
8
|
+
s.version = "2.0.0.beta1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Derek Lindahl"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2012-01-05}
|
13
13
|
s.description = %q{NavigationBuilder makes creating navigational links in a Rails application a breeze.}
|
14
14
|
s.email = %q{dlindahl@customink.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.homepage = %q{http://github.com/customink/navigation_builder}
|
34
34
|
s.licenses = ["MIT"]
|
35
35
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.
|
36
|
+
s.rubygems_version = %q{1.6.2}
|
37
37
|
s.summary = %q{Just like a Rails FormBuilder, but for Navigation}
|
38
38
|
|
39
39
|
if s.respond_to? :specification_version then
|
data/test/helper.rb
CHANGED
@@ -8,18 +8,47 @@ rescue Bundler::BundlerError => e
|
|
8
8
|
exit e.status_code
|
9
9
|
end
|
10
10
|
|
11
|
+
require 'ostruct'
|
12
|
+
|
11
13
|
require 'test/unit'
|
12
14
|
require 'redgreen'
|
13
15
|
require 'shoulda'
|
14
16
|
|
15
17
|
# require 'active_support/deprecation' # For Rails 3
|
16
|
-
require '
|
18
|
+
require 'action_controller'
|
17
19
|
require 'action_view'
|
18
|
-
require '
|
20
|
+
require 'action_view/test_case'
|
21
|
+
require 'action_pack/version'
|
22
|
+
require 'nokogiri/diff'
|
23
|
+
|
24
|
+
|
25
|
+
|
19
26
|
|
20
27
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
21
28
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
22
29
|
require 'navigation_builder'
|
23
30
|
|
24
|
-
|
31
|
+
module CustomAssertions
|
32
|
+
def assert_generated_markup
|
33
|
+
test_inputs = OpenStruct.new(:tempate => "", :expected => "")
|
34
|
+
yield test_inputs
|
35
|
+
render :inline => test_inputs.template
|
36
|
+
|
37
|
+
expected_dom = Nokogiri::XML(test_inputs.expected)
|
38
|
+
rendered_dom = Nokogiri::XML(rendered)
|
39
|
+
|
40
|
+
different = expected_dom.diff(rendered_dom).any? do |change, node|
|
41
|
+
# we are looking for anything that's an actual difference (change will be
|
42
|
+
# + or -) and the content of the difference is more than just whitespace
|
43
|
+
change != " " && node.content.strip != ""
|
44
|
+
end
|
45
|
+
|
46
|
+
assert !different, <<-EOS
|
47
|
+
generated and expected HTML differ
|
48
|
+
======== Generated ========
|
49
|
+
#{rendered}
|
50
|
+
======== Expected ========
|
51
|
+
#{test_inputs.expected}
|
52
|
+
EOS
|
53
|
+
end
|
25
54
|
end
|
@@ -6,6 +6,8 @@ require 'action_view/test_case'
|
|
6
6
|
|
7
7
|
class TestNavigationBuilder < ActionView::TestCase
|
8
8
|
|
9
|
+
include CustomAssertions
|
10
|
+
|
9
11
|
tests ActionView::Helpers::NavigationBuilderHelper
|
10
12
|
|
11
13
|
should "set the default NavigationBuilder" do
|
@@ -13,232 +15,288 @@ class TestNavigationBuilder < ActionView::TestCase
|
|
13
15
|
end
|
14
16
|
|
15
17
|
should "generate HTML that contains navigation" do
|
16
|
-
|
17
|
-
|
18
|
+
assert_generated_markup do |test|
|
19
|
+
test.template = <<-EOS
|
20
|
+
<% navigation_for :main do |nav| %>
|
21
|
+
<%= nav.link_to 'Foo', '#' %>
|
22
|
+
<% end %>
|
23
|
+
EOS
|
24
|
+
|
25
|
+
test.expected = <<-EOS
|
26
|
+
<ul>
|
27
|
+
<li>
|
28
|
+
<a href=\"#\">Foo</a>
|
29
|
+
</li>
|
30
|
+
</ul>
|
31
|
+
EOS
|
18
32
|
end
|
19
|
-
|
20
|
-
expected = [
|
21
|
-
"<ul>",
|
22
|
-
"<li>",
|
23
|
-
"<a href=\"#\">Foo</a>",
|
24
|
-
"</li>",
|
25
|
-
"</ul>"
|
26
|
-
].join('')
|
27
|
-
|
28
|
-
assert_dom_equal expected, output_buffer
|
29
33
|
end
|
30
34
|
|
31
35
|
should "know how many links have been rendered" do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
render :inline => <<-EOS
|
37
|
+
<% navigation_for :main do |nav| %>
|
38
|
+
<%= nav.link_to( 'Foo', '#' ) %>
|
39
|
+
<%= nav.link_to( 'Bar', '#' ) %>
|
40
|
+
<%= nav.item_count %> links
|
41
|
+
<% end %>
|
42
|
+
EOS
|
43
|
+
|
44
|
+
assert_match /2 links/, rendered
|
40
45
|
end
|
41
46
|
|
42
47
|
should "generate HTML with custom wrapper tag name" do
|
43
|
-
|
44
|
-
|
48
|
+
assert_generated_markup do |test|
|
49
|
+
test.template = <<-EOS
|
50
|
+
<% navigation_for :main, :wrapper_tag => :ol do |nav| %>
|
51
|
+
<%= nav.link_to( 'Foo', '#' ) %>
|
52
|
+
<% end %>
|
53
|
+
EOS
|
54
|
+
|
55
|
+
test.expected = <<-EOS
|
56
|
+
<ol>
|
57
|
+
<li>
|
58
|
+
<a href="#">Foo</a>
|
59
|
+
</li>
|
60
|
+
</ol>
|
61
|
+
EOS
|
45
62
|
end
|
46
|
-
|
47
|
-
expected = [
|
48
|
-
"<ol>",
|
49
|
-
"<li>",
|
50
|
-
"<a href=\"#\">Foo</a>",
|
51
|
-
"</li>",
|
52
|
-
"</ol>"
|
53
|
-
].join('')
|
54
|
-
|
55
|
-
assert_dom_equal expected, output_buffer
|
56
63
|
end
|
57
64
|
|
58
65
|
should "generate HTML with no wrapper" do
|
59
|
-
|
60
|
-
|
66
|
+
assert_generated_markup do |test|
|
67
|
+
test.template = <<-EOS
|
68
|
+
<% navigation_for :main, :wrapper_tag => false do |nav| %>
|
69
|
+
<%= nav.link_to( 'Foo', '#' ) %>
|
70
|
+
<% end %>
|
71
|
+
EOS
|
72
|
+
|
73
|
+
test.expected = <<-EOS
|
74
|
+
<li>
|
75
|
+
<a href="#">Foo</a>
|
76
|
+
</li>
|
77
|
+
EOS
|
61
78
|
end
|
62
|
-
|
63
|
-
expected = [
|
64
|
-
"<li>",
|
65
|
-
"<a href=\"#\">Foo</a>",
|
66
|
-
"</li>"
|
67
|
-
].join('')
|
68
|
-
|
69
|
-
assert_dom_equal expected, output_buffer
|
70
79
|
end
|
71
80
|
|
72
81
|
should "generate HTML with no wrapper and a custom nav item tag name" do
|
73
|
-
|
74
|
-
|
82
|
+
assert_generated_markup do |test|
|
83
|
+
test.template = <<-EOS
|
84
|
+
<% navigation_for :main, :nav_item_tag => 'div' do |nav| %>
|
85
|
+
<%= nav.link_to( 'Foo', '#' ) %>
|
86
|
+
<% end %>
|
87
|
+
EOS
|
88
|
+
|
89
|
+
test.expected = <<-EOS
|
90
|
+
<div>
|
91
|
+
<a href="#">Foo</a>
|
92
|
+
</div>
|
93
|
+
EOS
|
75
94
|
end
|
76
|
-
|
77
|
-
expected = [
|
78
|
-
"<div>",
|
79
|
-
"<a href=\"#\">Foo</a>",
|
80
|
-
"</div>"
|
81
|
-
].join('')
|
82
|
-
|
83
|
-
assert_dom_equal expected, output_buffer
|
84
95
|
end
|
85
96
|
|
86
97
|
should "generate HTML with no wrapper and a no nav item tag" do
|
87
|
-
|
88
|
-
|
98
|
+
assert_generated_markup do |test|
|
99
|
+
test.template = <<-EOS
|
100
|
+
<% navigation_for :main, :nav_item_tag => false do |nav| %>
|
101
|
+
<%= nav.link_to( 'Foo', '#' ) %>
|
102
|
+
<% end %>
|
103
|
+
EOS
|
104
|
+
|
105
|
+
test.expected = <<-EOS
|
106
|
+
<a href="#">Foo</a>
|
107
|
+
EOS
|
89
108
|
end
|
90
|
-
|
91
|
-
expected = [
|
92
|
-
"<a href=\"#\">Foo</a>"
|
93
|
-
].join('')
|
94
|
-
|
95
|
-
assert_dom_equal expected, output_buffer
|
96
109
|
end
|
97
110
|
|
98
111
|
should "generate HTML that contains user-defined attributes" do
|
99
|
-
|
100
|
-
|
112
|
+
assert_generated_markup do |test|
|
113
|
+
test.template = <<-EOS
|
114
|
+
<% navigation_for :main, :html => { :class => 'bar', 'data-more' => 'baz' } do |nav| %>
|
115
|
+
<%= nav.link_to( 'Foo', '#' ) %>
|
116
|
+
<% end %>
|
117
|
+
EOS
|
118
|
+
|
119
|
+
test.expected = <<-EOS
|
120
|
+
<ul class="bar" data-more="baz">
|
121
|
+
<li>
|
122
|
+
<a href="#">Foo</a>
|
123
|
+
</li>
|
124
|
+
</ul>
|
125
|
+
EOS
|
101
126
|
end
|
102
|
-
|
103
|
-
expected = [
|
104
|
-
"<ul class=\"bar\" data-more=\"baz\">",
|
105
|
-
"<li>",
|
106
|
-
"<a href=\"#\">Foo</a>",
|
107
|
-
"</li>",
|
108
|
-
"</ul>"
|
109
|
-
].join('')
|
110
|
-
|
111
|
-
assert_dom_equal expected, output_buffer
|
112
127
|
end
|
113
128
|
|
114
129
|
should "generate HTML with links that were created with blocks" do
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
130
|
+
assert_generated_markup do |test|
|
131
|
+
test.template = <<-EOS
|
132
|
+
<% navigation_for :main do |nav| %>
|
133
|
+
<% nav.link_to( '#' ) do %>
|
134
|
+
<span>Foo</span>
|
135
|
+
<% end %>
|
136
|
+
<% end %>
|
137
|
+
EOS
|
138
|
+
|
139
|
+
test.expected = <<-EOS
|
140
|
+
<ul>
|
141
|
+
<li>
|
142
|
+
<a href="#"><span>Foo</span></a>
|
143
|
+
</li>
|
144
|
+
</ul>
|
145
|
+
EOS
|
129
146
|
|
130
|
-
|
147
|
+
end
|
131
148
|
end
|
132
149
|
|
133
150
|
should "generate HTML with links that contain user-defined classes" do
|
134
|
-
|
135
|
-
|
151
|
+
assert_generated_markup do |test|
|
152
|
+
test.template = <<-EOS
|
153
|
+
<% navigation_for :main do |nav| %>
|
154
|
+
<%= nav.link_to( 'Foo', '#', :class => 'bar' ) %>
|
155
|
+
<% end %>
|
156
|
+
EOS
|
157
|
+
|
158
|
+
test.expected = <<-EOS
|
159
|
+
<ul>
|
160
|
+
<li>
|
161
|
+
<a href="#" class="bar">Foo</a>
|
162
|
+
</li>
|
163
|
+
</ul>
|
164
|
+
EOS
|
136
165
|
end
|
137
|
-
|
138
|
-
expected = [
|
139
|
-
"<ul>",
|
140
|
-
"<li>",
|
141
|
-
"<a href=\"#\" class=\"bar\">Foo</a>",
|
142
|
-
"</li>",
|
143
|
-
"</ul>"
|
144
|
-
].join('')
|
145
|
-
|
146
|
-
assert_dom_equal expected, output_buffer
|
147
166
|
end
|
148
167
|
|
149
168
|
should "generate HTML with links that contain user-defined classes on the container items" do
|
150
|
-
|
151
|
-
|
169
|
+
assert_generated_markup do |test|
|
170
|
+
test.template = <<-EOS
|
171
|
+
<% navigation_for :main do |nav| %>
|
172
|
+
<%= nav.link_to( 'Foo', '#', :item_html => { :class => 'bar' } ) %>
|
173
|
+
<% end %>
|
174
|
+
EOS
|
175
|
+
|
176
|
+
test.expected = <<-EOS
|
177
|
+
<ul>
|
178
|
+
<li class="bar">
|
179
|
+
<a href="#">Foo</a>
|
180
|
+
</li>
|
181
|
+
</ul>
|
182
|
+
EOS
|
152
183
|
end
|
153
|
-
|
154
|
-
expected = [
|
155
|
-
"<ul>",
|
156
|
-
"<li class=\"bar\">",
|
157
|
-
"<a href=\"#\">Foo</a>",
|
158
|
-
"</li>",
|
159
|
-
"</ul>"
|
160
|
-
].join('')
|
161
|
-
|
162
|
-
assert_dom_equal expected, output_buffer
|
163
184
|
end
|
164
185
|
|
165
186
|
should "generate HTML that highlights the currently selected navigation link" do
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
187
|
+
assert_generated_markup do |test|
|
188
|
+
test.template = <<-EOS
|
189
|
+
<% navigation_select 'Foo', :in => :main %>
|
190
|
+
<% navigation_for :main do |nav| %>
|
191
|
+
<%= nav.link_to( 'Foo', '#' ) %>
|
192
|
+
<% end %>
|
193
|
+
EOS
|
194
|
+
|
195
|
+
test.expected = <<-EOS
|
196
|
+
<ul>
|
197
|
+
<li class="selected">
|
198
|
+
<a href="#">Foo</a>
|
199
|
+
</li>
|
200
|
+
</ul>
|
201
|
+
EOS
|
170
202
|
end
|
171
|
-
|
172
|
-
expected = [
|
173
|
-
"<ul>",
|
174
|
-
"<li class=\"selected\">",
|
175
|
-
"<a href=\"#\">Foo</a>",
|
176
|
-
"</li>",
|
177
|
-
"</ul>"
|
178
|
-
].join('')
|
179
|
-
|
180
|
-
assert_dom_equal expected, output_buffer
|
181
203
|
end
|
182
204
|
|
183
205
|
should "generate HTML that highlights the currently selected navigation link with a custom class name" do
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
206
|
+
assert_generated_markup do |test|
|
207
|
+
test.template = <<-EOS
|
208
|
+
<% navigation_select 'Foo', :in => :main %>
|
209
|
+
<% navigation_for :main, :selected_class => 'current-page' do |nav| %>
|
210
|
+
<%= nav.link_to( 'Foo', '#' ) %>
|
211
|
+
<% end %>
|
212
|
+
EOS
|
213
|
+
|
214
|
+
test.expected = <<-EOS
|
215
|
+
<ul>
|
216
|
+
<li class="current-page">
|
217
|
+
<a href="#">Foo</a>
|
218
|
+
</li>
|
219
|
+
</ul>
|
220
|
+
EOS
|
188
221
|
end
|
189
|
-
|
190
|
-
expected = [
|
191
|
-
"<ul>",
|
192
|
-
"<li class=\"current-page\">",
|
193
|
-
"<a href=\"#\">Foo</a>",
|
194
|
-
"</li>",
|
195
|
-
"</ul>"
|
196
|
-
].join('')
|
197
|
-
|
198
|
-
assert_dom_equal expected, output_buffer
|
199
222
|
end
|
200
223
|
|
201
224
|
should "generate HTML that highlights the currently selected navigation link even where there is no item tag" do
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
225
|
+
assert_generated_markup do |test|
|
226
|
+
test.template = <<-EOS
|
227
|
+
<% navigation_select 'Foo', :in => :main %>
|
228
|
+
<% navigation_for :main, :nav_item_tag => false do |nav| %>
|
229
|
+
<%= nav.link_to( 'Foo', '#' ) %>
|
230
|
+
<% end %>
|
231
|
+
EOS
|
232
|
+
|
233
|
+
test.expected = <<-EOS
|
234
|
+
<a href="#" class="selected">Foo</a>
|
235
|
+
EOS
|
206
236
|
end
|
207
|
-
|
208
|
-
expected = [
|
209
|
-
"<a href=\"#\" class=\"selected\">Foo</a>"
|
210
|
-
].join('')
|
211
|
-
|
212
|
-
assert_dom_equal expected, output_buffer
|
213
237
|
end
|
214
238
|
|
215
239
|
should "generate HTML that highlights the currently selected navigation link by using a Regular Expression" do
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
240
|
+
assert_generated_markup do |test|
|
241
|
+
test.template = <<-EOS
|
242
|
+
<% navigation_select /Foo/, :in => :main %>
|
243
|
+
<% navigation_for :main do |nav| %>
|
244
|
+
<% nav.link_to( '#' ) do %>
|
245
|
+
<span>Foo</span>
|
246
|
+
<% end %>
|
247
|
+
<% end %>
|
248
|
+
EOS
|
249
|
+
|
250
|
+
test.expected = <<-EOS
|
251
|
+
<ul>
|
252
|
+
<li class="selected">
|
253
|
+
<a href="#"><span>Foo</span></a>
|
254
|
+
</li>
|
255
|
+
</ul>
|
256
|
+
EOS
|
257
|
+
end
|
234
258
|
end
|
235
259
|
|
236
260
|
should "raise an exception if a link is selected AFTER the navigation has been rendered" do
|
237
|
-
assert_raises
|
238
|
-
|
239
|
-
|
261
|
+
assert_raises ActionView::Template::Error do
|
262
|
+
render :inline => <<-EOS
|
263
|
+
<% navigation_for :main do |nav| %>
|
264
|
+
<%= nav.link_to( 'Foo', '#' ) %>
|
265
|
+
<% end %>
|
266
|
+
<% navigation_select 'Foo', :in => :main %>
|
267
|
+
EOS
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
if ::ActionPack::VERSION::MAJOR >= 3
|
272
|
+
should "correctly render a template when there is a yield" do
|
273
|
+
assert_generated_markup do |test|
|
274
|
+
test.template = <<-EOS
|
275
|
+
<% content_for :head do %>
|
276
|
+
this is the top
|
277
|
+
<% end %>
|
278
|
+
|
279
|
+
this is some text
|
280
|
+
<% yield :head %>
|
281
|
+
|
282
|
+
<% navigation_for :main do |nav| %>
|
283
|
+
<% nav.link_to '#' do %>
|
284
|
+
<span>Foo</span>
|
285
|
+
<% end %>
|
286
|
+
<% end %>
|
287
|
+
EOS
|
288
|
+
|
289
|
+
test.expected = <<-EOS
|
290
|
+
this is some text
|
291
|
+
this is the top
|
292
|
+
|
293
|
+
<ul>
|
294
|
+
<li>
|
295
|
+
<a href="#"><span>Foo</span></a>
|
296
|
+
</li>
|
297
|
+
</ul>
|
298
|
+
EOS
|
240
299
|
end
|
241
|
-
navigation_select 'Foo', :in => :main
|
242
300
|
end
|
243
301
|
end
|
244
302
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: navigation_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 62196449
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version:
|
11
|
+
- 1
|
12
|
+
version: 2.0.0.beta1
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Derek Lindahl
|
@@ -17,12 +17,12 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date:
|
20
|
+
date: 2012-01-05 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
|
-
|
25
|
-
|
24
|
+
type: :development
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
@@ -33,12 +33,12 @@ dependencies:
|
|
33
33
|
- 6
|
34
34
|
- 0
|
35
35
|
version: 1.6.0
|
36
|
-
type: :development
|
37
36
|
name: jeweler
|
38
|
-
|
39
|
-
- !ruby/object:Gem::Dependency
|
37
|
+
version_requirements: *id001
|
40
38
|
prerelease: false
|
41
|
-
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
type: :development
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ~>
|
@@ -49,12 +49,12 @@ dependencies:
|
|
49
49
|
- 0
|
50
50
|
- 0
|
51
51
|
version: 1.0.0
|
52
|
-
type: :development
|
53
52
|
name: bundler
|
54
|
-
|
55
|
-
- !ruby/object:Gem::Dependency
|
53
|
+
version_requirements: *id002
|
56
54
|
prerelease: false
|
57
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
type: :development
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
@@ -63,9 +63,9 @@ dependencies:
|
|
63
63
|
segments:
|
64
64
|
- 0
|
65
65
|
version: "0"
|
66
|
-
type: :development
|
67
66
|
name: rcov
|
68
|
-
|
67
|
+
version_requirements: *id003
|
68
|
+
prerelease: false
|
69
69
|
description: NavigationBuilder makes creating navigational links in a Rails application a breeze.
|
70
70
|
email: dlindahl@customink.com
|
71
71
|
executables: []
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
requirements: []
|
121
121
|
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 1.
|
123
|
+
rubygems_version: 1.6.2
|
124
124
|
signing_key:
|
125
125
|
specification_version: 3
|
126
126
|
summary: Just like a Rails FormBuilder, but for Navigation
|