Refactor trap_exit spec helper usages

This commit is contained in:
Thibault Jouan
2013-08-01 22:51:41 +00:00
parent c4fc9828db
commit c3737e738e
3 changed files with 9 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ require 'spec_helper'
module Producer::Core
describe CLI do
include ExitHelpers
include FixturesHelpers
let(:recipe_file) { fixture_path_for('recipes/empty.rb') }
@@ -45,10 +46,7 @@ module Producer::Core
end
it 'prints the usage' do
begin
cli.check_arguments!
rescue SystemExit
end
trap_exit { cli.check_arguments! }
expect(stdout.string).to match /\AUsage: .+/
end
end
@@ -89,11 +87,6 @@ module Producer::Core
}
end
def trap_exit
yield
rescue SystemExit
end
it 'prints the specific error' do
trap_exit { cli.evaluate_recipe_file }
expect(stdout.string).to match(/