minitest-must_not 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ # Require the MiniTestMustNot module (which can be included into any class)
2
+ require 'minitest-must_not/core'
3
+
4
+ # Go ahead and include MiniTestMustNot into Object, which is what we want to do 99.999% of the time
5
+ Object.send :include, MiniTestMustNot
@@ -0,0 +1,40 @@
1
+ require 'minitest-must_not/version'
2
+
3
+ # When this module is included, it provides a method_missing implementation
4
+ # that catches all methods that look like 'must_not_[something]' and delegates
5
+ # them to the equivalent 'wont_[something]' method (if it exists).
6
+ module MiniTestMustNot
7
+ METHOD_NAME_REGEX = /^must_not_(.*)$/
8
+
9
+ # Catches all method calls that look like 'must_not_[something]'
10
+ # and delegates them to the equivalent 'wont_[something]'
11
+ def method_missing name, *args, &block
12
+ if name.to_s =~ METHOD_NAME_REGEX
13
+ wont_method_name = "wont_#{$1}"
14
+
15
+ # Cache the method (via an alias) so method_missing isn't always used
16
+ begin
17
+ self.class.send :alias_method, name, wont_method_name # possible NameError
18
+ rescue NameError
19
+ # alias_method will raise a NameError if the method we're trying to
20
+ # alias to doesn't exist, in which case we should just call super
21
+ # which will generally raise a NoMethodError for our must_not_* method
22
+ return super
23
+ end
24
+
25
+ send wont_method_name, *args, &block
26
+ else
27
+ super
28
+ end
29
+ end
30
+
31
+ # Catches all method calls that look like 'must_not_[something]'
32
+ # and returns whether this object responds to 'wont_[something]'
33
+ def respond_to? name
34
+ if name.to_s =~ METHOD_NAME_REGEX
35
+ respond_to? "wont_#{$1}"
36
+ else
37
+ super
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,8 @@
1
+ module MiniTestMustNot
2
+ begin
3
+ old, $VERBOSE = $VERBOSE, nil
4
+ VERSION = '0.1.0'
5
+ ensure
6
+ $VERBOSE = old
7
+ end
8
+ end
@@ -0,0 +1,2 @@
1
+ # Shortcut to let you require 'minitest/must_not'
2
+ require 'minitest-must_not'
@@ -0,0 +1,2 @@
1
+ # Shortcut to let you require 'minitest/must_not/core'
2
+ require 'minitest-must_not/core'
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-must_not
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - remi
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-08-13 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Provides must_not as an alias for wont in MiniTest (for the MiniSpec BDD DSL)
23
+ email: remi@remitaylor.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/minitest/must_not/core.rb
32
+ - lib/minitest/must_not.rb
33
+ - lib/minitest-must_not/core.rb
34
+ - lib/minitest-must_not/version.rb
35
+ - lib/minitest-must_not.rb
36
+ has_rdoc: true
37
+ homepage: http://github.com/remi/minitest-must_not
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ hash: 3
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ requirements: []
64
+
65
+ rubyforge_project:
66
+ rubygems_version: 1.6.2
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Provides must_not as an alias for wont in MiniTest
70
+ test_files: []
71
+