diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-20 20:18:52 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-20 20:18:52 +0000 |
commit | 1d15d5f08032acf1b7bceacbb450d617ff6e0931 (patch) | |
tree | a3785a79899302bc149e4a6e72f624ac27dc1f10 /spec/ruby/core/dir/chroot_spec.rb | |
parent | 75bfc6440d595bf339007f4fb280fd4d743e89c1 (diff) | |
download | ruby-1d15d5f08032acf1b7bceacbb450d617ff6e0931.tar.gz |
Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory.
[Misc #13792] [ruby-core:82287]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/dir/chroot_spec.rb')
-rw-r--r-- | spec/ruby/core/dir/chroot_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/ruby/core/dir/chroot_spec.rb b/spec/ruby/core/dir/chroot_spec.rb new file mode 100644 index 0000000000..1afe254957 --- /dev/null +++ b/spec/ruby/core/dir/chroot_spec.rb @@ -0,0 +1,47 @@ +require File.expand_path('../../../spec_helper', __FILE__) +require File.expand_path('../fixtures/common', __FILE__) +require File.expand_path('../shared/chroot', __FILE__) + +platform_is_not :windows do + as_superuser do + describe "Dir.chroot as root" do + it_behaves_like :dir_chroot_as_root, :chroot + end + end + + platform_is_not :cygwin do + as_user do + describe "Dir.chroot as regular user" do + before :all do + DirSpecs.create_mock_dirs + end + + after :all do + DirSpecs.delete_mock_dirs + end + + it "raises an Errno::EPERM exception if the directory exists" do + lambda { Dir.chroot('.') }.should raise_error(Errno::EPERM) + end + + it "raises a SystemCallError if the directory doesn't exist" do + lambda { Dir.chroot('xgwhwhsjai2222jg') }.should raise_error(SystemCallError) + end + + it "calls #to_path on non-String argument" do + p = mock('path') + p.should_receive(:to_path).and_return('.') + lambda { Dir.chroot(p) }.should raise_error + end + end + end + end + + platform_is :cygwin do + as_user do + describe "Dir.chroot as regular user" do + it_behaves_like :dir_chroot_as_root, :chroot + end + end + end +end |