spec/spec_helper.rb in cany-0.0.2 vs spec/spec_helper.rb in cany-0.1.0

- old
+ new

@@ -1,15 +1,37 @@ -require 'coveralls' -Coveralls.wear! do - add_filter 'spec' +if ENV['CI'] + require 'coveralls' + Coveralls.wear! do + add_filter 'spec' + end end +if ENV["COVERAGE"] + require 'simplecov' + + SimpleCov.start do + add_filter 'spec' + + add_group 'DPKG', 'lib/cany/dpkg' + add_group('Recipes') { |file| file.filename.include? 'recipe' } + end +end + require 'cany' require 'deb_control' require 'tmpdir' require 'timecop' +class TestRecipe < Cany::Recipe + register_as :test_recipe + hook :test_hook + option :test_conf +end + +Cany.logger.level = Logger::FATAL + + Dir[File.expand_path('spec/support/**/*.rb')].each {|f| require f} RSpec.configure do |config| # ## Mock Framework # @@ -30,8 +52,13 @@ c.syntax = :expect end config.before(:each) do @executed_programs = [] - allow_any_instance_of(Cany::Recipe).to receive(:exec) { |*args| @executed_programs << args } + allow_any_instance_of(Cany::Recipe).to receive(:exec) { |*args| @executed_programs << args.flatten } + end + + config.after(:each) do + Cany::Recipes::Bundler::Gem.clear + load 'cany/recipes/bundler/gem_db.rb' end end