Sha256: 0f28153be01ffd68fb6ad960d6568c210ec13c88f99b124309c4e092023c5f75

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

describe Bind::Listener do
  
  def listener *paths, &action
    Bind::Listener.new :event => :change, :paths => paths, :interval => 1, :actions => [action], :timeout => 2
  end
  
  it "should expand directories" do
    files = %w(
      ./spec/fixtures/assets/bar.css
      ./spec/fixtures/assets/foo.css
      ./spec/fixtures/assets/jquery.js
      ./spec/fixtures/assets/js/app.js
      ./spec/fixtures/assets/js/test.js
    )
    l = listener {}
    l.expand_dirs(fixture_path('assets')).should == files
  end
  
  it "should expand paths to a single file" do
    l = listener {}
    l.expand_dirs(fixture_path('style.css')).should == ['./spec/fixtures/style.css']
  end
  
  it "should expand directories using globbing" do
    files = %w(
      ./spec/fixtures/assets/jquery.js
      ./spec/fixtures/assets/js/app.js
      ./spec/fixtures/assets/js/test.js
    )
    l = listener {}
    l.expand_dirs(fixture_path('assets/**/*.js')).should == files
  end

  it "should record total runtime" do
    l = listener(fixture_path('style.css')) {}
    l.run!
    l.run_time.to_i.should == 2
  end
    
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
visionmedia-bind-0.2.4 spec/listener_spec.rb
visionmedia-bind-0.2.5 spec/listener_spec.rb
visionmedia-bind-0.2.6 spec/listener_spec.rb
bind-0.2.7 spec/listener_spec.rb
bind-0.2.6 spec/listener_spec.rb