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 (
commit e80ffb556c934f9806623898ad59684f1e8ee53d
tree a3f090e58720b3b73ecee0ffdada76a74796b73e
parent 0ed320c910719926d007e04e811fabc16933085b
tree a3f090e58720b3b73ecee0ffdada76a74796b73e
parent 0ed320c910719926d007e04e811fabc16933085b
remarkable / remarkable_activerecord
| name | age | message | |
|---|---|---|---|
| .. | |||
| |
CHANGELOG | Tue Aug 25 06:15:39 -0700 2009 | |
| |
LICENSE | Thu Mar 26 03:09:11 -0700 2009 | |
| |
README | Thu May 28 01:59:11 -0700 2009 | |
| |
Rakefile | Tue Sep 08 02:08:27 -0700 2009 | |
| |
lib/ | Tue Sep 08 02:08:27 -0700 2009 | |
| |
locale/ | Thu Jul 16 10:25:18 -0700 2009 | |
| |
spec/ | Tue Sep 08 02:08:27 -0700 2009 |
remarkable_activerecord/README
= Remarkable ActiveRecord
Remarkable ActiveRecord is a collection of matchers to ActiveRecord. Why use
Remarkable?
* Matchers for all ActiveRecord validations, with support to all options. The only
exceptions are validate_format_of (which should be invoked as allow_values_for)
and the :on option;
* Matchers for all ActiveRecord associations. The only one which supports all
these options:
:through, :source, :source_type, :class_name, :foreign_key, :dependent,
:join_table, :uniq, :readonly, :validate, :autosave, :counter_cache, :polymorphic
Plus SQL options:
:select, :conditions, :include, :group, :having, :order, :limit, :offset
Besides in Remarkable 3.0 matchers became much smarter. Whenever :join_table
or :through is given as option, it checks if the given table exists. Whenever
:foreign_key or :counter_cache is given, it checks if the given column exists;
* Tests and more tests. We have a huge tests suite ready to run and tested in
ActiveRecord 2.1.2, 2.2.2 and 2.3.2;
* Great documentation;
* I18n.
== Examples
All Remarkable macros can be accessed in two different ways. For those who prefer the Shoulda style, let’s look at so
me model tests:
describe Post do
should_belong_to :user
should_have_many :comments
should_have_and_belong_to_many :tags
should_validate_presence_of :body
should_validate_presence_of :title
should_validate_uniqueness_of :title, :allow_blank => true
end
For those who likes more the Rspec way can simply do:
describe Post do
it { should belong_to(:user) }
it { should have_many(:comments) }
it { should have_and_belong_to_many(:tags) }
it { should validate_presence_of(:body) }
it { should validate_presence_of(:title) }
it { should validate_uniqueness_of(:title, :allow_blank => true) }
end
== I18n
All matchers come with I18n support. If you want to translate your matchers,
grab make a copy of locale/en.yml and start to translate it.
Then add your new locale file to Remarkable:
Remarkable.add_locale 'path/to/my_locale.yml'
And then:
Remarkable.locale = :my_locale
== Using it outside Rails
If you want to use Remarkable ActiveRecord outside Rails, you have to remember
a few things:
1. Internationalization is powered by the I18n gem. If you are using it with Rails,
it will use the built in gem, otherwise you will have to install the gem by hand:
gem sources -a http://gems.github.com
sudo gem install svenfuchs-i18n
2. Include the matchers. Remarkable Rails gem is the responsable to add
ActiveRecord matchers to rspec. If you are not using it, you have to do:
Remarkable.include_matchers!(Remarkable::ActiveRecord, Spec::Example::ExampleGroup)
This will make ActiveRecord matchers available in all rspec example groups.








