stub != stub!.
stub!is an alias method for
stub. There is however also a method
stubthat is an alias for
double. If you try to stub a method on the test class (to stub it on the context), you should probably use the magic subject/helper/controller methods. If you don’t, using
self.stub(:name => 'result')will create a double, while
self.stub!(:name => 'result')will stub the method as you would expect.
Asynchronous file creation and downloading: if an asynchronous process writes a file using
f.write, an other process checking the presence of the file to determine whether it is already available for download, will deliver the empty file, if the file has been opened, but not yet written.
- if you have one write to the file only: check filesize.
- update an ActiveRecord attribute after the file writing is completed and check against that.
== on DelegateClass: newing up an instance
delegate_xof DelegateClass from object
x == delegate_x, while of course
x.class != delegate_x.class.
Keystroke of the day
- Rubymine KOTD: The search+replace mode you reach via
Cmd+rallows you to see recent searches by hitting the down arrow. If that doesn’t work for you in Lion, hit