README.rdoc in test_unit-given-0.0.1 vs README.rdoc in test_unit-given-0.1.0

- old
+ new

@@ -79,32 +79,13 @@ assert_equal 314,@area } } end -You can also strictly enforce the use in your tests: - require 'test/unit/given/strict' +Finally, you can re-use blocks, and use And to create richer expressions: - class CircleTest < Test::Unit::TestCase - include Test::Unit::Given::Strict - include Test::Unit::Given::TestThat - - test_that { - @circle = Circle.new(10) - When { - # this causes an error, because there's no Given - @area = @circle.area - } - Then { - assert_equal 314,@area - } - } - end - -Finally, you can re-use blocks: - class CircleTest < Test::Unit::Given::TestCase def circle_with_radius(r) @circle = Circle.new(r) end @@ -118,18 +99,22 @@ end test_that { Given circle_with_radius(10) When get_radius + And { + @diameter = @circle.diameter + } Then area_should_be(314) + And { + assert_equal 20,@diameter + } } end === What about block-based assertions, like +assert_raises+ -You can use the non-strict version like so: - class CircleTest < Test::Unit::Given::TestCase test_that "there is no diameter method" do Given { @cicle = Circle.new(10) @@ -141,11 +126,9 @@ } end } end end - -This won't work in strict mode for now. == WTF? Why? Just because you're using Test::Unit doesn't mean you can't write fluent, easy to understand tests. You really don't need RSpec, and RSpec has some baggage, such as nonstandard assignment, confusing class_eval