Sha256: 490016383222f6ada4b8424f3348ba69388c3fddacf5f0c7fdf08f48f2f8a366
Contents?: true
Size: 855 Bytes
Versions: 6
Compression:
Stored size: 855 Bytes
Contents
require "rubygems" require "sequel" require "contest" require File.dirname(__FILE__) + "/../lib/spawn" require "faker" DB = Sequel.sqlite DB << "CREATE TABLE sequel_users (name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL)" class SequelUser < Sequel::Model extend Spawn validates do presence_of :name end spawner do |user| user.name = Faker::Name.name user.email = Faker::Internet.email end end class TestSpawnWithSequel < Test::Unit::TestCase setup do @user = SequelUser.spawn :name => "John" end context "spawned user" do should "have John as name" do assert_equal "John", @user.name end context "with invalid attributes" do should "raise an error" do assert_raise Sequel::Error::InvalidValue do SequelUser.spawn :name => nil end end end end end
Version data entries
6 entries across 6 versions & 2 rubygems