test/test.rb in octopress-ink-1.0.0.alpha.44 vs test/test.rb in octopress-ink-1.0.0.alpha.45
- old
+ new
@@ -47,15 +47,15 @@
`rm _octopress.yml`
end
def diff_file(file, target_dir='expected', source_dir='site')
diff = `diff #{target_dir}/#{file} #{source_dir}/#{file}`
- if diff =~ /(<.+?\n)?(---\n)?(>.+)/
+ if diff.size > 0
@failures << <<-DIFF
Failure in #{file}
---------
-#{($1||'').red + $3.green}
+#{diff.gsub(/\A.+?\n/,'').gsub(/^(<.+?)$/){|m| m.red}.gsub(/>.+/){|m| m.green}}
---------
DIFF
else
false
end
@@ -87,34 +87,29 @@
def test_configs(dir)
configs = %w{plugin_config theme_config}
configs.each { |file| test("test_config/#{file}.html", dir) }
end
-def test_stylesheets(dir, concat=true)
- if concat
+def test_stylesheets(dir, combine=true)
+ if combine
stylesheets = %w{all-* print-*}
stylesheets.each { |file| test("stylesheets/#{file}.css", dir) }
else
- local_stylesheets = %w{site test}
- local_stylesheets.each { |file| test("stylesheets/#{file}.css", dir) }
-
plugin_stylesheets = %w{plugin-media-test plugin-test}
plugin_stylesheets.each { |file| test("stylesheets/awesome-sauce/#{file}.css", dir) }
theme_stylesheets = %w{theme-media-test theme-test theme-test2}
theme_stylesheets.each { |file| test("stylesheets/theme/#{file}.css", dir) }
end
end
-def test_javascripts(dir, concat=true)
- if concat
+def test_javascripts(dir, combine=true)
+ if combine
javascripts = %w{all-*}
javascripts.each { |file| test("javascripts/#{file}.js", dir) }
else
- javascripts = %w{bar foo}
- javascripts.each { |file| test("javascripts/theme/#{file}.js", dir) }
- test("javascripts/site.js", dir)
+ %w{bar foo}.each { |file| test("javascripts/theme/#{file}.js", dir) }
end
end
def test_root_assets(dir)
root_assets = %w{favicon.ico favicon.png robots.txt}
@@ -159,29 +154,22 @@
test_post('expected')
test_tags('expected')
test_pages('expected')
test_layouts('expected')
-test_stylesheets('concat_css')
-test_javascripts('concat_js')
+test_stylesheets('combine_css')
+test_javascripts('combine_js')
test_configs('expected')
test_root_assets('expected')
+test_disabled('site')
-Octopress::Ink.copy_plugin_assets('theme', {'path' => '_copy', 'force'=> true})
+system "octopress ink copy theme --path _copy --force"
test_copy_assets('copy_test')
-Octopress::Ink.copy_plugin_assets('theme', {'path' => '_copy', 'force'=> true, 'layouts' => true, 'pages' => true})
+system "octopress ink copy theme --layouts --pages --path _copy --force"
test_copy_assets('copy_layouts_pages')
-build octopress_config: '_concat_false.yml'
-test_stylesheets('concat_css_false', false)
-test_javascripts('concat_js_false', false)
-test_disabled('site')
+build octopress_config: '_combine_false.yml'
+test_stylesheets('combine_css_false', false)
+test_javascripts('combine_js_false', false)
-build config: '_sass_compact.yml'
-test_stylesheets('sass_compact')
-
-build config: '_sass_expanded.yml'
-test_stylesheets('sass_expanded')
-
print_failures
-