therealadam (owner)

Revisions

gist: 99200 Download_button fork
public
Public Clone URL: git://gist.github.com/99200.git
Embed All Files: show embed
shoulda_fixme.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'test/unit'
require 'rubygems'
require 'activesupport'
require 'shoulda/test_unit'
 
module ShouldaExtensions
  
  def self.included(klass)
    klass.class_eval do
      include FixmeMethods
      
      alias_method_chain :build, :fixmes
    end
  end
  
  module FixmeMethods
    
    def should_fixme(name, &block)
      (@should_fixmes ||= []) << name
    end
    
    def build_with_fixmes
      build_without_fixmes
      
      @should_fixmes.each do |name|
        test_name = [full_name, 'should', "#{name}. "].flatten.join(' ')
        puts " * FIXME: " + test_name
      end
    end
    
  end
end
 
Shoulda::Context.method(:include).call(ShouldaExtensions)
 
class FooTest < Test::Unit::TestCase
  
  context 'Foo' do
    should_fixme 'write this stuff'
    
    should 'honk' do
      assert true
    end
  end
  
end