pelargir / pass_nils_to

Pass nils to methods in various permutations. Expose bugs. Profit.

pass_nils_to / README
100644 55 lines (34 sloc) 1.147 kb
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
49
50
51
52
53
54
55
= pass_nils_to
 
Pass nils to your methods and see if they explode.
 
== Installation
 
Install the gem directly:
 
  gem sources -a http://gems.github.com (you only have to do this once)
  sudo gem install pelargir-pass_nils_to
  
Or install the gem in your Rails project:
  
  gem sources -a http://gems.github.com
  script/plugin install pelargir-pass_nils_to
 
Or clone the project:
 
  git clone git://github.com/pelargir/pass_nils_to.git
 
== Usage
 
Pass nils to your methods thusly:
 
  class Parser
    def parse(arg1, arg2)
      ...
    end
  end
  
  parser = Parser.new
  pass_nils_to(:parse, parser)
  
This would pass nils to the #parse method in these combinations:
 
  parse(nil, "foo")
  parse("foo", nil)
  parse(nil, nil)
  
An arbitrary number of arguments are supported, so you can try passing
nils to methods with three arguments, four, five, etc.
 
== Running Unit Tests
 
Use the rake command to run the unit tests for the plugin. The tests require
that the Mocha gem be installed locally:
 
  sudo gem install mocha
 
== Resources
 
Repository: http://github.com/pelargir/pass_nils_to/
Blog: http://matthewbass.com
Author: Matthew Bass