Skip to content

Commit

Permalink
use explicit ignore!: Silencer option in spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinDKelley committed Aug 15, 2021
1 parent 755309a commit 631d53b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions spec/lib/listen/record_spec.rb
Expand Up @@ -2,7 +2,8 @@

RSpec.describe Listen::Record do
let(:dir) { instance_double(Pathname, to_s: '/dir') }
let(:silencer) { Listen::Silencer.new }
let(:silencer_options) { { ignore!: [/\A\.ignored/] } }
let(:silencer) { Listen::Silencer.new(silencer_options) }
let(:record) { Listen::Record.new(dir, silencer) }

def dir_entries_for(hash)
Expand Down Expand Up @@ -309,16 +310,15 @@ def record_tree(record)

context 'with subdir containing files' do
before do
real_directory('/dir' => %w[dir1 dir2 .git])
real_directory('/dir/.git' => %w[FETCH_HEAD])
real_directory('/dir' => %w[dir1 dir2 .ignored])
real_directory('/dir/dir1' => %w[foo])
real_directory('/dir/dir1/foo' => %w[bar])
lstat(file('/dir/.git/FETCH_HEAD'))
lstat(file('/dir/.ignored/FETCH_HEAD'))
lstat(file('/dir/dir1/foo/bar'))
real_directory('/dir/dir2' => [])
end

it 'builds record' do
it 'builds record, skipping silenced patterns' do
record.build
expect(record_tree(record)).
to eq(
Expand All @@ -331,7 +331,8 @@ def record_tree(record)

context 'with subdir containing dirs' do
before do
real_directory('/dir' => %w[dir1 dir2])
real_directory('/dir' => %w[dir1 dir2 .ignored])
real_directory('/dir/.ignored' => %w[ignored_file])
real_directory('/dir/dir1' => %w[foo])
real_directory('/dir/dir1/foo' => %w[bar baz])
real_directory('/dir/dir1/foo/bar' => [])
Expand Down

0 comments on commit 631d53b

Please sign in to comment.