This is because an unsaved buffer has an undefined uri. You'll want to use [jasmine's](http://jasmine.github.io/1.3/introduction.html) `spyOn` functionality to stub the return value.