Displaying 1 result from an estimated 1 matches for "mockaudit".
2007 Oct 08
0
Using mocks in classes
...ment, Audit, has_many AuditItems which is being mocked.
When created, Audit creates the first instance of AuditItem.
To enable me to mock AuditItem I have created a factory method in Audit to
create the AuditItem, rather than creating it in the initialize method;
that way I can defined a new class MockAudit and overide the
create_audit_item method.
It looks like
class MockAudit < Audit
def initialize
@auditItem[0] = mockAuditItem
end
The question is, where do I define mockAuditItem. If it inside the describe
block, MockAudit cannot see it. If I define mockAuditItem =
mock("AuditItem") i...