Serverspec: Space in Path

At the moment I'm using the "should be_mounted.with" ressource to check the options in the fstab file.

Because of a space in the path I'm getting an error back.

describe file ('/path1/path2/path with space/path3'), :tag => "mnt" do
it { should be_mounted.with(
:options => { :rw => true},
:type => 'cifs',
)
}

Thanks

Hiya! A server spec forum might have a different recommendation, but this might help too.

fstab is a whitespace-delimited file, so if your mountpoint has a space in its filepath, you'll need to escape the spaces in the text of the fstab file with "\040". So your fstab entry should include the mountpoint as

/path1/path2/path\040with\040space/path3

and that is what your test should be trying to match. Generally it's not recommended to have spaces in a mountpoint, but it seems to be pretty common when mounting remote filesystems. If your remote share name has a space in it, the "\040" would also apply there.

Hi,

I'm using a Docker to run the tests. The Code I mentioned above is for testing in Docker (I should have mentioned that earlier). Docker uses Ruby to write tests and I don't know how to escape the Space.

Thanks