Skip to content
Browse files

Added Matchy to the Test::Unit example

  • Loading branch information...
1 parent 6a874fb commit 89c56b13f09d5293b738c3f3feb0ed08af8a43ce @aslakhellesoy aslakhellesoy committed Nov 24, 2008
Showing with 17 additions and 5 deletions.
  1. +1 −0 History.txt
  2. +16 −5 examples/test_unit/features/step_definitions/test_unit_steps.rb
View
1 History.txt
@@ -10,6 +10,7 @@ You can now run multiple features at specific lines numbers like this:
This will run foo.feature at line 15 and bar.feature at line 6, 45 and 111.
=== New features
+* Added example showing how to use Cucumber with Test::Unit + Matchy instead of RSpec (Aslak Hellesøy)
* Yield existing world object to World block (#87 Aslak Hellesøy)
* AUTOFEATURE=tRue works (case insensitive) (Aslak Hellesøy)
* Support for .NET via IronRuby. See examples for details. (Aslak Hellesøy)
View
21 examples/test_unit/features/step_definitions/test_unit_steps.rb
@@ -8,8 +8,19 @@
instance_variable_set("@#{var}", value)
end
-Then /^I can assert that (\w+) == (\w+)$/ do |var_a, var_b|
- a = instance_variable_get("@#{var_a}")
- b = instance_variable_get("@#{var_b}")
- assert_equal(a, b)
-end
+begin
+ require 'rubygems'
+ require 'matchy'
+ Then /^I can assert that (\w+) == (\w+)$/ do |var_a, var_b|
+ a = instance_variable_get("@#{var_a}")
+ b = instance_variable_get("@#{var_b}")
+ a.should == b
+ end
+rescue LoadError
+ STDERR.puts "***** You should install matchy *****"
+ Then /^I can assert that (\w+) == (\w+)$/ do |var_a, var_b|
+ a = instance_variable_get("@#{var_a}")
+ b = instance_variable_get("@#{var_b}")
+ assert_equal(a, b)
+ end
+end

0 comments on commit 89c56b1

Please sign in to comment.
Something went wrong with that request. Please try again.