RSpec::Sequel
Sometimes migrations are less than trivial, especially when they need to transform data instead of just reshaping the database. That makes one justifiably uneasy when it comes to running them; the comfort provided by unit tests wasn't usually present or easy to attain. Until now!
Installation
Add this line to your application's Gemfile:
gem 'rspec-sequel'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-sequel
Usage
$ cat spec/migrations/create_users_spec.rb
require 'spec_helper'
describe 'db/migrations/001_create_users.rb' do
it "creates the users table" do
migrate! :up
db.table_exists?(:users).should be_true
migrate! :down
db.table_exists?(:users).should be_false
end
end
Credits
spec/support/{matchers,helpers}.rb
originally come from rspec-rails.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request