README.md in password_strength-1.0.2 vs README.md in password_strength-1.1.0
- old
+ new
@@ -59,20 +59,36 @@
strength.valid?(:good)
#=> strength == :good or strength == :strong
```
-## ActiveRecord
+## ActiveRecord/ActiveModel
-The PasswordStrength library comes with ActiveRecord support.
+The PasswordStrength library comes with ActiveRecord/ActiveModel support.
```ruby
class Person < ActiveRecord::Base
validates_strength_of :password
end
```
+To be honest, you can use it with plain ActiveModel objects.
+
+```ruby
+class Person
+ include ActiveModel::Model
+ validates_strength_of :password
+end
+
+# or simply
+
+class Person
+ include ActiveModel::Validations
+ validates_strength_of :password
+end
+```
+
The default options are `:level => :good, :with => :username`.
If you want to compare your password against other field, you have to set the `:with` option.
```ruby
@@ -95,13 +111,11 @@
```ruby
validates_strength_of :password, :using => CustomPasswordTester
```
-Your +CustomPasswordTester+ class should override the default implementation. In practice, you're
-going to override only the +test+ method that must call one of the following methods:
-`invalid!`, `weak!`, `good!` or `strong!`.
+Your `CustomPasswordTester` class should override the default implementation. In practice, you're going to override only the `test` method that must call one of the following methods: `invalid!`, `weak!`, `good!` or `strong!`.
```ruby
class CustomPasswordTester < PasswordStrength::Base
def test
if password != "mypass"
@@ -179,9 +193,21 @@
```javascript
//= require jquery
//= require password_strength
//= require jquery_strength
```
+
+## Running tests
+
+### Ruby
+
+1. Install all dependencies with `bundle install`.
+2. Run `rake test`.
+
+### JavaScript
+
+1. Install Node.js, then run `npm install`.
+2. Open `test/password_strength_test.html` in your target browser.
## License
(The MIT License)