Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

PIVOTAL LABS
Standup for St. Patrick's Day

Help:

  • Testing blocks. If you have a block and you want to spy on the internals as it executes, what do you do? Suggestions were:
    • Have each method called internally throw a symbol and check for that.
    • Turn it into a proc, and set expectations on that.
    • Stub the methods being called internally and set expectations on those.
    • pass the block to a spy object.

Other suggestions welcome. The project is using rr, which apparently can’t do this last option, though that would be ideal.

  • Routes in Rails are case-sensitive? /products/1/edit and /Products/1/edit don’t both resolve to the same place (unless you specify in routes.rb). Rumor has it that the RFC for URIs says that the path portion of a URL is case-sensitive, as opposed to the case-insensitive domain name.

If anyone wants to read through that document and confirm…feel free.

Comments
  1. Alex Sharp says:

    In general, my opinion is that there is no reason to “test” the internals of something, as long as it returns what you expect, that should be sufficient. However, if you need to spy on the block for other reasons (performance, profiling) maybe try memprof. Not sure what the current state is on OS X, but it gives a lot of really helpful feedback on what ruby is doing.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *