I am trying to check if the text was written to the file (build.log) after running the rake command that throws an exception. Inspect both code snippets below, one that starts with work, while lambda throws a message stating that it cannot find the build.log file.
Using the start of testing. (works)
begin Rake::Task['git:checkout'].invoke //writes "destination already exists" to build.log rescue end IO.read(@ project_folder+@build _id+"/build.log").should match(/.*destination.*already.*exists.* /)
Trying to check the same using lambda. (Does not work)
lambda { Rake::Task['git:checkout'].invoke //writes "destination already exists" to build.log } IO.read(@ project_folder+@build _id+"/build.log").should match(/.*destination.*already.*exists.* /)
What is the difference between the two?
Muthu source share