spec/rake/funnel/tasks/copy_spec.rb in rake-funnel-0.0.2.pre vs spec/rake/funnel/tasks/copy_spec.rb in rake-funnel-0.0.3.pre

- old
+ new

@@ -95,7 +95,29 @@ .each do |src| expect(RakeFileUtils).to have_received(:cp).with(src, File.join(subject.target, no_prefix(src))) end end end + + describe 'source is evaluated lazily' do + let(:source) { FileList.new('*.example') } + + before { + allow(Finder).to receive(:new).and_return(double(Finder).as_null_object) + } + + before { + Dir.mktmpdir do |tmp| + Dir.chdir(tmp) do + FileUtils.touch('new file.example') + + Task[subject.name].invoke + end + end + } + + it 'should detect new files' do + expect(Finder).to have_received(:new).with(['new file.example'], any_args) + end + end end end