Skip to content

Commit

Permalink
Make PStore tests as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Jan 10, 2025
1 parent 3955f89 commit ac0d0af
Showing 1 changed file with 10 additions and 6 deletions.
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)

0 comments on commit ac0d0af

Please sign in to comment.