Skip to content

Commit

Permalink
Updated Readme, Manifest and gemspec.
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy McAnally <jeremymcanally@gmail.com>
  • Loading branch information
mhennemeyer authored and jm committed Feb 11, 2009
1 parent f2bd0d8 commit 9b4f8a1
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 14 deletions.
4 changes: 3 additions & 1 deletion Manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ config/hoe.rb
config/requirements.rb
lib/matchy.rb
lib/matchy/version.rb
lib/matchy/expectation.rb
lib/matchy/modals.rb
lib/matchy/def_matcher.rb
lib/matchy/matcher_builder.rb
lib/matchy/built_in/enumerable_expectations.rb
lib/matchy/built_in/error_expectations.rb
lib/matchy/built_in/operator_expectations.rb
lib/matchy/built_in/truth_expectations.rb
lib/matchy/built_in/change_expectations.rb
setup.rb
59 changes: 55 additions & 4 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
= matchy

* http://github.com/jeremymcanally/matchy
* http://github.com/mhennemeyer/matchy

== DESCRIPTION:

"A 300loc refactoring of Jeremy Mcanally's Matchy. Original Description:
Hate writing assertions? Need a little behavior-driven love in your tests? Then matchy is for you.

== FEATURES/PROBLEMS:

* Get the beauty of RSpec without all the overhead
* Create your own matchers (coming soon)
* Create your own matchers with ease and def_matcher()

== SYNOPSIS:

Expand All @@ -30,17 +30,68 @@ Hate writing assertions? Need a little behavior-driven love in your tests? The
# matchy
"my string".should =~ /string/
lambda { raise "FAIL" }.should raise_error

* Most of familiar RSpec Matchers are built in

*raise_error
lambda {raise}.should raise_error #pass
lambda {raise MyCustomError}.should raise_error(MyCustomError) #pass
lambda {raise "message"}.should raise_error("message") #pass
lambda {raise "message"}.should raise_error(/essa/) #pass

*change
lambda {@var+=1}.should change {@var}
# passes
lambda { }.should change {@var}
# fails
@var = 1
lambda {@var+=1}.should change {@var}.from(1).to(2)
# passes

*be_something
@obj.should be_something
# passes if @obj.something? is true

* a lot more ...

* Get the speed of Test:Unit with the syntax of RSpec

* Create your own matchers

* nil_matcher (As a simple and quick example)
def_matcher :be_nil do |receiver, matcher, args|
receiver.nil?
end

nil.should be_nil # pass
nil.should_not be_nil # fails
'notnil'.should be_nil # fails
'notnil'.should_not be_nil # pass

* have(n).somethings matcher (a little bit more complex)
def_matcher :have do |receiver, matcher, args|
count = args[0]
something = matcher.msgs[0].name
actual = receiver.send(something).length
matcher.positive_msg = "Expected #{receiver} to have #{actual} #{something}, but found #{count} "
actual == count
end

class Thing
def widgets
@widgets ||= []
end
end
@thing.should have(3).widgets

== REQUIREMENTS:

* Test::Unit (you got it)

== INSTALL:

$ gem sources -a http://gems.github.com
$ sudo gem install jeremymcanally-matchy
$ sudo gem install mhennemeyer-matchy

== LICENSE:

Expand Down
22 changes: 13 additions & 9 deletions matchy.gemspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Gem::Specification.new do |s|
s.name = "matchy"
s.version = "0.1.0"
s.date = "2008-10-05"
s.name = "matchy300"
s.version = "0.2.0"
s.date = "2009-02-08"
s.summary = "RSpec-esque matchers for use in Test::Unit"
s.email = "jeremy@entp.com"
s.homepage = "http://github.com/jeremymcanally/matchy"
s.description = "Hate writing assertions? Need a little behavior-driven love in your tests? Then matchy is for you."
s.email = "mhennemeyer@gmail.com"
s.homepage = "http://github.com/mhennemeyer/matchy"
s.description = "A 300loc refactoring of Jeremy Mcanally's Matchy. Original Description: Hate writing assertions? Need a little behavior-driven love in your tests? Then matchy is for you."
s.has_rdoc = true
s.authors = ["Jeremy McAnally"]
s.authors = ["Jeremy McAnally", "Matthias Hennemeyer"]
s.files = [
"History.txt",
"Manifest.txt",
Expand All @@ -23,19 +23,23 @@ Gem::Specification.new do |s|
"config/requirements.rb",
"lib/matchy.rb",
"lib/matchy/version.rb",
"lib/matchy/expectation.rb",
"lib/matchy/modals.rb",
"lib/matchy/def_matcher.rb",
"lib/matchy/matcher_builder.rb",
"lib/matchy/built_in/enumerable_expectations.rb",
"lib/matchy/built_in/error_expectations.rb",
"lib/matchy/built_in/operator_expectations.rb",
"lib/matchy/built_in/truth_expectations.rb",
"lib/matchy/built_in/change_expectations.rb",
"setup.rb"
]

s.test_files = [
"test/test_change_expectation.rb",
"test/test_def_matcher.rb",
"test/test_enumerable_expectations.rb",
"test/test_error_expectations.rb",
"test/test_expectation_base.rb",
"test/test_matcher_builder.rb",
"test/test_operator_expectations.rb",
"test/test_truth_expectations.rb",
"test/test_modals.rb"
Expand Down

0 comments on commit 9b4f8a1

Please sign in to comment.