nutrasuite 0.1.4 → 0.2.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.
- data/README.markdown +10 -0
- data/lib/nutrasuite/contexts.rb +26 -3
- data/lib/nutrasuite/version.rb +1 -1
- data/test/test_helper.rb +0 -2
- data/test/unit/contexts_test.rb +2 -0
- metadata +1 -1
data/README.markdown
CHANGED
@@ -50,11 +50,21 @@ All of your other minitest stuff should work normally. Context
|
|
50
50
|
setup/teardown is executed once for each test, so the randomization built into
|
51
51
|
minitest will still work as you'd expect.
|
52
52
|
|
53
|
+
`a`, `an`, `and`, `the`, and `that` all define contexts, so you can build
|
54
|
+
readable sentences like "_a_ user _that_ has an expired password _and_ a bad email
|
55
|
+
address" or "_the_ singleton."
|
56
|
+
|
57
|
+
`it` defines tests; `it_eventually` defines tests that are to be skipped.
|
58
|
+
|
53
59
|
## Get it
|
54
60
|
|
55
61
|
It's a gem named nutrasuite. Install it and make it available however
|
56
62
|
you prefer.
|
57
63
|
|
64
|
+
If you want to use it you'll at least need Ruby 1.9. Other than that it should
|
65
|
+
be compatible with anything that works with MiniTest; we're not currently aware
|
66
|
+
of any conflicts.
|
67
|
+
|
58
68
|
## Contributions
|
59
69
|
|
60
70
|
If Nutrasuite interests you and you think you might want to contribute, hit me up
|
data/lib/nutrasuite/contexts.rb
CHANGED
@@ -34,7 +34,7 @@ module Nutrasuite
|
|
34
34
|
|
35
35
|
# Defines a test based on the given context that will be skipped for now
|
36
36
|
def it_eventually(name, &block)
|
37
|
-
build_test(name, :skip => true, &block)
|
37
|
+
build_test("eventually #{name}", :skip => true, &block)
|
38
38
|
end
|
39
39
|
|
40
40
|
def build_test(name, options = {}, &block)
|
@@ -64,11 +64,17 @@ module Nutrasuite
|
|
64
64
|
puts " * Warning: #{message}"
|
65
65
|
end
|
66
66
|
|
67
|
-
|
67
|
+
# ugly, but we need to make sure that all assertions work as intended
|
68
|
+
def method_missing(name, *args, &block)
|
69
|
+
unless MiniTest::Unit::TestCase.current.nil?
|
70
|
+
MiniTest::Unit::TestCase.current.send(name, *args, &block)
|
71
|
+
else
|
72
|
+
super(name, *args, &block)
|
73
|
+
end
|
74
|
+
end
|
68
75
|
end
|
69
76
|
|
70
77
|
class Context
|
71
|
-
include ContextHelpers
|
72
78
|
|
73
79
|
attr_reader :name, :setups, :teardowns
|
74
80
|
|
@@ -115,6 +121,23 @@ module Nutrasuite
|
|
115
121
|
end
|
116
122
|
end
|
117
123
|
|
124
|
+
# backwards compatibility with some slightly older versions of minitest
|
125
|
+
unless defined? MiniTest::Unit::TestCase.current
|
126
|
+
class MiniTest::Unit::TestCase
|
127
|
+
def initialize name
|
128
|
+
@__name__ = name
|
129
|
+
@__io__ = nil
|
130
|
+
@passed = nil
|
131
|
+
@@current = self
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.current
|
135
|
+
@@current ||= nil
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
|
118
141
|
class MiniTest::Unit::TestCase
|
119
142
|
extend Nutrasuite::ContextHelpers
|
120
143
|
end
|
data/lib/nutrasuite/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
data/test/unit/contexts_test.rb
CHANGED