middleman-more 3.0.8 → 3.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,6 +21,40 @@ Feature: link_to helper
21
21
  Then I should see 'absolute: <a href="../needs_index.html">Needs Index</a>'
22
22
  Then I should see 'relative: <a href="../needs_index.html">Relative</a>'
23
23
 
24
+ Scenario: link_to relative works with strip_index_file
25
+ Given a fixture app "indexable-app"
26
+ And a file named "config.rb" with:
27
+ """
28
+ set :relative_links, true
29
+ set :strip_index_file, true
30
+ helpers do
31
+ def menu_items(path='link_to.html')
32
+ sitemap.find_resource_by_destination_path(path).children
33
+ end
34
+ end
35
+ """
36
+ And a file named "source/link_to.html.erb" with:
37
+ """
38
+ <% menu_items.each do |item| %>
39
+ <%= link_to(item.metadata[:page]['title'], item.url) %>
40
+ <%= link_to(item.metadata[:page]['title'], item) %>
41
+ <% end %>
42
+ """
43
+ And a file named "source/link_to/sub.html.erb" with:
44
+ """
45
+ <% menu_items.each do |item| %>
46
+ <%= link_to(item.metadata[:page]['title'], item.url) %>
47
+ <%= link_to(item.metadata[:page]['title'], item) %>
48
+ <% end %>
49
+ """
50
+ And the Server is running at "indexable-app"
51
+ When I go to "/link_to.html"
52
+ Then I should see '"link_to/sub.html"'
53
+ Then I should not see "/link_to/sub.html"
54
+ When I go to "/link_to/sub.html"
55
+ Then I should see '"sub.html"'
56
+ Then I should not see "/link_to/sub.html"
57
+
24
58
  Scenario: link_to produces relative links when :relative_links is set to true
25
59
  Given a fixture app "indexable-app"
26
60
  And a file named "config.rb" with:
@@ -129,8 +129,10 @@ module Middleman
129
129
 
130
130
  # Handle Resources, which define their own url method
131
131
  if url.respond_to? :url
132
- args[url_arg_index] = url.url
133
- elsif url.include? '://'
132
+ url = args[url_arg_index] = url.url
133
+ end
134
+
135
+ if url.include? '://'
134
136
  raise "Can't use the relative option with an external URL" if relative
135
137
  elsif current_resource
136
138
  # Handle relative urls
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-more
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.8
4
+ version: 3.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 3.0.8
22
+ version: 3.0.9
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - '='
29
29
  - !ruby/object:Gem::Version
30
- version: 3.0.8
30
+ version: 3.0.9
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: uglifier
33
33
  requirement: !ruby/object:Gem::Requirement
@@ -641,7 +641,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
641
641
  version: '0'
642
642
  segments:
643
643
  - 0
644
- hash: 747788437241973931
644
+ hash: -1092538238619179817
645
645
  required_rubygems_version: !ruby/object:Gem::Requirement
646
646
  none: false
647
647
  requirements:
@@ -650,7 +650,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
650
650
  version: '0'
651
651
  segments:
652
652
  - 0
653
- hash: 747788437241973931
653
+ hash: -1092538238619179817
654
654
  requirements: []
655
655
  rubyforge_project:
656
656
  rubygems_version: 1.8.24