Permalink
Browse files

more readme changes, and link to factory girl

  • Loading branch information...
1 parent 7d3d524 commit 0410f37dff8df31a99c84dc343cdd361815af126 @grosser committed Mar 27, 2010
Showing with 16 additions and 11 deletions.
  1. +16 −11 README.markdown
View
@@ -1,45 +1,50 @@
- - validation testing `User.email expected to be invalid when set to <xx@yy>`
+Simple validation testing.
+ assert_invalid_attributes(User, :email => [nil, 's', '@', 'asd@sdf'], :name => [nil, 'x', 'admin'])
+ User.email expected to be invalid when set to <asd@sdf>`
+
+Additionally: ([Factory Girl](http://github.com/thoughtbot/factory_girl) can do some of these things better...):
+
+ - guard non-model tests from validation changes
- valid attributes to test a controller :post or fill a form (integration tests / cucumber)
- create a valid record
- create edge-case records
- fixture replacement
- - guards non-model test-code from validation changes
INSTALL
=======
script/plugin install git://github.com/grosser/valid_attributes.git
-Fill `test/valid_attributes.yml` (or spec) with 1 valid set of attributes per model
+Fill `test/valid_attributes.yml` or `spec/valid_attributes.yml` with 1 valid set of attributes per model
user:
name: Hans
login: hand
address_id: 1
-When using Rspec: add to `spec/spec_helper.rb`:
+### Test::Unit
+
+ # test/test_helper.rb
+ include ValidAttributes
+### RSpec
+ # spec/spec_helper.rb
Spec::Runner.configure do |config|
...
config.include(ValidAttributes)
...
end
-When using `Test::Unit`: add to `test/test_helper.rb`
-
- include ValidAttributes
-
USAGE
=====
- `assert_invalid_attributes(User, :email => [nil, 's', '@', 'asd@sdf'], :name => [nil, 'x', 'admin'])`
- set of valid attributes: `valid_attributes User`
- a valid Record(new): `valid User`
- a valid Record(saved): `create_valid User`
- - an edge-case User: `valid User, :name=>'oh noo it is too long'`
+ - custom attributes: `valid User, :name=>'oh noo it is too long'`
-
AUTHOR
======
Michael Grosser
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...
-[Original `assert_invalid`](http://www.railsforum.com/viewtopic.php?id=741)
+Derived from [`assert_invalid`](http://www.railsforum.com/viewtopic.php?id=741)

0 comments on commit 0410f37

Please sign in to comment.