Skip to content

Commit

Permalink
Add theme_dir() helper func
Browse files Browse the repository at this point in the history
  • Loading branch information
parkr committed Jan 17, 2017
1 parent 9a5307c commit ad8fb9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions test/helper.rb
Expand Up @@ -74,6 +74,10 @@ def source_dir(*subdirs)
test_dir("source", *subdirs)
end

def theme_dir(*subdirs)
test_dir("fixtures", "test-theme", *subdirs)
end

def test_dir(*subdirs)
root_dir("test", *subdirs)
end
Expand Down
9 changes: 4 additions & 5 deletions test/test_theme.rb
Expand Up @@ -3,7 +3,6 @@
class TestTheme < JekyllUnitTest
def setup
@theme = Theme.new("test-theme")
@expected_root = File.expand_path "./fixtures/test-theme", File.dirname(__FILE__)
end

context "initializing" do
Expand All @@ -13,7 +12,7 @@ def setup
end

should "know the theme root" do
assert_equal @expected_root, @theme.root
assert_equal theme_dir, @theme.root
end

should "know the theme version" do
Expand All @@ -36,13 +35,13 @@ def setup
context "path generation" do
[:assets, :_layouts, :_includes, :_sass].each do |folder|
should "know the #{folder} path" do
expected = File.expand_path(folder.to_s, @expected_root)
expected = theme_dir(folder.to_s)
assert_equal expected, @theme.public_send("#{folder.to_s.tr("_", "")}_path")
end
end

should "generate folder paths" do
expected = File.expand_path("./_sass", @expected_root)
expected = theme_dir("_sass")
assert_equal expected, @theme.send(:path_for, :_sass)
end

Expand All @@ -58,7 +57,7 @@ def setup
# no support for symlinks on Windows
skip_if_windows "Jekyll does not currently support symlinks on Windows."

expected = File.expand_path("./_layouts", @expected_root)
expected = theme_dir("_layouts")
assert_equal expected, @theme.send(:path_for, :_symlink)
end
end
Expand Down

0 comments on commit ad8fb9b

Please sign in to comment.