Permalink
Browse files

General cleanup. Startup Merb environment for specs

  • Loading branch information...
1 parent cfc379b commit 251b8803dce2f7784ddd69a342ae9ac9f1d7ff4c Lori Holden committed Dec 22, 2008
@@ -1,20 +1,4 @@
-$:.push File.join(File.dirname(__FILE__), '..', 'lib')
-require 'rubygems'
-require 'merb-core'
-require 'merb-core/test'
-require 'merb-core/test/helpers'
-
-Merb::BootLoader.before_app_loads do
- require 'sequel'
- DB = Sequel.sqlite
- require "merb/session/sequel_session"
-end
-
-Merb.start :environment => 'test', :adapter => 'runner', :session_store => 'sequel'
-
-Spec::Runner.configure do |config|
- config.include Merb::Test::RequestHelper
-end
+require File.dirname(__FILE__) + "/spec_helper"
# # Load up the shared specs from merb-core
# if (gem_spec = Gem.source_index.search(Gem::Dependency.new('merb-core', '>=0.9.6')).last) &&
@@ -1,7 +1,7 @@
require File.dirname(__FILE__) + "/spec_helper"
describe 'Sequel::Model#new_record?' do
- it_should_behave_like "having a spec model"
+ it_should_behave_like "it has a SpecModel"
it "is defined" do
SpecModel.instance_methods.should include 'new_record?'
@@ -1,13 +1,34 @@
$:.push File.join(File.dirname(__FILE__), "..", "lib")
require 'rubygems'
require 'spec'
+require 'sequel'
require 'merb-core'
require 'merb-core/test'
require 'merb-core/test/helpers'
+require "merb/session/sequel_session"
require File.join( File.dirname(__FILE__), "..", "lib", 'merb_sequel')
-require 'sequel'
-DB = Sequel.sqlite
+module Merb
+ module Orms
+ module Sequel
+ class << self
+ def connect
+ ::Sequel.connect(:adapter => 'sqlite')
+ end
+ end
+ end
+ end
+end
+
+Merb.start :environment => 'test', :adapter => 'runner', :session_store => 'sequel'
+
+Spec::Runner.configure do |config|
+ config.include Merb::Test::RequestHelper
+end
+
+
+class SpecModel < Sequel::Model
+end
class CreateSpecModel < Sequel::Migration
def up
@@ -22,16 +43,15 @@ def down
end
end
-describe "having a spec model", :shared => true do
+describe "it has a SpecModel", :shared => true do
before(:each) do
- CreateSpecModel.apply(DB, :up)
+ CreateSpecModel.apply(SpecModel.db, :up)
end
after(:each) do
- CreateSpecModel.apply(DB, :down)
+ CreateSpecModel.apply(SpecModel.db, :down)
end
end
-class SpecModel < Sequel::Model
- set_dataset DB[:spec_models]
-end
+
+

0 comments on commit 251b880

Please sign in to comment.