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.
Files changed (4) hide show
  1. data/README.markdown +19 -1
  2. data/lib/contest.rb +5 -0
  3. data/test/all_test.rb +10 -0
  4. 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
@@ -37,6 +37,11 @@ class Test::Unit::TestCase
37
37
  define_method(test_name(name), &block)
38
38
  end
39
39
 
40
+ class << self
41
+ alias_method :should, :test
42
+ alias_method :describe, :context
43
+ end
44
+
40
45
  private
41
46
 
42
47
  def self.setup_blocks
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citrusbyte-contest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Janowski