~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/mocha-0.5.6/test/active_record_test_case.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mto: (3.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20080726154345-1fmgo76b4l72ulvc
ImportĀ upstreamĀ versionĀ 0.24.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
module ActiveRecordTestCase
 
2
 
 
3
  def setup_with_fixtures
 
4
    methods_called << :setup_with_fixtures
 
5
  end
 
6
 
 
7
  alias_method :setup, :setup_with_fixtures
 
8
 
 
9
  def teardown_with_fixtures
 
10
    methods_called << :teardown_with_fixtures
 
11
  end
 
12
 
 
13
  alias_method :teardown, :teardown_with_fixtures
 
14
 
 
15
  def self.method_added(method)
 
16
    case method.to_s
 
17
    when 'setup'
 
18
      unless method_defined?(:setup_without_fixtures)
 
19
        alias_method :setup_without_fixtures, :setup
 
20
        define_method(:setup) do
 
21
          setup_with_fixtures
 
22
          setup_without_fixtures
 
23
        end
 
24
      end
 
25
    when 'teardown'
 
26
      unless method_defined?(:teardown_without_fixtures)
 
27
        alias_method :teardown_without_fixtures, :teardown
 
28
        define_method(:teardown) do
 
29
          teardown_without_fixtures
 
30
          teardown_with_fixtures
 
31
        end
 
32
      end
 
33
    end
 
34
  end
 
35
 
 
36
end
 
 
b'\\ No newline at end of file'