File tree Expand file tree Collapse file tree 5 files changed +89
-3
lines changed
Expand file tree Collapse file tree 5 files changed +89
-3
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2+ if [[ -n $ZSH_VERSION ]]; then
3+ autoload -U +X bashcompinit && bashcompinit
4+ autoload -U +X compinit && compinit
5+ fi
6+
7+ # === COMPLETION SCRIPT START ===
8+
29< %= script || %Q[source " #{absolute_script_path}" ] %>
310
4- # END OF COMPLETION SCRIPT
11+ # === COMPLETION SCRIPT END ===
512
613COMP_WORDS=( < %= compline %> )
714COMP_LINE=" <%= compline %>"
Original file line number Diff line number Diff line change 1+ # Completely Specs
2+
3+ ## Running tests
4+
5+ ``` bash
6+ $ rspec
7+ # or
8+ $ run spec
9+ # or, to run just tests in a given file
10+ $ run spec zsh
11+ # or, to run just specs tagged with :focus
12+ $ run spec :focus
13+ ```
14+
15+ You might need to prefix the commands with ` bundle exec ` , depending on the way
16+ Ruby is installed.
17+
18+ ## Interactive Approvals
19+
20+ Some tests may prompt you for an interactive approval of changes. This
21+ functionality is provided by the [ rspec_approvals gem] [ 1 ] .
22+
23+ Be sure to only approve changes that are indeed expected.
24+
25+
26+ ## ZSH Compatibility Test
27+
28+ ZSH compatibility test is done by running the completely tester script inside a
29+ zsh container. This is all done automatically by ` spec/completely/zsh_spec.rb ` .
30+
31+
32+ [ 1 ] : https://github.com/dannyben/rspec_approvals
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2+ if [[ -n $ZSH_VERSION ]]; then
3+ autoload -U +X bashcompinit && bashcompinit
4+ autoload -U +X compinit && compinit
5+ fi
6+
7+ # === COMPLETION SCRIPT START ===
8+
29# some completion script
310
4- # END OF COMPLETION SCRIPT
11+ # === COMPLETION SCRIPT END ===
512
613COMP_WORDS=( cli co )
714COMP_LINE=" cli co"
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2+ if [[ -n $ZSH_VERSION ]]; then
3+ autoload -U +X bashcompinit && bashcompinit
4+ autoload -U +X compinit && compinit
5+ fi
6+
7+ # === COMPLETION SCRIPT START ===
8+
29source " <path removed>"
310
4- # END OF COMPLETION SCRIPT
11+ # === COMPLETION SCRIPT END ===
512
613COMP_WORDS=( cli co )
714COMP_LINE=" cli co"
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe "zsh compatibility" do
4+ let ( :completions ) { Completely ::Completions . load 'spec/fixtures/basic.yaml' }
5+ let ( :words ) { "completely generate " }
6+ let ( :tester_script ) { completions . tester . tester_script words }
7+ let ( :shell ) { 'zsh' }
8+
9+ before do
10+ reset_tmp_dir
11+ system "mkdir -p spec/tmp/somedir"
12+ File . write "spec/tmp/test.sh" , tester_script
13+ end
14+
15+ subject do
16+ `docker run --rm -it -v $PWD/spec/tmp:/app dannyben/zsh #{ shell } /app/test.sh` . strip
17+ end
18+
19+ describe "completions script and test script" do
20+ it "returns completions without erroring" do
21+ expect ( subject ) . to eq "somedir --help --force"
22+ end
23+
24+ context "on bash" do
25+ let ( :shell ) { 'bash' }
26+
27+ it "returns the same output" do
28+ expect ( subject ) . to eq "somedir --help --force"
29+ end
30+ end
31+ end
32+
33+ end
You can’t perform that action at this time.
0 commit comments