ruby on rails - Rspec: can't convert Array into String -


i'm trying stub directory has wildcard in (don't know specific version number affects naming scheme of folder). tried using double() , ran issues thought maybe 2 step process...in current iteration i'm trying glob file wildcard accounted , check if directory exists after fact. doing wrong?

it "return 1.5 linux os , correct version"     facter.fact(:kernel).stubs(:value).returns("linux")     dir = dir.glob("/opt/athena-*/bin/runner")     dir.exist?(dir).and_return(true)     facter::util::resolution.stubs(:exec).with('runner -version').returns("version:  1.5")     facter.fact(:version).value.should == "1.5" end 

seem need stub dir.exist?:

dir.stub(:exist?).with(dir).and_return(true) 

however dir.glob returns array. maybe want first one?:

dir = dir.glob('/opt/athena-*/bin/runner').first 

it's not clear me trying test here.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -