spec/spec_helper.rb in sinsiliux-hornsby-0.1.0 vs spec/spec_helper.rb in sinsiliux-hornsby-0.2.0
- old
+ new
@@ -1,17 +1,20 @@
require 'fileutils'
-require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
+require 'activerecord'
-plugin_spec_dir = File.dirname(__FILE__)
+spec_dir = File.dirname(__FILE__)
+Dir.chdir spec_dir
-ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
+ActiveRecord::Base.logger = Logger.new(spec_dir + "/debug.log")
-databases = YAML::load(IO.read(plugin_spec_dir + "/db/database.yml"))
-
-db_info = databases[ENV["DB"] || "sqlite3"]
-
-FileUtils::rm(RAILS_ROOT+"/"+db_info[:dbfile])
-
+databases = YAML::load(IO.read(spec_dir + "/db/database.yml"))
+db_info = databases[ENV["DB"] || "test"]
ActiveRecord::Base.establish_connection(db_info)
+load(File.join(spec_dir, "db", "schema.rb"))
-load(File.join(plugin_spec_dir, "db", "schema.rb"))
+require 'spec/autorun'
+require '../lib/hornsby'
+require 'db/fruit'
+Spec::Runner.configure do |config|
+ Hornsby.configure_rspec(config, :filename => File.join(spec_dir, 'hornsby_scenario.rb'), :scenarios => :cherry)
+end