Check if directory is empty

I have Ubuntu 16.04 with chef-client 14.1.1.
I have two steps with contrary conditions but both are run (spoiler: that folder is empty)

docker_container "build_packages" do
  only_if { ::Dir.empty?('/opt/chef/deb/') }

bash 'publish new deb package' do
  not_if { ::Dir.empty?('/opt/chef/deb/') }

Why is it happening?

you can do like this

not_if { Dir["/opt/chef/deb/*"].empty? }

It doesn’t work as well.
I made a test. I removed bash block and there was nothing in /opt/chef/deb/ folder after first step. So there is nothing at folder and not_if isn’t catching it.