sass 3.3.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/VERSION_DATE +1 -1
  4. data/lib/sass/importers/filesystem.rb +3 -3
  5. data/lib/sass/plugin/compiler.rb +95 -52
  6. data/lib/sass/script/functions.rb +1 -1
  7. data/lib/sass/source/map.rb +3 -3
  8. data/lib/sass/util.rb +16 -1
  9. data/vendor/listen/CHANGELOG.md +175 -35
  10. data/vendor/listen/Gemfile +5 -15
  11. data/vendor/listen/README.md +111 -77
  12. data/vendor/listen/Rakefile +0 -42
  13. data/vendor/listen/lib/listen.rb +33 -19
  14. data/vendor/listen/lib/listen/adapter.rb +193 -82
  15. data/vendor/listen/lib/listen/adapters/bsd.rb +27 -64
  16. data/vendor/listen/lib/listen/adapters/darwin.rb +21 -58
  17. data/vendor/listen/lib/listen/adapters/linux.rb +23 -55
  18. data/vendor/listen/lib/listen/adapters/polling.rb +25 -34
  19. data/vendor/listen/lib/listen/adapters/windows.rb +50 -46
  20. data/vendor/listen/lib/listen/directory_record.rb +96 -61
  21. data/vendor/listen/lib/listen/listener.rb +135 -37
  22. data/vendor/listen/lib/listen/turnstile.rb +9 -5
  23. data/vendor/listen/lib/listen/version.rb +1 -1
  24. data/vendor/listen/listen.gemspec +6 -0
  25. data/vendor/listen/spec/listen/adapter_spec.rb +37 -82
  26. data/vendor/listen/spec/listen/adapters/polling_spec.rb +8 -8
  27. data/vendor/listen/spec/listen/directory_record_spec.rb +81 -56
  28. data/vendor/listen/spec/listen/listener_spec.rb +128 -39
  29. data/vendor/listen/spec/listen_spec.rb +15 -21
  30. data/vendor/listen/spec/spec_helper.rb +4 -0
  31. data/vendor/listen/spec/support/adapter_helper.rb +52 -15
  32. data/vendor/listen/spec/support/directory_record_helper.rb +7 -5
  33. data/vendor/listen/spec/support/listeners_helper.rb +30 -7
  34. metadata +3 -23
  35. data/ext/mkrf_conf.rb +0 -27
  36. data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
  37. data/vendor/listen/lib/listen/multi_listener.rb +0 -143
  38. data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
  39. data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
@@ -1,28 +1,32 @@
1
1
  module Listen
2
+
2
3
  # Allows two threads to wait on eachother.
3
4
  #
4
5
  # @note Only two threads can be used with this Turnstile
5
6
  # because of the current implementation.
6
7
  class Turnstile
8
+ attr_accessor :queue
7
9
 
8
10
  # Initialize the turnstile.
9
11
  #
10
12
  def initialize
11
- # Until ruby offers semahpores, only queues can be used
13
+ # Until Ruby offers semahpores, only queues can be used
12
14
  # to implement a turnstile.
13
- @q = Queue.new
15
+ @queue = Queue.new
14
16
  end
15
17
 
16
18
  # Blocks the current thread until a signal is received.
17
19
  #
18
20
  def wait
19
- @q.pop if @q.num_waiting == 0
21
+ queue.pop if queue.num_waiting == 0
20
22
  end
21
23
 
22
- # Unblocks the waiting thread if there is one.
24
+ # Unblocks the waiting thread if any.
23
25
  #
24
26
  def signal
25
- @q.push :dummy if @q.num_waiting == 1
27
+ queue.push(:dummy) if queue.num_waiting == 1
26
28
  end
29
+
27
30
  end
31
+
28
32
  end
@@ -1,3 +1,3 @@
1
1
  module Listen
2
- VERSION = '0.7.3'
2
+ VERSION = '1.3.1'
3
3
  end
@@ -9,13 +9,19 @@ Gem::Specification.new do |s|
9
9
  s.authors = ['Thibaud Guillaume-Gentil', 'Maher Sallam']
10
10
  s.email = ['thibaud@thibaud.me', 'maher@sallam.me']
11
11
  s.homepage = 'https://github.com/guard/listen'
12
+ s.license = 'MIT'
12
13
  s.summary = 'Listen to file modifications'
13
14
  s.description = 'The Listen gem listens to file modifications and notifies you about the changes. Works everywhere!'
14
15
 
15
16
  s.required_rubygems_version = '>= 1.3.6'
16
17
  s.rubyforge_project = 'listen'
17
18
 
19
+ s.add_dependency 'rb-fsevent', '>= 0.9.3'
20
+ s.add_dependency 'rb-inotify', '>= 0.9'
21
+ s.add_dependency 'rb-kqueue', '>= 0.2'
22
+
18
23
  s.add_development_dependency 'bundler'
24
+ s.add_development_dependency 'rspec'
19
25
 
20
26
  s.files = Dir.glob('{lib}/**/*') + %w[CHANGELOG.md LICENSE README.md]
21
27
  s.require_path = 'lib'
@@ -19,10 +19,23 @@ describe Listen::Adapter do
19
19
 
20
20
  describe ".select_and_initialize" do
21
21
  before do
22
- Listen::Adapters::Darwin.stub(:usable_and_works?) { false }
23
- Listen::Adapters::Linux.stub(:usable_and_works?) { false }
24
- Listen::Adapters::BSD.stub(:usable_and_works?) { false }
25
- Listen::Adapters::Windows.stub(:usable_and_works?) { false }
22
+ Listen::Adapter::OPTIMIZED_ADAPTERS.each do |adapter|
23
+ Listen::Adapters.const_get(adapter).stub(:usable_and_works?) { false }
24
+ end
25
+ end
26
+
27
+ context "with force_adapter option" do
28
+ it "returns an instance of the given adapter class" do
29
+ expected_adapter = Object.new
30
+ adapter_class = double('adapter_class')
31
+ options = {:force_adapter => adapter_class}
32
+
33
+ adapter_class.should_receive(:load_dependent_adapter)
34
+ adapter_class.should_receive(:new).with('dir', options) { expected_adapter }
35
+
36
+ adapter = described_class.select_and_initialize('dir', options)
37
+ adapter.should be(expected_adapter)
38
+ end
26
39
  end
27
40
 
28
41
  context "with no specific adapter usable" do
@@ -37,20 +50,6 @@ describe Listen::Adapter do
37
50
  described_class.select_and_initialize('dir')
38
51
  end
39
52
 
40
- context 'when the dependencies of an adapter are not satisfied' do
41
- before do
42
- Listen::Adapters::Darwin.stub(:usable_and_works?).and_raise(Listen::DependencyManager::Error)
43
- Listen::Adapters::Linux.stub(:usable_and_works?).and_raise(Listen::DependencyManager::Error)
44
- Listen::Adapters::BSD.stub(:usable_and_works?).and_raise(Listen::DependencyManager::Error)
45
- Listen::Adapters::Windows.stub(:usable_and_works?).and_raise(Listen::DependencyManager::Error)
46
- end
47
-
48
- it 'invites the user to satisfy the dependencies of the adapter in the warning' do
49
- Kernel.should_receive(:warn).with(/#{Listen::Adapter::MISSING_DEPENDENCY_MESSAGE}/)
50
- described_class.select_and_initialize('dir')
51
- end
52
- end
53
-
54
53
  context "with custom polling_fallback_message option" do
55
54
  it "warns with the custom polling fallback message" do
56
55
  Kernel.should_receive(:warn).with(/custom/)
@@ -66,83 +65,39 @@ describe Listen::Adapter do
66
65
  end
67
66
  end
68
67
 
69
- context "on Mac OX >= 10.6" do
70
- before { Listen::Adapters::Darwin.stub(:usable_and_works?) { true } }
71
-
72
- it "uses Listen::Adapters::Darwin" do
73
- Listen::Adapters::Darwin.should_receive(:new).with('dir', {})
74
- described_class.select_and_initialize('dir')
75
- end
76
-
77
- context 'when the use of the polling adapter is forced' do
78
- it 'uses Listen::Adapters::Polling' do
79
- Listen::Adapters::Polling.should_receive(:new).with('dir', {})
80
- described_class.select_and_initialize('dir', :force_polling => true)
81
- end
82
- end
83
- end
68
+ Listen::Adapter::OPTIMIZED_ADAPTERS.each do |adapter|
69
+ adapter_class = Listen::Adapters.const_get(adapter)
84
70
 
85
- context "on Linux" do
86
- before { Listen::Adapters::Linux.stub(:usable_and_works?) { true } }
71
+ context "on #{adapter}" do
72
+ before { adapter_class.stub(:usable_and_works?) { true } }
87
73
 
88
- it "uses Listen::Adapters::Linux" do
89
- Listen::Adapters::Linux.should_receive(:new).with('dir', {})
90
- described_class.select_and_initialize('dir')
91
- end
92
-
93
- context 'when the use of the polling adapter is forced' do
94
- it 'uses Listen::Adapters::Polling' do
95
- Listen::Adapters::Polling.should_receive(:new).with('dir', {})
96
- described_class.select_and_initialize('dir', :force_polling => true)
74
+ it "uses Listen::Adapters::#{adapter}" do
75
+ adapter_class.should_receive(:new).with('dir', {})
76
+ described_class.select_and_initialize('dir')
97
77
  end
98
- end
99
- end
100
78
 
101
- context "on BSD" do
102
- before { Listen::Adapters::BSD.stub(:usable_and_works?) { true } }
103
-
104
- it "uses Listen::Adapters::BSD" do
105
- Listen::Adapters::BSD.should_receive(:new).with('dir', {})
106
- described_class.select_and_initialize('dir')
107
- end
108
-
109
- context 'when the use of the polling adapter is forced' do
110
- it 'uses Listen::Adapters::Polling' do
111
- Listen::Adapters::Polling.should_receive(:new).with('dir', {})
112
- described_class.select_and_initialize('dir', :force_polling => true)
79
+ context 'when the use of the polling adapter is forced' do
80
+ it 'uses Listen::Adapters::Polling' do
81
+ Listen::Adapters::Polling.should_receive(:new).with('dir', {})
82
+ described_class.select_and_initialize('dir', :force_polling => true)
83
+ end
113
84
  end
114
85
  end
115
86
  end
87
+ end
116
88
 
117
- context "on Windows" do
118
- before { Listen::Adapters::Windows.stub(:usable_and_works?) { true } }
89
+ describe '.load_dependend_adapter' do
90
+ it 'returns true (success) even if the adapter_gem has already been required' do
91
+ described_class.stub(:adapter_gem => 'already_loaded_gem')
92
+ described_class.stub(:require => false)
119
93
 
120
- it "uses Listen::Adapters::Windows" do
121
- Listen::Adapters::Windows.should_receive(:new).with('dir', {})
122
- described_class.select_and_initialize('dir')
123
- end
124
-
125
- context 'when the use of the polling adapter is forced' do
126
- it 'uses Listen::Adapters::Polling' do
127
- Listen::Adapters::Polling.should_receive(:new).with('dir', {})
128
- described_class.select_and_initialize('dir', :force_polling => true)
129
- end
130
- end
94
+ described_class.load_dependent_adapter.should be_true
131
95
  end
132
96
  end
133
97
 
134
- [Listen::Adapters::Darwin, Listen::Adapters::Linux,
135
- Listen::Adapters::BSD, Listen::Adapters::Windows].each do
136
- |adapter_class|
98
+ Listen::Adapter::OPTIMIZED_ADAPTERS.each do |adapter|
99
+ adapter_class = Listen::Adapters.const_get(adapter)
137
100
  if adapter_class.usable?
138
- describe '.usable?' do
139
- it 'checks the dependencies' do
140
- adapter_class.should_receive(:load_depenencies)
141
- adapter_class.should_receive(:dependencies_loaded?)
142
- adapter_class.usable?
143
- end
144
- end
145
-
146
101
  describe '.usable_and_works?' do
147
102
  it 'checks if the adapter is usable' do
148
103
  adapter_class.stub(:works?)
@@ -12,8 +12,8 @@ describe Listen::Adapters::Polling do
12
12
  end
13
13
 
14
14
  describe '#poll' do
15
- let(:listener) { mock(Listen::Listener) }
16
- let(:callback) { lambda { |changed_dirs, options| @called = true; listener.on_change(changed_dirs, options) } }
15
+ let(:listener) { double(Listen::Listener) }
16
+ let(:callback) { lambda { |changed_directories, options| @called = true; listener.on_change(changed_directories, options) } }
17
17
 
18
18
  after { subject.stop }
19
19
 
@@ -22,20 +22,20 @@ describe Listen::Adapters::Polling do
22
22
 
23
23
  it 'calls listener.on_change' do
24
24
  listener.should_receive(:on_change).at_least(1).times.with(['dir'], :recursive => true)
25
- subject.start(false)
25
+ subject.start
26
26
  subject.wait_for_callback
27
27
  end
28
28
 
29
29
  it 'calls listener.on_change continuously' do
30
30
  subject.latency = 0.001
31
31
  listener.should_receive(:on_change).at_least(10).times.with(['dir'], :recursive => true)
32
- subject.start(false)
32
+ subject.start
33
33
  10.times { subject.wait_for_callback }
34
34
  end
35
35
 
36
36
  it "doesn't call listener.on_change if paused" do
37
37
  subject.paused = true
38
- subject.start(false)
38
+ subject.start
39
39
  subject.wait_for_callback
40
40
  @called.should be_nil
41
41
  end
@@ -46,20 +46,20 @@ describe Listen::Adapters::Polling do
46
46
 
47
47
  it 'calls listener.on_change' do
48
48
  listener.should_receive(:on_change).at_least(1).times.with(%w{dir1 dir2}, :recursive => true)
49
- subject.start(false)
49
+ subject.start
50
50
  subject.wait_for_callback
51
51
  end
52
52
 
53
53
  it 'calls listener.on_change continuously' do
54
54
  subject.latency = 0.001
55
55
  listener.should_receive(:on_change).at_least(10).times.with(%w{dir1 dir2}, :recursive => true)
56
- subject.start(false)
56
+ subject.start
57
57
  10.times { subject.wait_for_callback }
58
58
  end
59
59
 
60
60
  it "doesn't call listener.on_change if paused" do
61
61
  subject.paused = true
62
- subject.start(false)
62
+ subject.start
63
63
  subject.wait_for_callback
64
64
  @called.should be_nil
65
65
  end
@@ -9,7 +9,7 @@ describe Listen::DirectoryRecord do
9
9
  describe '.generate_default_ignoring_patterns' do
10
10
  it 'creates regexp patterns from the default ignored directories and extensions' do
11
11
  described_class.generate_default_ignoring_patterns.should include(
12
- %r{^(?:\.rbx|\.bundle|\.git|\.svn|log|tmp|vendor)/},
12
+ %r{^(?:\.rbx|\.bundle|\.git|\.svn|bundle|log|tmp|vendor)/},
13
13
  %r{(?:\.DS_Store)$}
14
14
  )
15
15
  end
@@ -24,6 +24,12 @@ describe Listen::DirectoryRecord do
24
24
  subject.directory.should eq base_directory
25
25
  end
26
26
 
27
+ it 'sets the base directory expanded' do
28
+ cd File.dirname(base_directory)
29
+ subject = described_class.new(File.basename(base_directory))
30
+ subject.directory.should eq base_directory
31
+ end
32
+
27
33
  it 'sets the default ignoring patterns' do
28
34
  subject.ignoring_patterns.should =~ described_class.generate_default_ignoring_patterns
29
35
  end
@@ -43,28 +49,31 @@ describe Listen::DirectoryRecord do
43
49
 
44
50
  describe '#ignore' do
45
51
  it 'adds the passed paths to the list of ignored paths in the record' do
46
- subject.ignore(%r{^\.old/}, %r{\.pid$})
52
+ subject.ignore(%r{^\.old/}, %r{\.pid$}, nil)
47
53
  subject.ignoring_patterns.should include(%r{^\.old/}, %r{\.pid$})
54
+ subject.ignoring_patterns.should_not include(nil)
48
55
  end
49
56
  end
50
57
 
51
58
  describe '#ignore!' do
52
59
  it 'replace the ignored paths in the record' do
53
- subject.ignore!(%r{^\.old/}, %r{\.pid$})
54
- subject.ignoring_patterns.should =~ [%r{^\.old/}, %r{\.pid$}]
60
+ subject.ignore!(%r{^\.old/}, %r{\.pid$}, nil)
61
+ subject.ignoring_patterns.should eq [%r{^\.old/}, %r{\.pid$}]
55
62
  end
56
63
  end
57
64
 
58
65
  describe '#filter' do
59
66
  it 'adds the passed regexps to the list of filters that determine the stored paths' do
60
- subject.filter(%r{\.(?:jpe?g|gif|png)}, %r{\.(?:mp3|ogg|a3c)})
67
+ subject.filter(%r{\.(?:jpe?g|gif|png)}, %r{\.(?:mp3|ogg|a3c)}, nil)
61
68
  subject.filtering_patterns.should include(%r{\.(?:jpe?g|gif|png)}, %r{\.(?:mp3|ogg|a3c)})
69
+ subject.filtering_patterns.should_not include(nil)
62
70
  end
63
71
  end
64
72
 
65
73
  describe '#filter!' do
66
74
  it 'replaces the passed regexps in the list of filters that determine the stored paths' do
67
75
  subject.filter!(%r{\.(?:jpe?g|gif|png)}, %r{\.(?:mp3|ogg|a3c)})
76
+ subject.filtering_patterns.should have(2).regexps
68
77
  subject.filtering_patterns.should =~ [%r{\.(?:mp3|ogg|a3c)}, %r{\.(?:jpe?g|gif|png)}]
69
78
  end
70
79
  end
@@ -214,6 +223,21 @@ describe Listen::DirectoryRecord do
214
223
  subject.relative_to_base(File.join(base_directory, path))
215
224
  end
216
225
 
226
+ context 'when there are utf-8 chars in base directory' do
227
+ before do
228
+ fixtures do |path|
229
+ mkdir '目录'
230
+ @dir = described_class.new(path + '/目录')
231
+ @dir.build
232
+ end
233
+ end
234
+
235
+ it 'works' do
236
+ path = File.join @dir.directory, 'tmp/file.rb'
237
+ @dir.relative_to_base path
238
+ end
239
+ end
240
+
217
241
  context 'when containing regexp characters in the base directory' do
218
242
  before do
219
243
  fixtures do |path|
@@ -394,7 +418,7 @@ describe Listen::DirectoryRecord do
394
418
  touch 'existing_file.txt'
395
419
 
396
420
  modified, added, removed = changes(path) do
397
- sleep 1.5 # make a difference in the mtime of the file
421
+ small_time_difference
398
422
  touch 'existing_file.txt'
399
423
  end
400
424
 
@@ -414,7 +438,7 @@ describe Listen::DirectoryRecord do
414
438
  touch 'existing_file.txt'
415
439
 
416
440
  modified, added, removed = changes(path) do
417
- sleep 0.3 # make sure the mtime is changed a bit
441
+ small_time_difference
418
442
  touch 'existing_file.txt'
419
443
  end
420
444
 
@@ -428,7 +452,7 @@ describe Listen::DirectoryRecord do
428
452
  # This issue was the result of checking a file for content changes when
429
453
  # the mtime and the checking time are the same. In this case there
430
454
  # is no checksum saved, so the file was reported as being changed.
431
- it ' does not report any changes' do
455
+ it 'does not report any changes' do
432
456
  fixtures do |path|
433
457
  touch 'a_file.rb'
434
458
 
@@ -441,34 +465,17 @@ describe Listen::DirectoryRecord do
441
465
  end
442
466
  end
443
467
 
444
- it "doesn't detects the modified file the second time if the content haven't changed" do
445
- fixtures do |path|
446
- touch 'existing_file.txt'
447
-
448
- changes(path) do
449
- touch 'existing_file.txt'
450
- end
451
-
452
- modified, added, removed = changes(path, :use_last_record => true) do
453
- touch 'existing_file.txt'
454
- end
455
-
456
- added.should be_empty
457
- modified.should be_empty
458
- removed.should be_empty
459
- end
460
- end
461
-
462
468
  it 'detects the modified file the second time if the content have changed' do
463
469
  fixtures do |path|
464
470
  touch 'existing_file.txt'
471
+
465
472
  # Set sha1 path checksum
466
473
  changes(path) do
467
474
  touch 'existing_file.txt'
468
475
  end
469
- small_time_difference
470
476
 
471
477
  changes(path) do
478
+ small_time_difference
472
479
  touch 'existing_file.txt'
473
480
  end
474
481
 
@@ -482,16 +489,36 @@ describe Listen::DirectoryRecord do
482
489
  end
483
490
  end
484
491
 
485
- it "doesn't detects the modified file the second time if just touched - #62" do
492
+ it "doesn't checksum the contents of local sockets (#85)", :unless => windows? do
493
+ require 'socket'
494
+ fixtures do |path|
495
+ Digest::SHA1.should_not_receive(:file)
496
+ socket_path = File.join(path, "unix_domain_socket")
497
+ server = UNIXServer.new(socket_path)
498
+ modified, added, removed = changes(path) do
499
+ t = Thread.new do
500
+ client = UNIXSocket.new(socket_path)
501
+ client.write("foo")
502
+ end
503
+ t.join
504
+ end
505
+ added.should be_empty
506
+ modified.should be_empty
507
+ removed.should be_empty
508
+ end
509
+ end
510
+
511
+ it "doesn't detects the modified file the second time if just touched - #62", :unless => described_class::HIGH_PRECISION_SUPPORTED do
486
512
  fixtures do |path|
487
513
  touch 'existing_file.txt'
514
+
488
515
  # Set sha1 path checksum
489
516
  changes(path) do
490
517
  touch 'existing_file.txt'
491
518
  end
492
- small_time_difference
493
519
 
494
520
  changes(path, :use_last_record => true) do
521
+ small_time_difference
495
522
  open('existing_file.txt', 'w') { |f| f.write('foo') }
496
523
  end
497
524
 
@@ -508,9 +535,9 @@ describe Listen::DirectoryRecord do
508
535
  it "adds the path in the paths checksums if just touched - #62" do
509
536
  fixtures do |path|
510
537
  touch 'existing_file.txt'
511
- small_time_difference
512
538
 
513
539
  changes(path) do
540
+ small_time_difference
514
541
  touch 'existing_file.txt'
515
542
  end
516
543
 
@@ -518,23 +545,21 @@ describe Listen::DirectoryRecord do
518
545
  end
519
546
  end
520
547
 
521
- it "deletes the path from the paths checksums" do
522
- fixtures do |path|
523
- touch 'unnecessary.txt'
548
+ it "deletes the path from the paths checksums" do
549
+ fixtures do |path|
550
+ touch 'unnecessary.txt'
524
551
 
525
- changes(path) do
526
- @record.sha1_checksums["#{path}/unnecessary.txt"] = 'foo'
552
+ changes(path) do
553
+ @record.sha1_checksums["#{path}/unnecessary.txt"] = 'foo'
527
554
 
528
- rm 'unnecessary.txt'
529
- end
555
+ rm 'unnecessary.txt'
556
+ end
530
557
 
531
- @record.sha1_checksums["#{path}/unnecessary.txt"].should be_nil
558
+ @record.sha1_checksums["#{path}/unnecessary.txt"].should be_nil
559
+ end
532
560
  end
533
561
  end
534
562
 
535
-
536
- end
537
-
538
563
  context 'given a hidden file' do
539
564
  it 'detects the modified file' do
540
565
  fixtures do |path|
@@ -556,9 +581,9 @@ describe Listen::DirectoryRecord do
556
581
  it 'does not detect the mode change' do
557
582
  fixtures do |path|
558
583
  touch 'run.rb'
559
- sleep 1.5 # make a difference in the mtime of the file
560
584
 
561
585
  modified, added, removed = changes(path) do
586
+ small_time_difference
562
587
  chmod 0777, 'run.rb'
563
588
  end
564
589
 
@@ -985,9 +1010,8 @@ describe Listen::DirectoryRecord do
985
1010
  touch 'a_directory/a_file.rb'
986
1011
  touch 'a_directory/b_file.rb'
987
1012
 
988
- small_time_difference
989
-
990
1013
  modified, added, removed = changes(path) do
1014
+ small_time_difference
991
1015
  touch 'b_file.rb'
992
1016
  touch 'a_directory/a_file.rb'
993
1017
  end
@@ -1022,16 +1046,18 @@ describe Listen::DirectoryRecord do
1022
1046
  it 'detects a moved directory' do
1023
1047
  fixtures do |path|
1024
1048
  mkdir 'a_directory'
1049
+ mkdir 'a_directory/nested'
1025
1050
  touch 'a_directory/a_file.rb'
1026
1051
  touch 'a_directory/b_file.rb'
1052
+ touch 'a_directory/nested/c_file.rb'
1027
1053
 
1028
1054
  modified, added, removed = changes(path) do
1029
1055
  mv 'a_directory', 'renamed'
1030
1056
  end
1031
1057
 
1032
- added.should =~ %w(renamed/a_file.rb renamed/b_file.rb)
1058
+ added.should =~ %w(renamed/a_file.rb renamed/b_file.rb renamed/nested/c_file.rb)
1033
1059
  modified.should be_empty
1034
- removed.should =~ %w(a_directory/a_file.rb a_directory/b_file.rb)
1060
+ removed.should =~ %w(a_directory/a_file.rb a_directory/b_file.rb a_directory/nested/c_file.rb)
1035
1061
  end
1036
1062
  end
1037
1063
 
@@ -1134,7 +1160,7 @@ describe Listen::DirectoryRecord do
1134
1160
  chmod 000, 'unreadable_file.txt'
1135
1161
 
1136
1162
  modified, added, removed = changes(path) do
1137
- sleep 1.1
1163
+ small_time_difference
1138
1164
  touch 'unreadable_file.txt'
1139
1165
  end
1140
1166
 
@@ -1171,22 +1197,21 @@ describe Listen::DirectoryRecord do
1171
1197
  # change event is tracked, but before the hash is calculated
1172
1198
  Digest::SHA1.should_receive(:file).twice.and_raise(Errno::ENOENT)
1173
1199
 
1174
- lambda {
1175
- fixtures do |path|
1176
- file = 'removed_file.txt'
1177
- touch file
1178
- changes(path) { touch file }
1179
- end
1180
- }.should_not raise_error(Errno::ENOENT)
1200
+ fixtures do |path|
1201
+ lambda {
1202
+ touch 'removed_file.txt'
1203
+ changes(path) { touch 'removed_file.txt' }
1204
+ }.should_not raise_error
1205
+ end
1181
1206
  end
1182
1207
  end
1183
1208
 
1184
- context 'within a directory containing a unix domain socket file' do
1209
+ context 'within a directory containing a unix domain socket file', :unless => windows? do
1185
1210
  it 'does not raise an exception when hashing a unix domain socket file' do
1186
1211
  fixtures do |path|
1187
1212
  require 'socket'
1188
1213
  UNIXServer.new('unix_domain_socket.sock')
1189
- lambda { changes(path){} }.should_not raise_error(Errno::ENXIO)
1214
+ lambda { changes(path){} }.should_not raise_error
1190
1215
  end
1191
1216
  end
1192
1217
  end