Add a spec for testing Middleman::Util#binary?

i18n_v4
Ben Hollis 2013-02-09 15:45:45 -08:00
parent 559265140d
commit 700b844e67
9 changed files with 29 additions and 1 deletions

View File

@ -87,6 +87,13 @@ task :test do
end
end
desc "Run specs for all middleman gems"
task :spec do
GEM_PATHS.each do |g|
sh "cd #{File.join(ROOT, g)} && #{Gem.ruby} -S rake spec"
end
end
# desc "Rune cane for all middleman gems"
# task :cane do
# GEM_PATHS.each do |g|
@ -95,4 +102,4 @@ end
# end
desc "Run tests for all middleman gems"
task :default => :test
task :default => :test

View File

@ -10,6 +10,9 @@ require "thor"
# Core Pathname library used for traversal
require "pathname"
require "tilt"
require "rack/mime"
module Middleman
module Util

View File

@ -0,0 +1,15 @@
require 'middleman-core/util'
describe "Middleman::Util#binary?" do
%w(plain.txt unicode.txt unicode stars.svgz).each do |file|
it "recognizes #{file} as not binary" do
Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}")).should be_false
end
end
%w(middleman.png middleman).each do |file|
it "recognizes #{file} as binary" do
Middleman::Util.binary?(File.join(File.dirname(__FILE__), "binary_spec/#{file}")).should be_true
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -0,0 +1 @@
Some plain text

View File

@ -0,0 +1 @@
明日がある。

View File

@ -0,0 +1 @@
明日がある。