Merge pull request #772 from bhollis/binary
Add a spec for testing Middleman::Util#binary?
This commit is contained in:
commit
f3750c7c01
7
Rakefile
7
Rakefile
|
@ -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|
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
require 'rubygems' unless defined?(Gem)
|
||||
require 'rake'
|
||||
require 'cucumber/rake/task'
|
||||
require 'yard'
|
||||
|
||||
require 'bundler'
|
||||
|
@ -16,7 +15,9 @@ class Bundler::GemHelper
|
|||
end
|
||||
end
|
||||
|
||||
Cucumber::Rake::Task.new(:test, 'Run features that should pass') do |t|
|
||||
require 'cucumber/rake/task'
|
||||
|
||||
Cucumber::Rake::Task.new do |t|
|
||||
exempt_tags = ["--tags ~@wip"]
|
||||
exempt_tags << "--tags ~@nojava" if RUBY_PLATFORM == "java"
|
||||
exempt_tags << "--tags ~@encoding" unless Object.const_defined?(:Encoding)
|
||||
|
@ -25,6 +26,24 @@ Cucumber::Rake::Task.new(:test, 'Run features that should pass') do |t|
|
|||
t.cucumber_opts = "--color #{exempt_tags.join(" ")} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
|
||||
end
|
||||
|
||||
Cucumber::Rake::Task.new(:cucumber_wip) do |t|
|
||||
exempt_tags = ["--tags @wip"]
|
||||
exempt_tags << "--tags ~@nojava" if RUBY_PLATFORM == "java"
|
||||
exempt_tags << "--tags ~@encoding" unless Object.const_defined?(:Encoding)
|
||||
|
||||
t.cucumber_opts = "--color #{exempt_tags.join(" ")} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
|
||||
end
|
||||
|
||||
require 'rspec/core/rake_task'
|
||||
desc "Run RSpec"
|
||||
RSpec::Core::RakeTask.new do |spec|
|
||||
spec.pattern = 'spec/**/*_spec.rb'
|
||||
spec.rspec_opts = ['--color', '--format nested']
|
||||
end
|
||||
|
||||
desc "Run tests, both RSpec and Cucumber"
|
||||
task :test => [:spec, :cucumber]
|
||||
|
||||
YARD::Rake::YardocTask.new
|
||||
|
||||
task :default => :test
|
||||
|
|
|
@ -10,6 +10,9 @@ require "thor"
|
|||
# Core Pathname library used for traversal
|
||||
require "pathname"
|
||||
|
||||
require "tilt"
|
||||
require "rack/mime"
|
||||
|
||||
module Middleman
|
||||
|
||||
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 @@
|
|||
明日がある。
|
0
middleman-core/spec/middleman-core/sitemap_spec.rb
Normal file
0
middleman-core/spec/middleman-core/sitemap_spec.rb
Normal file
0
middleman-core/spec/spec_helper.rb
Normal file
0
middleman-core/spec/spec_helper.rb
Normal file
0
middleman-more/spec/middleman-more/future_spec.rb
Normal file
0
middleman-more/spec/middleman-more/future_spec.rb
Normal file
0
middleman-more/spec/spec_helper.rb
Normal file
0
middleman-more/spec/spec_helper.rb
Normal file
0
middleman/spec/middleman/future_spec.rb
Normal file
0
middleman/spec/middleman/future_spec.rb
Normal file
0
middleman/spec/spec_helper.rb
Normal file
0
middleman/spec/spec_helper.rb
Normal file
Loading…
Reference in a new issue