spec/cpp_project_spec.rb in rake-builder-0.0.16 vs spec/cpp_project_spec.rb in rake-builder-0.0.17

- old
+ new

@@ -1,7 +1,32 @@ load File.dirname(__FILE__) + '/spec_helper.rb' +describe '#source_files' do + + include RakeBuilderHelper + + before( :each ) do + Rake::Path.stub!(:find_files).with(anything, 'h').and_return(['a.h']) + Rake::Path.stub!(:find_files).with(anything, 'cpp').and_return(['a.cpp']) + + Rake::Task.clear + end + + it 'should find files with the .cpp extension' do + Rake::Path.should_receive(:find_files).with(anything, 'cpp').and_return(['a.cpp']) + + cpp_task(:executable) + end + + it 'should allow configuration of source extension' do + Rake::Path.should_receive(:find_files).with(anything, 'cc').and_return(['a.cc']) + + cpp_task(:executable) { |p| p.source_file_extension = 'cc' } + end + +end + describe 'when building an executable' do include RakeBuilderHelper before( :all ) do @@ -46,10 +71,10 @@ Rake::Task[ 'build' ].invoke exist?( @project.target ).should be_true end it 'has a \'run\' task' do - Rake::Task[ 'run' ].should_not be_nil + task_names.include?('run'). should be_true end it 'builds the program with \'run\'' do Rake::Task[ 'run' ].invoke exist?( @project.target ).should be_true