File: directory_watcher_spec.rb

package info (click to toggle)
ruby-directory-watcher 1.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 224 kB
  • ctags: 224
  • sloc: ruby: 1,411; makefile: 5
file content (37 lines) | stat: -rw-r--r-- 2,006 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'spec_helper'

describe DirectoryWatcher do
  it "has a version" do
    DirectoryWatcher.version.should =~ /\d\.\d\.\d/
  end
end

describe "Scanners" do
  [ nil, :em, :coolio ].each do |scanner|
#  [ :rev ].each do |scanner|
    context "#{scanner} Scanner" do

      let( :default_options       ) { { :glob => "**/*", :interval => 0.05}                      }
      let( :options               ) { default_options.merge( :scanner => scanner )               }
      let( :options_with_pre_load ) { options.merge( :pre_load => true )                         }
      let( :options_with_stable   ) { options.merge( :stable => 2 )                              }
      let( :options_with_glob     ) { options.merge( :glob => '**/*.42' )                        }
      let( :options_with_persist  ) { options.merge( :persist => scratch_path( 'persist.yml' ) ) }

      let( :directory_watcher               ) { DirectoryWatcher.new( @scratch_dir, options ) }
      let( :directory_watcher_with_pre_load ) { DirectoryWatcher.new( @scratch_dir, options_with_pre_load ) }
      let( :directory_watcher_with_stable   ) { DirectoryWatcher.new( @scratch_dir, options_with_stable   ) }
      let( :directory_watcher_with_glob     ) { DirectoryWatcher.new( @scratch_dir, options_with_glob     ) }
      let( :directory_watcher_with_persist  ) { DirectoryWatcher.new( @scratch_dir, options_with_persist  ) }

      let( :scenario               ) { DirectoryWatcherSpecs::Scenario.new( directory_watcher) }
      let( :scenario_with_pre_load ) { DirectoryWatcherSpecs::Scenario.new( directory_watcher_with_pre_load ) }
      let( :scenario_with_stable   ) { DirectoryWatcherSpecs::Scenario.new( directory_watcher_with_stable   ) }
      let( :scenario_with_glob     ) { DirectoryWatcherSpecs::Scenario.new( directory_watcher_with_glob     ) }
      let( :scenario_with_persist  ) { DirectoryWatcherSpecs::Scenario.new( directory_watcher_with_persist  ) }

      it_should_behave_like 'Scanner'
    end
  end
end