citrusbyte-contest 0.0.4 → 0.0.5
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 +19 -1
- data/lib/contest.rb +5 -0
- data/test/all_test.rb +10 -0
- metadata +1 -1
data/README.markdown
CHANGED
@@ -13,7 +13,7 @@ Usage
|
|
13
13
|
-----
|
14
14
|
|
15
15
|
Declare your tests as you would in RSpec or Shoulda. The keywords here
|
16
|
-
are `setup`, `context` and `test
|
16
|
+
are `setup`, `context` and `test`, :
|
17
17
|
|
18
18
|
require 'contest'
|
19
19
|
|
@@ -47,6 +47,24 @@ are `setup`, `context` and `test`:
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
For your convenience, `context` is aliased as `describe` and `test` is aliased as `should`, so this is valid:
|
51
|
+
|
52
|
+
class SomeTest < Test::Unit::TestCase
|
53
|
+
setup do
|
54
|
+
@value = 1
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "something" do
|
58
|
+
setup do
|
59
|
+
@value += 1
|
60
|
+
end
|
61
|
+
|
62
|
+
should "equal 2" do
|
63
|
+
assert_equal 2, @value
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
50
68
|
You can run it normaly, it's Test::Unit after all. If you want to run a particular test, say "yet more tests", try this:
|
51
69
|
|
52
70
|
$ testrb my_test.rb -n test_yet_more_tests
|
data/lib/contest.rb
CHANGED
data/test/all_test.rb
CHANGED
@@ -41,6 +41,16 @@ class FooTest < Test::Unit::TestCase
|
|
41
41
|
assert_equal 2, @value
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
describe "context with should" do
|
46
|
+
setup do
|
47
|
+
@value += 1
|
48
|
+
end
|
49
|
+
|
50
|
+
should "yet another truth" do
|
51
|
+
assert_equal 2, @value
|
52
|
+
end
|
53
|
+
end
|
44
54
|
end
|
45
55
|
|
46
56
|
class BarTest < Test::Unit::TestCase
|