Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Test for the requested layout in all circumstances #2070

Closed
wants to merge 4 commits into from

2 participants

@penibelst

After running again into the bug #1934 I’ve started to write a test. The generated file yo-dawg.html should contain:

<div class="layout-mock-default">

but in contains

<div class="layout-default">

I can’t succeed to write a full test. Hope this helps to solve the bug anyway.

@parkr parkr added this to the 2.0 milestone
@parkr parkr self-assigned this
@parkr parkr closed this
@parkr parkr reopened this
@parkr parkr referenced this pull request
Merged

Call me collections #2199

6 of 6 tasks complete
@parkr parkr modified the milestone: 2.1, 2.0
@penibelst penibelst closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 19, 2014
  1. @penibelst

    Add new files

    penibelst authored
  2. @penibelst

    Fix group_by filter test

    penibelst authored
  3. @penibelst

    Fix layout reading test

    penibelst authored
  4. @penibelst

    Fix sort test

    penibelst authored
This page is out of date. Refresh to see the latest.
View
7 test/source/_layouts/mock-default.html
@@ -0,0 +1,7 @@
+---
+layout: default
+---
+
+<div class="layout-{{ page.layout }}">
+{{ content }}
+</div>
View
7 test/source/yo-dawg.html
@@ -0,0 +1,7 @@
+---
+layout: mock-default
+---
+
+<h1>Yo Dawg</h1>
+
+<p>Yo dawg, I heard you liked <code>_layouts</code>? So I gave all your layouts a layout.</p>
View
2  test/test_filters.rb
@@ -121,7 +121,7 @@ def initialize(opts = {})
@filter.site.process
grouping = @filter.group_by(@filter.site.pages, "layout")
grouping.each do |g|
- assert ["default", "nil", ""].include?(g["name"]), "#{g['name']} isn't a valid grouping."
+ assert ["default", "mock-default", "nil", ""].include?(g["name"]), "#{g['name']} isn't a valid grouping."
case g["name"]
when "default"
assert g["items"].is_a?(Array), "The list of grouped items for 'default' is not an Array."
View
2  test/test_layout_reader.rb
@@ -11,7 +11,7 @@ class TestLayoutReader < Test::Unit::TestCase
should "read layouts" do
layouts = LayoutReader.new(@site).read
- assert_equal ["default", "simple", "post/simple"].sort, layouts.keys.sort
+ assert_equal ["default", "mock-default", "simple", "post/simple"].sort, layouts.keys.sort
end
context "when no _layouts directory exists in CWD" do
View
2  test/test_site.rb
@@ -158,7 +158,7 @@ def generate(site)
stub.proxy(Dir).entries { |entries| entries.reverse }
@site.process
# files in symlinked directories may appear twice
- sorted_pages = %w(.htaccess about.html bar.html coffeescript.coffee contacts.html deal.with.dots.html exploit.md foo.md index.html index.html main.scss main.scss properties.html sitemap.xml symlinked-file)
+ sorted_pages = %w(.htaccess about.html bar.html coffeescript.coffee contacts.html deal.with.dots.html exploit.md foo.md index.html index.html main.scss main.scss properties.html sitemap.xml symlinked-file yo-dawg.html)
assert_equal sorted_pages, @site.pages.map(&:name)
end
Something went wrong with that request. Please try again.