spec/generated_files_spec.rb in rake-builder-0.0.14 vs spec/generated_files_spec.rb in rake-builder-0.0.15

- old
+ new

@@ -1,7 +1,9 @@ -require File.dirname(__FILE__) + '/spec_helper.rb' +load File.dirname(__FILE__) + '/spec_helper.rb' +require 'json' + describe 'when handling generated files' do include RakeBuilderHelper before( :each ) do @@ -11,11 +13,11 @@ [ 'main.o', 'rake-builder-testfile.txt', @project.makedepend_file, @project.target ], - SPEC_PATH ) + RakeBuilderHelper::SPEC_PATH ) end after( :each ) do Rake::Task[ 'clean' ].execute end @@ -23,14 +25,14 @@ it 'lists generated files, with a method' do @project.generated_files.should =~ @expected_generated end it 'lists generated files, via the task' do - output = capturing_output do + stdout, _ = capturing_output do Rake::Task[ 'generated_files' ].invoke end - eval( output ).should =~ @expected_generated + JSON.load(stdout). should =~ @expected_generated end it 'removes generated files with \'clean\'' do Rake::Task[ 'run' ].invoke @expected_generated.each do |f| @@ -48,10 +50,10 @@ include RakeBuilderHelper before( :each ) do @file = 'foobar.txt' - @file_with_path = Rake::Path.expand_with_root( @file, SPEC_PATH ) + @file_with_path = Rake::Path.expand_with_root( @file, RakeBuilderHelper::SPEC_PATH ) end it 'includes added files' do @project = cpp_task( :executable ) do |app| app.generated_files << @file_with_path