Browse files

Use markdown in README + minor updates

  • Loading branch information...
1 parent ddc8ae5 commit 92f9b32f7ff107f203663ddd73d8b882f5461311 @wojtekmach committed Mar 5, 2012
Showing with 146 additions and 127 deletions.
  1. +1 −1 Manifest.txt
  2. +145 −0 README.md
  3. +0 −126 README.txt
View
2 Manifest.txt
@@ -1,7 +1,7 @@
.autotest
History.txt
Manifest.txt
-README.txt
+README.md
Rakefile
lib/minitest/matchers.rb
lib/minitest-matchers.rb
View
145 README.md
@@ -0,0 +1,145 @@
+# minitest-matchers
+
+http://github.com/zenspider/minitest-matchers
+
+## Description
+
+minitest-matchers adds support for RSpec/Shoulda-style matchers to
+minitest/unit and minitest/spec.
+
+More information about matchers can be found here:
+
+* https://www.relishapp.com/rspec/rspec-expectations
+* http://railscasts.com/episodes/157-rspec-matchers-macros
+
+For use with Rails check out (ValidAttribute + Capybara):
+
+* https://github.com/wojtekmach/minitest-rails-example
+
+## Features/Problems
+
+* Enables you to use existing matcher classes from projects like
+ valid\_attribute and in the future shoulda-matchers and maybe even remarkable.
+* Can be used both in MiniTest::Unit::TestCase & MiniTest::Spec
+
+## Synopsis
+
+see example matcher: https://github.com/bcardarella/valid\_attribute/blob/master/lib/valid\_attribute/matcher.rb
+
+```ruby
+require "minitest/matchers"
+require "minitest/autorun"
+require "valid_attribute"
+require "active_model"
+
+class Post
+ include ActiveModel::Validations
+ attr_accessor :title
+ validates :title, :presence => true, :length => 4..20
+end
+
+# Using minitest/unit
+
+class PostTest < MiniTest::Unit::TestCase
+ include ValidAttribute::Method
+
+ def test_validations
+ post = Post.new
+
+ assert_must have_valid(:title).when("Good"), post
+ assert_wont have_valid(:title).when(""), post
+ end
+end
+
+# Using minitest/spec
+
+describe Post do
+ include ValidAttribute::Method
+
+ it "should have validations" do
+ post = Post.new
+
+ post.must have_valid(:title).when("Good")
+ post.wont have_valid(:title).when("")
+ end
+end
+
+# Using minitest/spec with subject
+
+describe Post do
+ subject { Post.new }
+
+ it { must have_valid(:title).when("Hello") }
+ it { wont have_valid(:title).when("", nil, "Bad") }
+end
+
+# or
+
+describe Post do
+ subject { Post.new }
+
+ must { have_valid(:title).when("Hello") }
+ wont { have_valid(:title).when("", nil, "Bad") }
+end
+```
+
+You can also register matcher so that it works similar to built-in
+assertions and expectations. Note subject must be the first argument in assertion.
+
+```ruby
+MiniTest::Unit::TestCase.register_matcher HaveContent, :have_content
+MiniTest::Unit::TestCase.register_matcher :have_selector, :have_selector
+
+assert_have_content page, "Hello"
+assert_have_selector page, :xpath, "//table/tr"
+
+page.must_have_content "Hello"
+page.must_have_selector :xpath, "//table/tr"
+```
+
+## Requirements
+
+* minitest >= 2.7.0
+
+## Install
+
+* Run:
+
+ ```
+[sudo] gem install minitest-matchers
+```
+
+or
+
+* add to Gemfile:
+
+```ruby
+group :test do
+ gem 'minitest-matchers'
+end
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) Ryan Davis, seattle.rb, Wojciech Mach
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
126 README.txt
@@ -1,126 +0,0 @@
-= minitest-matchers
-
-* http://github.com/zenspider/minitest-matchers
-
-== DESCRIPTION:
-
-minitest-matchers adds support for RSpec/Shoulda-style matchers to
-minitest/unit and minitest/spec.
-
-More information about matchers can be found here:
-* https://www.relishapp.com/rspec/rspec-expectations
-* http://railscasts.com/episodes/157-rspec-matchers-macros
-
-For use with Rails check out (ValidAttribute + Capybara):
-* https://github.com/wojtekmach/minitest-rails-example
-
-== FEATURES/PROBLEMS:
-
-* Enables you to use existing matcher classes from projects like
- valid_attribute and in the future shoulda-matchers and maybe even remarkable.
-* Can be used both in MiniTest::Unit::TestCase & MiniTest::Spec
-
-== SYNOPSIS:
-
-* see example matcher: https://github.com/bcardarella/valid_attribute/blob/master/lib/valid_attribute/matcher.rb
-
- gem "minitest"
- require "minitest/matchers"
- require "minitest/autorun"
- require "valid_attribute"
- require "active_model"
-
- class Post
- include ActiveModel::Validations
- attr_accessor :title
- validates :title, :presence => true, :length => 4..20
- end
-
- # Using minitest/unit
-
- class PostTest < MiniTest::Unit::TestCase
- include ValidAttribute::Method
-
- def test_validations
- post = Post.new
-
- assert_must have_valid(:title).when("Good"), post
- assert_wont have_valid(:title).when(""), post
- end
- end
-
- # Using minitest/spec
-
- describe Post do
- include ValidAttribute::Method
-
- it "should have validations" do
- post = Post.new
-
- post.must have_valid(:title).when("Good")
- post.wont have_valid(:title).when("")
- end
- end
-
- # Using minitest/spec with subject
-
- describe Post do
- subject { Post.new }
-
- it { must have_valid(:title).when("Hello") }
- it { wont have_valid(:title).when("", nil, "Bad") }
- end
-
- # or
-
- describe Post do
- subject { Post.new }
-
- must { have_valid(:title).when("Hello") }
- wont { have_valid(:title).when("", nil, "Bad") }
- end
-
-You can also register matcher so that it works similar to built-in
-assertions and expectations. Note subject must be the first argument in assertion.
-
- MiniTest::Unit::TestCase.register_matcher HaveContent, :have_content
- MiniTest::Unit::TestCase.register_matcher :have_selector, :have_selector
-
- assert_have_content page, "Hello"
- assert_Have_selector page, :xpath, "//table/tr"
-
- page.must_have_content "Hello"
- page.must_Have_selector :xpath, "//table/tr"
-
-== REQUIREMENTS:
-
-* minitest >= 2.7.0
-
-== INSTALL:
-
-* sudo gem install minitest-matchers
-
-== LICENSE:
-
-(The MIT License)
-
-Copyright (c) Ryan Davis, seattle.rb, Wojciech Mach
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 comments on commit 92f9b32

Please sign in to comment.