Spring is in the air here in sunny NYC! Well, it was sunny for a bit. Now it’s turned into that classic film-noir drizzle. That’s authentic New York weather outside our window as we do the Round Up!
Ask for Help
I asked, “In Jasmine, how do you spy on a constructor?” Suppose you have a constructor called
spyOn(window, "Widget")swaps out the real
Widgetfunction with a spy. The real
Widgetimplementation takes its prototype with it, which means that Widgets created while the constructor is spied on don’t get the methods a
Widgetwould get. That’s true even when you spy with
Also, there doesn’t seem to be a way to stub out object construction and return an object of your choosing. In Rspec in Ruby you can say,
newis a keyword which always creates a new object. I’m guessing there’s no good way around this, but if there is one, we could really use it.
Update: This is, as it turns out, entirely incorrect. Jasmine’s
.andReturn()does let you stub constructors properly. I still have no idea how this works. See the comments for more discussion.
Todd notifies us that in ActiveRecord, dynamic finders with too-few arguments fail silently. That is, if you say,
and fail to specify a value for
nil. That means that the finder will look for someone named “Todd Persen” with a
nilemail address. You might have meant that. More likely, you made a mistake. AR should probably check the number of arguments it’s given against the number of columns in the finder name.
You already know that Pivotal does real Extreme Programming. But did you know that we have…Extreme Breakfast?