Add a spec for testing Middleman::Util#binary?
This commit is contained in:
parent
559265140d
commit
700b844e67
7
Rakefile
7
Rakefile
|
@ -87,6 +87,13 @@ task :test do
|
||||||
end
|
end
|
||||||
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"
|
# desc "Rune cane for all middleman gems"
|
||||||
# task :cane do
|
# task :cane do
|
||||||
# GEM_PATHS.each do |g|
|
# GEM_PATHS.each do |g|
|
||||||
|
|
|
@ -10,6 +10,9 @@ require "thor"
|
||||||
# Core Pathname library used for traversal
|
# Core Pathname library used for traversal
|
||||||
require "pathname"
|
require "pathname"
|
||||||
|
|
||||||
|
require "tilt"
|
||||||
|
require "rack/mime"
|
||||||
|
|
||||||
module Middleman
|
module Middleman
|
||||||
|
|
||||||
module Util
|
module Util
|
||||||
|
|
15
middleman-core/spec/middleman-core/binary_spec.rb
Normal file
15
middleman-core/spec/middleman-core/binary_spec.rb
Normal 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
|
BIN
middleman-core/spec/middleman-core/binary_spec/middleman
Normal file
BIN
middleman-core/spec/middleman-core/binary_spec/middleman
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
middleman-core/spec/middleman-core/binary_spec/middleman.png
Normal file
BIN
middleman-core/spec/middleman-core/binary_spec/middleman.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
1
middleman-core/spec/middleman-core/binary_spec/plain.txt
Normal file
1
middleman-core/spec/middleman-core/binary_spec/plain.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Some plain text
|
BIN
middleman-core/spec/middleman-core/binary_spec/stars.svgz
Normal file
BIN
middleman-core/spec/middleman-core/binary_spec/stars.svgz
Normal file
Binary file not shown.
1
middleman-core/spec/middleman-core/binary_spec/unicode
Normal file
1
middleman-core/spec/middleman-core/binary_spec/unicode
Normal file
|
@ -0,0 +1 @@
|
||||||
|
明日がある。
|
|
@ -0,0 +1 @@
|
||||||
|
明日がある。
|
Loading…
Reference in a new issue