Skip to content

Commit

Permalink
Stop using global expectation methods and switch to using _.
Browse files Browse the repository at this point in the history
Fixes new deprecations from minitest 5.12+ and cleans the test output
back to plain dots.

Signed-off-by: Ryan Davis <[email protected]>
  • Loading branch information
zenspider committed Oct 9, 2019
1 parent 8926b0a commit bc3a18b
Show file tree
Hide file tree
Showing 43 changed files with 1,050 additions and 1,046 deletions.
32 changes: 16 additions & 16 deletions test/integration/tests/path_block_device_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,68 +7,68 @@
let(:file) { backend.file("/tmp/block_device") }

it "exists" do
file.exist?.must_equal(true)
_(file.exist?).must_equal(true)
end

it "is a block device" do
file.block_device?.must_equal(true)
_(file.block_device?).must_equal(true)
end

it "has type :block_device" do
file.type.must_equal(:block_device)
_(file.type).must_equal(:block_device)
end

it "has no content" do
file.content.must_equal("")
_(file.content).must_equal("")
end

it "has owner name root" do
file.owner.must_equal("root")
_(file.owner).must_equal("root")
end

it "has group name" do
file.group.must_equal(Test.root_group(backend.os))
_(file.group).must_equal(Test.root_group(backend.os))
end

it "has mode 0666" do
file.mode.must_equal(00666)
_(file.mode).must_equal(00666)
end

it "checks mode? 0666" do
file.mode?(00666).must_equal(true)
_(file.mode?(00666)).must_equal(true)
end

it "has no link_path" do
file.link_path.must_be_nil
_(file.link_path).must_be_nil
end

it "has the correct md5sum" do
file.md5sum.must_equal("d41d8cd98f00b204e9800998ecf8427e")
_(file.md5sum).must_equal("d41d8cd98f00b204e9800998ecf8427e")
end

it "has the correct sha256sum" do
file.sha256sum.must_equal("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
_(file.sha256sum).must_equal("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
end

it "has a modified time" do
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime / 2, Test.mtime)
_(file.mtime).must_be_close_to(Time.now.to_i - Test.mtime / 2, Test.mtime)
end

it "has inode size of 0" do
file.size.must_equal(0)
_(file.size).must_equal(0)
end

it "has selinux label handling" do
res = Test.selinux_label(backend, file.path)
file.selinux_label.must_equal(res)
_(file.selinux_label).must_equal(res)
end

it "has no product_version" do
file.product_version.must_be_nil
_(file.product_version).must_be_nil
end

it "has no file_version" do
file.file_version.must_be_nil
_(file.file_version).must_be_nil
end
end
end
32 changes: 16 additions & 16 deletions test/integration/tests/path_character_device_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,68 +7,68 @@
let(:file) { backend.file("/dev/null") }

it "exists" do
file.exist?.must_equal(true)
_(file.exist?).must_equal(true)
end

it "is a character device" do
file.character_device?.must_equal(true)
_(file.character_device?).must_equal(true)
end

it "has type :character_device" do
file.type.must_equal(:character_device)
_(file.type).must_equal(:character_device)
end

it "has empty content" do
file.content.must_equal("")
_(file.content).must_equal("")
end

it "has owner name root" do
file.owner.must_equal("root")
_(file.owner).must_equal("root")
end

it "has group name" do
file.group.must_equal(Test.root_group(backend.os))
_(file.group).must_equal(Test.root_group(backend.os))
end

it "has mode 0666" do
file.mode.must_equal(00666)
_(file.mode).must_equal(00666)
end

it "checks mode? 0666" do
file.mode?(00666).must_equal(true)
_(file.mode?(00666)).must_equal(true)
end

it "has no link_path" do
file.link_path.must_be_nil
_(file.link_path).must_be_nil
end

it "has an md5sum" do
file.md5sum.must_equal("d41d8cd98f00b204e9800998ecf8427e")
_(file.md5sum).must_equal("d41d8cd98f00b204e9800998ecf8427e")
end

it "has an sha256sum" do
file.sha256sum.must_equal("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
_(file.sha256sum).must_equal("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
end

it "has a modified time" do
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime / 2, Test.mtime)
_(file.mtime).must_be_close_to(Time.now.to_i - Test.mtime / 2, Test.mtime)
end

it "has inode size of 0" do
file.size.must_equal(0)
_(file.size).must_equal(0)
end

it "has selinux label handling" do
res = Test.selinux_label(backend, file.path)
file.selinux_label.must_equal(res)
_(file.selinux_label).must_equal(res)
end

it "has no product_version" do
file.product_version.must_be_nil
_(file.product_version).must_be_nil
end

it "has no file_version" do
file.file_version.must_be_nil
_(file.file_version).must_be_nil
end
end
end
42 changes: 21 additions & 21 deletions test/integration/tests/path_file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,93 +7,93 @@
let(:file) { backend.file("/tmp/file") }

it "exists" do
file.exist?.must_equal(true)
_(file.exist?).must_equal(true)
end

it "is a file" do
file.file?.must_equal(true)
_(file.file?).must_equal(true)
end

it "has type :file" do
file.type.must_equal(:file)
_(file.type).must_equal(:file)
end

it "has content" do
file.content.must_equal("hello world")
_(file.content).must_equal("hello world")
end

it "has owner name root" do
file.owner.must_equal("root")
_(file.owner).must_equal("root")
end

it "has group name" do
file.group.must_equal(Test.root_group(backend.os))
_(file.group).must_equal(Test.root_group(backend.os))
end

it "has mode 0765" do
file.mode.must_equal(00765)
_(file.mode).must_equal(00765)
end

it "checks mode? 0765" do
file.mode?(00765).must_equal(true)
_(file.mode?(00765)).must_equal(true)
end

it "doesnt check mode? 0764" do
file.mode?(00764).must_equal(false)
_(file.mode?(00764)).must_equal(false)
end

it "has no link_path" do
file.link_path.must_be_nil
_(file.link_path).must_be_nil
end

it "has an md5sum" do
file.md5sum.must_equal("5eb63bbbe01eeed093cb22bb8f5acdc3")
_(file.md5sum).must_equal("5eb63bbbe01eeed093cb22bb8f5acdc3")
end

it "has an sha256sum" do
file.sha256sum.must_equal("b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9")
_(file.sha256sum).must_equal("b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9")
end

it "has a modified time" do
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime / 2, Test.mtime)
_(file.mtime).must_be_close_to(Time.now.to_i - Test.mtime / 2, Test.mtime)
end

it "has size" do
# Must be around 11 Bytes, +- 4
file.size.must_be_close_to(11, 4)
_(file.size).must_be_close_to(11, 4)
end

it "has selinux label handling" do
res = Test.selinux_label(backend, file.path)
file.selinux_label.must_equal(res)
_(file.selinux_label).must_equal(res)
end

it "has no product_version" do
file.product_version.must_be_nil
_(file.product_version).must_be_nil
end

it "has no file_version" do
file.file_version.must_be_nil
_(file.file_version).must_be_nil
end

it "provides a json representation" do
j = file.to_json
j.must_be_kind_of Hash
j["type"].must_equal :file
_(j).must_be_kind_of Hash
_(j["type"]).must_equal :file
end
end

describe "regular file" do
let(:file) { backend.file("/tmp/sfile") }
it "has mode 7765" do
file.mode.must_equal(07765)
_(file.mode).must_equal(07765)
end
end

describe "regular file" do
let(:file) { backend.file("/tmp/spaced file") }
it "has content" do
file.content.must_equal("hello space")
_(file.content).must_equal("hello space")
end
end
end
38 changes: 19 additions & 19 deletions test/integration/tests/path_folder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,84 +7,84 @@
let(:file) { backend.file("/tmp/folder") }

it "exists" do
file.exist?.must_equal(true)
_(file.exist?).must_equal(true)
end

it "is a directory" do
file.directory?.must_equal(true)
_(file.directory?).must_equal(true)
end

it "has type :directory" do
file.type.must_equal(:directory)
_(file.type).must_equal(:directory)
end

case get_backend.call.os[:family]
when "freebsd"
it "has freebsd folder content behavior" do
file.content.must_equal("\u0003\u0000")
_(file.content).must_equal("\u0003\u0000")
end

it "has an md5sum" do
file.md5sum.must_equal("598f4fe64aefab8f00bcbea4c9239abf")
_(file.md5sum).must_equal("598f4fe64aefab8f00bcbea4c9239abf")
end

it "has an sha256sum" do
file.sha256sum.must_equal("9b4fb24edd6d1d8830e272398263cdbf026b97392cc35387b991dc0248a628f9")
_(file.sha256sum).must_equal("9b4fb24edd6d1d8830e272398263cdbf026b97392cc35387b991dc0248a628f9")
end

else
it "has no content" do
file.content.must_be_nil
_(file.content).must_be_nil
end

it "raises an error if md5sum is attempted" do
proc { file.md5sum }.must_raise RuntimeError
_ { file.md5sum }.must_raise RuntimeError
end

it "raises an error if sha256sum is attempted" do
proc { file.sha256sum }.must_raise RuntimeError
_ { file.sha256sum }.must_raise RuntimeError
end
end

it "has owner name root" do
file.owner.must_equal("root")
_(file.owner).must_equal("root")
end

it "has group name" do
file.group.must_equal(Test.root_group(backend.os))
_(file.group).must_equal(Test.root_group(backend.os))
end

it "has mode 0567" do
file.mode.must_equal(00567)
_(file.mode).must_equal(00567)
end

it "checks mode? 0567" do
file.mode?(00567).must_equal(true)
_(file.mode?(00567)).must_equal(true)
end

it "has no link_path" do
file.link_path.must_be_nil
_(file.link_path).must_be_nil
end

it "has a modified time" do
file.mtime.must_be_close_to(Time.now.to_i - Test.mtime / 2, Test.mtime)
_(file.mtime).must_be_close_to(Time.now.to_i - Test.mtime / 2, Test.mtime)
end

it "has inode size" do
file.size.must_be_close_to(4096, 4096)
_(file.size).must_be_close_to(4096, 4096)
end

it "has selinux label handling" do
res = Test.selinux_label(backend, file.path)
file.selinux_label.must_equal(res)
_(file.selinux_label).must_equal(res)
end

it "has no product_version" do
file.product_version.must_be_nil
_(file.product_version).must_be_nil
end

it "has no file_version" do
file.file_version.must_be_nil
_(file.file_version).must_be_nil
end
end
end
Loading

0 comments on commit bc3a18b

Please sign in to comment.