タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

rubyとtestingに関するita-wasaのブックマーク (1)

  • Testing: One expectation per test

    In a previous entry I discussed why I prefer One Assertion Per Test. In that entry I give a few state based examples, but didn't address the topic of mocks. This entry is going to focus on how you can use mocks while maintaining focus on maintainability. Let's start with an example. require 'test/unit' require 'rubygems' require 'mocha' module Expectations class SuiteRunner attr_accessor :suite de

    ita-wasa
    ita-wasa 2008/07/29
    Writing tests in this way is actually quite easy if you follow a few simple suggestions. * If your test has an assertion, do not add any mock expectations (instead use stubs for any methods that need to be changed for the test). * If you add a mock expectation you probably don't need it to r
  • 1