Permalink
Browse files

remove this crazy install script and pretty-up the readme

  • Loading branch information...
grosser committed Mar 27, 2010
1 parent 510fe9b commit 7d3d524ba9c73004b45bf4c6131600b5a4eb77a1
Showing with 12 additions and 49 deletions.
  1. +9 −19 README.markdown
  2. +0 −27 install.rb
  3. +3 −3 spec/valid_attributes_spec.rb
View
@@ -1,25 +1,15 @@
-PROBLEM
-=======
- - fixtures are not maintainable
- - validation change, tests/code breaks
- - forms need to be filled with valid attributes
-
-
-SOLUTION
-========
- - simple and robust validation testing `User.email expected to be invalid when set to <xx@yy>`
- - create a valid record without fixtures
- - create edge-case records without fixtures
- - use valid attributes to test a post or fill a form
-
+ - validation testing `User.email expected to be invalid when set to <xx@yy>`
+ - 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`
+ script/plugin install git://github.com/grosser/valid_attributes.git
-Fill the `test/valid_attributes.yml` with 1 valid set of attributes per model
-(can be `attr_protected` or not-`attr_accessible`)
-Example:
+Fill `test/valid_attributes.yml` (or spec) with 1 valid set of attributes per model
user:
name: Hans
@@ -40,7 +30,7 @@ When using `Test::Unit`: add to `test/test_helper.rb`
USAGE
=====
- - `assert_invalid_attributes(User, :email=>[nil,'s','@','asd@sdf'], :name=>[nil,'x','admin'])`
+ - `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`
View
@@ -1,27 +0,0 @@
-def recursive_mk_dir(path)
- require 'fileutils'
- FileUtils.mkdir_p(path)
-end
-
-#load Grosser::Valid
-#make the normal init.rb useable
-here = __FILE__
-4.times{here = File.dirname(here)}
-RAILS_ROOT = here
-RAILS_ENV='test'
-require File.join(File.dirname(__FILE__),'init')
-
-path = Grosser::Valid.path_to_valid_yml
-unless File.exist?(path)
- recursive_mk_dir File.dirname(path)
- File.open(path,'w') do |f|
- f.puts 'User'
- f.puts ' name: Hans'
- f.puts ' login: hans'
- f.puts ' fill_out: the rest...'
- end
-
- puts "Created: #{path}"
-else
- puts "Exists: #{path}"
-end
@@ -1,7 +1,7 @@
-require File.expand_path("spec_helper", File.dirname(__FILE__))
+require "spec/spec_helper"
-VALID_ATTRIBUTES_YML = File.join(File.dirname(__FILE__),'valid_attributes.yml')
-ValidAttributesHelper.stored_valid_attributes = YAML.load(IO.read(VALID_ATTRIBUTES_YML))
+VALID_ATTRIBUTES_YML = 'spec/valid_attributes.yml'
+ValidAttributesHelper.stored_valid_attributes = YAML.load(File.read(VALID_ATTRIBUTES_YML))
describe ValidAttributes do
include ValidAttributes

0 comments on commit 7d3d524

Please sign in to comment.