diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-04-29 23:35:30 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-08-23 14:54:43 -0500 |
commit | 35dd0aad5aa665da9da9e2065a5ec5911b9e403a (patch) | |
tree | 801b6698c94734d400eb6265703a42f67ff15b84 | |
parent | a160881e6bf9a8145608ab4183f5d2c592d56875 (diff) | |
download | bundler-seg-exec-file--zsh.tar.gz |
[Exec] Add specs for $0 and __FILE__ when loadedseg-exec-file--zsh
-rw-r--r-- | spec/commands/exec_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index e1b94d80d5..42afbd24ba 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -564,6 +564,42 @@ describe "bundle exec" do it_behaves_like "it runs" end + context "regarding $0 and __FILE__" do + let(:executable) { super() + <<-'RUBY' } + + puts "$0: #{$0.inspect}" + puts "__FILE__: #{__FILE__.inspect}" + RUBY + + let(:expected) { super() + <<-EOS.chomp } + +$0: #{path.to_s.inspect} +__FILE__: #{path.to_s.inspect} + EOS + + it_behaves_like "it runs" + + context "when the path is relative" do + let(:path) { super().relative_path_from(bundled_app) } + + if LessThanProc.with(RUBY_VERSION).call("1.9") + pending "relative paths have ./ __FILE__" + else + it_behaves_like "it runs" + end + end + + context "when the path is relative with a leading ./" do + let(:path) { Pathname.new("./#{super().relative_path_from(Pathname.pwd)}") } + + if LessThanProc.with(RUBY_VERSION).call("< 1.9") + pending "relative paths with ./ have absolute __FILE__" + else + it_behaves_like "it runs" + end + end + end + context "signals being trapped by bundler" do let(:executable) { strip_whitespace <<-RUBY } #{shebang} |