Hi,
I just released *Minitest-Sequel* [
https://github.com/kematzy/minitest-sequel ], a collection of convenient
assertions for testing common Sequel features with Minitest.
It is still very much work in progress, so please feel free to assist in
improving or adding to this gem. *Especially if you can work out how to
test Sequel validations in Minitest.*
Any help will be gratefully received.
Included assertions are:
*- TABLE DEFINITIONS:*
-- assert_have_column()
*- ASSOCIATIONS:*
-- assert_association_one_to_one()
-- assert_association_one_to_many()
-- assert_association_many_to_one()
-- assert_association_many_to_many()
-- assert_association()
*- VALIDATIONS:* (work in progress and not working)
-- assert_validates_presence()
-- assert_validates_exact_length()
-- assert_validates_length_range()
-- assert_validates_max_length()
-- assert_validates_min_length()
-- assert_validates_format()
-- assert_validates_includes()
-- assert_validates_integer()
-- assert_validates_not_string()
-- assert_validates_numeric()
-- assert_validates_unique()
*Test Examples:*
let(:m) { Post.first }
# test model/table definition
it { assert_have_column(m, :title, { type: 'string', db_type: 'varchar(255)'
, allow_null: :false }) }
it { assert_have_column(m, :body, { type: 'string', db_type: 'text'}) }
# test model associations
it { assert_association_one_to_many(m, :comments) }
it { assert_association_many_to_one(m, :author) }
it { assert_association_many_to_many(m, :tags) }
it { assert_association_one_to_one(m, :first_comment, { class: :Commment,
order: :id }) }
*USAGE:*
$ gem install minitest-sequel
In your project's *spec_helper.rb* or *test_helper.rb* file:
require 'minitest/sequel'
require 'minitest/autorun'
## add migrations and seeds
require 'sqlite3'
DB = Sequel.sqlite # memory
Hopefully this will help someone.
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.