public
Description: Plugin generator that uses RSpec stubs instead of Test::Unit. Also sets up database connections for testing against an isolated database.
Homepage: http://evang.eli.st/blog/2007/4/4/rspec_plugin-generator
Clone URL: git://github.com/pat-maddox/rspec-plugin-generator.git
pat-maddox (author)
Mon May 05 18:41:24 -0700 2008
commit  86d8cf199b3a92e8b3dd0a83cb2a998ea75dc1b7
tree    2a0833ae52980f8d7bbfcf02c350018504709e94
parent  1f36ebc396fb266298d2e41f73478793626985dc parent  44fe6fd1084a1caf3561c67bc1a7b662389582e8
100644 15 lines (13 sloc) 0.497 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
begin
  require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
rescue LoadError
  puts "You need to install rspec in your base app"
  exit
end
 
plugin_spec_dir = File.dirname(__FILE__)
ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
 
<% if with_database -%>
databases = YAML::load(IO.read(plugin_spec_dir + "/db/database.yml"))
ActiveRecord::Base.establish_connection(databases[ENV["DB"] || "sqlite3"])
load(File.join(plugin_spec_dir, "db", "schema.rb"))
<% end %>