Rakefile in cos-0.1.0 vs Rakefile in cos-0.1.1

- old
+ new

@@ -1,10 +1,27 @@ -require "bundler/gem_tasks" -require "rake/testtask" +#!/usr/bin/env rake -Rake::TestTask.new(:test) do |t| - t.libs << "test" - t.libs << "lib" - t.test_files = FileList['test/**/*_test.rb'] +require 'bundler' +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' + +# Rspec 单元测试 +RSpec::Core::RakeTask.new(:spec) do + Bundler.setup(:default, :test) +end + +# 运行示例 +task :example do + FileList['example/**/*.rb'].each do |f| + puts "==== Run example: #{f} ====" + ruby f + end +end + +require 'rake/testtask' + +# 集成测试 +Rake::TestTask.new do |t| + t.pattern = 'test/**/*_test.rb' end task :default => :spec