ChefSpec converge failure

Hi All,

I have a chef recipe that creates a directory at /usr/share/apps and then downloads a package to this directory. While executing chefSpec, using ChefSpec::ServerRunner, for this recipe

upon converge:

it 'converges successfully' do
     expect { chef_run }.to_not raise_error
end

I get an error saying that the directory does not exits

expected no Exception, got #<Errno::ENOENT: No such file or directory @ rb_file_s_stat - /usr/share/apps

Why is this happening?

What is right way to run converge in such scenarios, mock the directory location ? How do I mock a directory location in chefSpec?

Could you post some parts or your recipe that fail? It’s quite hard to answer such a questions without knowing the proper context.