Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 00e38f8d0fdc
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 07b45c484540
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Aug 7, 2016

  1. Copy the full SHA
    5e3111e View commit details
  2. Copy the full SHA
    07b45c4 View commit details
Showing with 24 additions and 5 deletions.
  1. +19 −2 spec/ruby/core/dir/shared/pwd.rb
  2. +5 −3 spec/ruby/shared/process/spawn.rb
21 changes: 19 additions & 2 deletions spec/ruby/core/dir/shared/pwd.rb
Original file line number Diff line number Diff line change
@@ -6,16 +6,33 @@
end

it "returns the current working directory" do
pwd = Dir.send(@method)

File.directory?(pwd).should == true

# On ubuntu gutsy, for example, /bin/pwd does not
# understand -P. With just `pwd -P`, /bin/pwd is run.

# The following uses inode rather than file names to account for
# case insensitive file systems like default OS/X file systems
platform_is_not :windows do
File.stat(Dir.send(@method)).ino.should == File.stat(`/bin/sh -c "pwd -P"`.chomp).ino
File.stat(pwd).ino.should == File.stat(`/bin/sh -c "pwd -P"`.chomp).ino
end
platform_is :windows do
File.stat(Dir.send(@method)).ino.should == File.stat(File.expand_path(`cd`.chomp)).ino
File.stat(pwd).ino.should == File.stat(File.expand_path(`cd`.chomp)).ino
end
end

it "returns an absolute path" do
pwd = Dir.send(@method)
pwd.should == File.expand_path(pwd)
end

it "returns an absolute path even when chdir to a relative path" do
Dir.chdir(".") do
pwd = Dir.send(@method)
File.directory?(pwd).should == true
pwd.should == File.expand_path(pwd)
end
end

8 changes: 5 additions & 3 deletions spec/ruby/shared/process/spawn.rb
Original file line number Diff line number Diff line change
@@ -225,17 +225,19 @@

# :unsetenv_others

# Use the system ruby when the environment is empty as it could easily break launchers.

it "unsets other environment variables when given a true :unsetenv_others option" do
ENV["FOO"] = "BAR"
lambda do
Process.wait @object.spawn('env', unsetenv_others: true)
Process.wait @object.spawn(['ruby', fixture(__FILE__, "env.rb")], unsetenv_others: true)
end.should output_to_fd("")
end

it "unsets other environment variables when given a non-false :unsetenv_others option" do
ENV["FOO"] = "BAR"
lambda do
Process.wait @object.spawn('env', unsetenv_others: :true)
Process.wait @object.spawn(['ruby', fixture(__FILE__, "env.rb")], unsetenv_others: :true)
end.should output_to_fd("")
end

@@ -255,7 +257,7 @@

it "does not unset environment variables included in the environment hash" do
lambda do
Process.wait @object.spawn({"FOO" => "BAR"}, 'env', unsetenv_others: true)
Process.wait @object.spawn({"FOO" => "BAR"}, ['ruby', fixture(__FILE__, "env.rb")], unsetenv_others: true)
end.should output_to_fd("FOO=BAR\n")
end