Skip to content
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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
source 'https://rubygems.org'

gem 'debug'
gem 'ice_age'
gem 'lp'
gem 'rspec'
gem 'rspec_approvals'
Expand Down
9 changes: 1 addition & 8 deletions spec/completely/commands/generate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
ENV['COMPLETELY_CONFIG_PATH'] = 'spec/tmp/hello.yml'
end

after do
ENV['COMPLETELY_CONFIG_PATH'] = nil
system 'rm -f hello.bash'
end
after { system 'rm -f hello.bash' }

it 'generates the bash script to hello.bash' do
expect { subject.execute %w[generate] }.to output_approval('cli/generate/custom-path-env')
Expand All @@ -67,10 +64,6 @@
ENV['COMPLETELY_OUTPUT_PATH'] = outfile
end

after do
ENV['COMPLETELY_OUTPUT_PATH'] = nil
end

it 'generates the bash script to the requested path' do
expect { subject.execute %w[generate] }.to output_approval('cli/generate/custom-path-env2')
expect(File.read outfile).to match_approval('cli/generated-script')
Expand Down
2 changes: 0 additions & 2 deletions spec/completely/commands/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@
ENV['COMPLETELY_CONFIG_PATH'] = 'spec/tmp/hello.yml'
end

after { ENV['COMPLETELY_CONFIG_PATH'] = nil }

it 'creates a new sample file with the requested name' do
expect { subject.execute %w[init] }
.to output_approval('cli/init/custom-path-env')
Expand Down
2 changes: 0 additions & 2 deletions spec/completely/commands/preview_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
ENV['COMPLETELY_CONFIG_PATH'] = 'spec/tmp/hello.yml'
end

after { ENV['COMPLETELY_CONFIG_PATH'] = nil }

it 'outputs the generated script to STDOUT' do
expect { subject.execute %w[preview] }
.to output_approval('cli/generated-script')
Expand Down
6 changes: 1 addition & 5 deletions spec/completely/commands/test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@

before do
system 'cp lib/completely/templates/flat-config/sample.yaml completely.yaml'
ENV['COMPLETELY_CONFIG_PATH'] = nil
end

after do
system 'rm -f completely.yaml'
ENV['COMPLETELY_CONFIG_PATH'] = nil
end
after { system 'rm -f completely.yaml' }

context 'with --help' do
it 'shows long usage' do
Expand Down
1 change: 0 additions & 1 deletion spec/completely/completions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@

context 'when COMPLETELY_DEBUG is set' do
before { ENV['COMPLETELY_DEBUG'] = '1' }
after { ENV['COMPLETELY_DEBUG'] = nil }

it 'adds an additional debug snippet to the script' do
expect(subject.script).to match_approval('completions/script-with-debug')
Expand Down
24 changes: 3 additions & 21 deletions spec/completely/installer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,23 @@
end

context 'when BASH_COMPLETION_USER_DIR is set' do
around do |example|
original = ENV['BASH_COMPLETION_USER_DIR']
ENV['BASH_COMPLETION_USER_DIR'] = '/tmp/completely-user-dir'
example.run
ensure
ENV['BASH_COMPLETION_USER_DIR'] = original
end
before { ENV['BASH_COMPLETION_USER_DIR'] = '/tmp/completely-user-dir' }

it 'uses BASH_COMPLETION_USER_DIR/completions' do
expect(subject.target_path).to eq '/tmp/completely-user-dir/completions/completely-test'
end
end

context 'when XDG_DATA_HOME is set' do
around do |example|
original = ENV['XDG_DATA_HOME']
ENV['XDG_DATA_HOME'] = '/tmp/completely-xdg'
example.run
ensure
ENV['XDG_DATA_HOME'] = original
end
before { ENV['XDG_DATA_HOME'] = '/tmp/completely-xdg' }

it 'uses XDG_DATA_HOME/bash-completion/completions' do
expect(subject.target_path).to eq '/tmp/completely-xdg/bash-completion/completions/completely-test'
end
end

context 'when BASH_COMPLETION_USER_DIR has multiple entries' do
around do |example|
original = ENV['BASH_COMPLETION_USER_DIR']
ENV['BASH_COMPLETION_USER_DIR'] = ':/tmp/completely-first:/tmp/completely-second'
example.run
ensure
ENV['BASH_COMPLETION_USER_DIR'] = original
end
before { ENV['BASH_COMPLETION_USER_DIR'] = ':/tmp/completely-first:/tmp/completely-second' }

it 'uses the first non-empty entry' do
expect(subject.target_path).to eq '/tmp/completely-first/completions/completely-test'
Expand Down
Loading