This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
README | ||
| |
README.rdoc | ||
| |
Rakefile | ||
| |
WTFPL-LICENSE | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | ||
| |
tasks/ | ||
| |
test/ | ||
| |
uninstall.rb |
TestRequiredAttributes
A Rails plugin to DRY up testing of required model attributes.
| Author: | Dale Campbell <dale@save-state.net> |
| Code: | github.com/Oshuma/test_required_attributes/ |
Install
Manual labor:
cd $RAILS_ROOT git submodule add git://github.com/Oshuma/test_required_attributes.git vendor/plugins/test_required_attributes git submodule init
Then to update:
git submodule update
No includes or anything else required. Just follow the example below to use in your test cases.
Example
# standard migration
class CreateGangsters < ActiveRecord::Migration
def self.up
create_table :gangsters do |t|
t.string :name
t.string :nickname
t.integer :gun_id
t.boolean :boss
t.integer :loot
end
end
def self.down; drop_table :gangsters; end
end
# standard model
class Gangster < ActiveRecord::Base
validates_presence_of :name, :boss, :loot
end
# ultra DRY unit test
class GangsterTest < ActiveSupport::TestCase
# Only pass attributes listed in the validates_presence_of call in the model.
test_required_attributes(Gangster, :name => 'Al', :boss => true, :loot => 1e10)
end
Copyright © 2008 Dale Campbell <dale@save-state.net>, released under the WTFPL license













