Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listen -d can take multiple directories #303

Merged
merged 1 commit into from
Mar 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/listen/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CLI < Thor
banner: 'The address to forward filesystem events'

class_option :directory,
type: :string,
type: :array,
default: '.',
aliases: '-d',
banner: 'The directory to listen to'
Expand Down
35 changes: 35 additions & 0 deletions spec/lib/listen/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,41 @@
allow(forwarder).to receive(:start)
end

describe 'directories option' do
context 'not specified' do
let(:options) { %w[] }
it 'is set to local directory' do
expect(Listen::Forwarder).to receive(:new) do |options|
expect(options[:directory]).to eq('.')
forwarder
end
described_class.start(options)
end
end

context 'with a single directory' do
let(:options) { %w[-d app] }
it 'is set to app' do
expect(Listen::Forwarder).to receive(:new) do |options|
expect(options[:directory]).to eq(['app'])
forwarder
end
described_class.start(options)
end
end

context 'with a multiple directories' do
let(:options) { %w[-d app spec] }
it 'is set to an array of the directories' do
expect(Listen::Forwarder).to receive(:new) do |options|
expect(options[:directory]).to eq(%w(app spec))
forwarder
end
described_class.start(options)
end
end
end

describe 'relative option' do
context 'without relative option' do
let(:options) { %w[] }
Expand Down