README.md in mongoid-minitest-0.0.2 vs README.md in mongoid-minitest-0.0.3
- old
+ new
@@ -1,17 +1,19 @@
# mongoid-minitest [![Build Status](https://secure.travis-ci.org/frodsan/mongoid-minitest.png?branch=master&.png)](http://travis-ci.org/frodsan/mongoid-minitest) [![Dependency Status](https://gemnasium.com/frodsan/mongoid-minitest.png)](https://gemnasium.com/frodsan/mongoid-minitest)
MiniTest matchers for Mongoid.
-* Compatible with Ruby >=1.9.2.
-* Tested on MiniTest 2.x
+## Requirements
+* Ruby 1.9.x
+* Mongoid 2.x
+
## Installation
Add this line to your application's Gemfile:
- gem 'mongoid-minitest'
+ gem "mongoid-minitest"
And then execute:
$ bundle
@@ -91,19 +93,21 @@
it { must have_fields(:name, :login) }
it { must have_fields(:name, :login).of_type(String) }
it { must have_fields(:name, :login).with_default_value("me") }
it { must have_fields(:name, :login).of_type(String).with_default_value("me") }
+
+ it { must have_index_for(:name) }
end
### Validation Matchers
describe Mongoid::Matchers::Validations do
subject { Person }
it { must validate_presence_of(:name) }
-
+
it { must validate_uniqueness_of(:login).case_insensitive }
it { must validate_uniqueness_of(:login).scoped_to(:site) }
it { must validate_length_of(:login).in(5..12) }
it { must validate_length_of(:login).within(5..12) }
@@ -117,10 +121,15 @@
it { must validate_format_of(:email).to_not_allow("foo_bar_com") }
it { must validate_inclusion_of(:role).to_allow("user", "admin") }
it { must validate_exclusion_of(:email).to_not_allow("foo@bar.com", "fizz@buzz.com") }
+ it { must validate_confirmation_of(:password) }
+ it { must validate_acceptance_of(:terms_of_use).accept_with("1") }
+
+ it { must validate_associated(:pets) }
+
# Testing validators custom messages
it { must validate_presence_of(:role).with_message("no role") }
it { must validate_length_of(:password).with_min(8).with_message("len >= 8") }
end
@@ -128,24 +137,28 @@
describe Mongoid::Matchers::Associations do
describe Person do
subject { Person }
- it { must have_one(:account).of_type(Account) }
+ it { must have_one(:account) }
it { must have_many(:pets).of_type(Pet) }
+ it { must have_and_belong_to_many(:friends) }
+
+ it { must embed_one(:profile) }
+ it { must embed_many(:sites) }
end
describe Pet do
subject { Pet }
- it { must belong_to(:person).of_type(Person) }
+ it { must belong_to(:person) }
end
- describe Account do
- subject { Account }
+ describe Site do
+ subject { Site }
- it { must belong_to(:person).of_type(Person) }
+ it { must embedded_in(:person) }
end
end
## Contributing
@@ -156,34 +169,9 @@
5. Create new Pull Request
## Unit Tests
To run unit tests, run `bundle exec rake` or `bundle exec guard` to run in auto mode.
-
-## License
-
-Copyright (c) 2012 Francesco Rodriguez
-
-MIT License
-
-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.
## Last words
At [EpicLabs](https://github.com/epiclabs/), We're migrating all the tests from `rspec` to `minitest`. I've been using
[mongoid-rspec gem](https://github.com/evansagge/mongoid-rspec) by [evanssage](https://github.com/evansagge).