In some tests I'm writing I need to create a lot of stubs that are pretty similar. I'm using Mocha.
user.stubs(:hq?).returns(false)
user.stubs(:has_role?).with("admin").returns(true)
And so on. It's a combinatorial thing that's very repetitive and un-dry. I'm wondering if I could switch this to some sort of chainable dsl.
user = user_stubber.hq.with_role("admin")
Is there a good way to approach this in Mocha. Or is there a better stubbing library that would give me this ability?