Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bundled gems like pstore and ostruct #705

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions test/psych/test_yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# frozen_string_literal: true

require_relative 'helper'
require 'ostruct'

# [ruby-core:01946]
module Psych_Tests
Expand All @@ -15,8 +14,14 @@ def teardown
end

def test_y_method
assert_raise(NoMethodError) do
OpenStruct.new.y 1
begin
require 'ostruct'

assert_raise(NoMethodError) do
OpenStruct.new.y 1
end
rescue LoadError
omit("OpenStruct is not available")
end
end

Expand Down
16 changes: 10 additions & 6 deletions test/psych/test_yamlstore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ def load(content)

class YAMLStoreTest < TestCase
def setup
@dir = Dir.mktmpdir("rubytest-file")
File.chown(-1, Process.gid, @dir)
@yamlstore_file = make_tmp_filename("yamlstore")
@yamlstore = YAML::Store.new(@yamlstore_file)
if defined?(::PStore)
@dir = Dir.mktmpdir("rubytest-file")
File.chown(-1, Process.gid, @dir)
@yamlstore_file = make_tmp_filename("yamlstore")
@yamlstore = YAML::Store.new(@yamlstore_file)
else
omit "PStore is not available"
end
end

def teardown
FileUtils.remove_entry_secure @dir
FileUtils.remove_entry_secure(@dir) if @dir
end

def make_tmp_filename(prefix)
Expand Down Expand Up @@ -97,5 +101,5 @@ def test_writing_inside_readonly_transaction_raises_error
end
end
end
end
end if defined?(::PStore)
end if defined?(Psych)
Loading