Skip to content

Instantly share code, notes, and snippets.

@jeremyevans
Forked from nelsnelson/example.rb
Created March 21, 2011 18:09
Show Gist options
  • Save jeremyevans/879901 to your computer and use it in GitHub Desktop.
Save jeremyevans/879901 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
require 'rubygems'
require 'sequel'
# Setup schema correctly
TestDatabase.down
TestDatabase.up
TestSetup.down
TestSetup.up
# Define models
class Test < Sequel::Model
end
# Test code
class TestSomeDatabaseRoutines
def setup
# Rebuild schema
TestDatabase.down
TestDatabase.up
TestSetup.down
TestSetup.up
end
def test_create
a = Test.create(:name => 'Hello!')
assert(a != nil and a.name == 'Hello!')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment