1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

Handle page id's that are Fixnums (#2033)

* chore: failing test case for #2032

* fix: Use `to_s.to_sym` for page_id’s in the store since they can be Fixnum’s

* chore: delete stale queryable-app fixture
This commit is contained in:
Kenneth Kalmer 2017-01-06 22:13:10 +02:00 committed by Thomas Reynolds
parent 3d288197f8
commit a215b250dc
10 changed files with 16 additions and 46 deletions

View file

@ -11,6 +11,7 @@ Feature: Page IDs
And I should see 'URL5: <a href="/implicit.html">Imp</a>'
And I should see 'URL6: <a href="/folder/foldern.html">Foldern</a>'
And I should see 'URL7: <a href="/feed.xml">Feed</a>'
And I should see "URL8: /fourty-two.html"
When I go to "/fm.html"
Then I should see "I am: frontmatter"
@ -45,9 +46,10 @@ Feature: Page IDs
And I should see "URL2: /2.html"
And I should see 'URL3: <a href="/3.html">Hi</a>'
And I should see 'URL4: <a href="/overwrites/from-default.html">Sym</a>'
And I should see 'URL8: <a href="/implicit.html">Imp</a>'
And I should see 'URL9: <a href="/folder/foldern.html">Foldern</a>'
And I should see 'URL10: <a href="/feed.xml">Feed</a>'
And I should see "URL8: /fourty-two.html"
And I should see 'URL9: <a href="/implicit.html">Imp</a>'
And I should see 'URL10: <a href="/folder/foldern.html">Foldern</a>'
And I should see 'URL11: <a href="/feed.xml">Feed</a>'
When I go to "/fm.html"
Then I should see "I am: frontmatter"

View file

@ -0,0 +1,5 @@
---
id: 42
---
I am: <%= current_resource.page_id %>

View file

@ -7,8 +7,9 @@ URL4: <%= link_to "Sym", :"something-else" %>
URL5: <%= link_to "Imp", :implicit %>
URL6: <%= link_to "Foldern", "folder/foldern" %>
URL7: <%= link_to "Feed", "feed.xml" %>
URL8: <%= url_for "42" %>
<%# If custom proc %>
URL8: <%= link_to "Imp", "implicit.html-foo" %>
URL9: <%= link_to "Foldern", "folder/foldern.html-foo" %>
URL10: <%= link_to "Feed", "feed.xml-foo" %>
URL9: <%= link_to "Imp", "implicit.html-foo" %>
URL10: <%= link_to "Foldern", "folder/foldern.html-foo" %>
URL11: <%= link_to "Feed", "feed.xml-foo" %>

View file

@ -1,8 +0,0 @@
---
id: 1
title: Some fancy title
tags: [ruby]
status: :published
---
I like being the demo text.

View file

@ -1,10 +0,0 @@
---
id: 2
title: Another title, that's for sure
tags: [ruby, rails]
special_attribute: Yes!
friends: [Anton, Paul]
status: :published
---
The body copy.

View file

@ -1,6 +0,0 @@
---
id: 5
title: Some test document
---
This is just some test document.

View file

@ -1,7 +0,0 @@
---
id: 3
title: Document with date in YAML
date: 2011-04-05
---
This document has no date in the filename, but in the YAML front matter.

View file

@ -1,7 +0,0 @@
---
id: 4
title: This document has no date
seldom_attribute: is seldom
---
This document has no date at all.

View file

@ -163,7 +163,7 @@ module Middleman
def find_resource_by_page_id(page_id)
@lock.synchronize do
ensure_resource_list_updated!
@_lookup_by_page_id[page_id.to_sym]
@_lookup_by_page_id[page_id.to_s.to_sym]
end
end
@ -249,7 +249,7 @@ module Middleman
# since some proxy resources are looked up by path in order to
# get their metadata and subsequently their page_id.
@resources.each do |resource|
@_lookup_by_page_id[resource.page_id.to_sym] = resource
@_lookup_by_page_id[resource.page_id.to_s.to_sym] = resource
end
invalidate_resources_not_ignored_cache!