Sha256: 2d0ed87369719ae7065ab86f92ee34244ef1ed38b65baece696f49f329fa638b

Contents?: true

Size: 759 Bytes

Versions: 3

Compression:

Stored size: 759 Bytes

Contents

require 'lib/file_actioner.rb'

describe FileActioner do

  it "Should get filtered files and send them to action" do
    files = {
      :all => ['/path/to.file'], 
      :filtered => ['/path/to.file'] 
    }
    
    ff = mock('file finder')
    ff.should_receive(:find).and_return(files)

    tm = mock('TaskManager')
    tm.should_receive(:run).with(files)

    fa = FileActioner.new(ff, tm)
    fa.run()

  end
  
  it "should not run the actions if no filtered files" do
    files = {
      :all => ['/path/to.file'], 
      :filtered => [] 
    }

    ff = mock('file finder')
    ff.should_receive(:find).and_return(files)

    tm = mock('TaskManager')
    tm.should_not_receive(:run)

    fa = FileActioner.new(ff, tm)
    fa.run()
    
  end

end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
karl-loris-0.0.6 spec/file_actioner_spec.rb
karl-loris-0.0.7 spec/file_actioner_spec.rb
karl-loris-0.0.9 spec/file_actioner_spec.rb