From c6ebbbd38b997f8a8d6968e683e29db1e299b5aa Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Thu, 13 Feb 2020 23:06:33 +0900 Subject: spec/ruby: skip the specs that use /etc/passwd on Android There is no /etc/passwd on Android --- spec/ruby/core/file/stat/owned_spec.rb | 2 +- spec/ruby/shared/file/executable.rb | 2 +- spec/ruby/shared/file/readable.rb | 5 ++++- spec/ruby/shared/file/writable.rb | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'spec') diff --git a/spec/ruby/core/file/stat/owned_spec.rb b/spec/ruby/core/file/stat/owned_spec.rb index 6f0c250f88..fbd473c4d7 100644 --- a/spec/ruby/core/file/stat/owned_spec.rb +++ b/spec/ruby/core/file/stat/owned_spec.rb @@ -21,7 +21,7 @@ describe "File::Stat#owned?" do st.owned?.should == true end - platform_is_not :windows do + platform_is_not :windows, :android do as_user do it "returns false if the file is not owned by the user" do system_file = '/etc/passwd' diff --git a/spec/ruby/shared/file/executable.rb b/spec/ruby/shared/file/executable.rb index 2987d0aabb..7b5c4c580c 100644 --- a/spec/ruby/shared/file/executable.rb +++ b/spec/ruby/shared/file/executable.rb @@ -13,7 +13,7 @@ describe :file_executable, shared: true do rm_r @file1, @file2 end - platform_is_not :windows do + platform_is_not :windows, :android do it "returns true if named file is executable by the effective user id of the process, otherwise false" do @object.send(@method, '/etc/passwd').should == false @object.send(@method, @file1).should == true diff --git a/spec/ruby/shared/file/readable.rb b/spec/ruby/shared/file/readable.rb index 74f58caaff..eb2ca06812 100644 --- a/spec/ruby/shared/file/readable.rb +++ b/spec/ruby/shared/file/readable.rb @@ -4,9 +4,12 @@ describe :file_readable, shared: true do platform_is :windows do @file2 = File.join(ENV["WINDIR"], "system32/drivers/etc/services").tr(File::SEPARATOR, File::ALT_SEPARATOR) end - platform_is_not :windows do + platform_is_not :windows, :android do @file2 = "/etc/passwd" end + platform_is :android do + @file2 = "/system/bin/sh" + end end after :each do diff --git a/spec/ruby/shared/file/writable.rb b/spec/ruby/shared/file/writable.rb index 902d545da1..4bb8aedce6 100644 --- a/spec/ruby/shared/file/writable.rb +++ b/spec/ruby/shared/file/writable.rb @@ -8,7 +8,7 @@ describe :file_writable, shared: true do end it "returns true if named file is writable by the effective user id of the process, otherwise false" do - platform_is_not :windows do + platform_is_not :windows, :android do as_user do @object.send(@method, "/etc/passwd").should == false end -- cgit v1.2.3