Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit f07b4de7bf3d04660f6d20dd1400cd0e886fc7c8 rsl committed Jun 5, 2008
29 .svn/all-wcprops
@@ -0,0 +1,29 @@
+K 25
+svn:wc:ra_dav:version-url
+V 41
+/svn/plugins/!svn/ver/241/memory_test_fix
+END
+Rakefile
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/plugins/!svn/ver/86/memory_test_fix/Rakefile
+END
+init.rb
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/plugins/!svn/ver/86/memory_test_fix/init.rb
+END
+about.yml
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/plugins/!svn/ver/86/memory_test_fix/about.yml
+END
+README
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/plugins/!svn/ver/186/memory_test_fix/README
+END
79 .svn/entries
@@ -0,0 +1,79 @@
+8
+
+dir
+270
+http://topfunky.net/svn/plugins/memory_test_fix
+http://topfunky.net/svn/plugins
+
+
+
+2007-08-20T16:38:00.139927Z
+241
+topfunky
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+798a5b91-ee08-0410-b43b-a734d69ea54e
+
+Rakefile
+file
+
+
+
+
+2008-02-25T19:42:44.000000Z
+4a995f459bc08fb9bf41536e1dce277d
+2006-06-01T20:55:48.227015Z
+86
+topfunky
+
+init.rb
+file
+
+
+
+
+2008-02-25T19:42:44.000000Z
+32788fec15a7a13c11869e18aff11021
+2006-06-01T20:55:48.227015Z
+86
+topfunky
+
+lib
+dir
+
+about.yml
+file
+
+
+
+
+2008-02-25T19:42:44.000000Z
+640a111855cfdeaacbdc0fbd8a2b0d2c
+2006-06-01T20:55:48.227015Z
+86
+topfunky
+
+README
+file
+
+
+
+
+2008-02-25T19:42:44.000000Z
+28484ba20ae5c2c2265333e1bc45a9f9
+2007-03-08T16:38:17.510908Z
+186
+topfunky
+
1 .svn/format
@@ -0,0 +1 @@
+8
35 .svn/text-base/README.svn-base
@@ -0,0 +1,35 @@
+MemoryTestFix
+=============
+
+A simple fix to run tests with sqlite. From example at
+
+http://blog.seagul.co.uk/articles/2006/02/08/in-memory-sqlite-database-for-rails-testing
+
+In your database.yml, use
+
+ test:
+ adapter: sqlite3
+ database: ":memory:"
+
+It runs much faster!
+
+You can also adjust the verbosity of the output:
+
+test:
+ adapter: sqlite3
+ database: ":memory:"
+ verbosity: silent
+
+== Authors
+
+Chris Roos
+
+Adapted by Geoffrey Grosenbach, http://nubyonrails.com
+
+Verbosity patch by Kakutani Shintaro
+
+== Changelog
+
+* Updated to look for either so it works with Rails 1.2 and also older versions
+* Updated to use ActiveRecord::ConnectionAdapters::SQLite3Adapter for Rails 1.2
+
22 .svn/text-base/Rakefile.svn-base
@@ -0,0 +1,22 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the memory_test_fix plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the memory_test_fix plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'MemoryTestFix'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
7 .svn/text-base/about.yml.svn-base
@@ -0,0 +1,7 @@
+author: Chris Roos
+summary: Makes SQLite3 memory tests possible by preloading the schema.
+homepage: http://blog.seagul.co.uk/articles/2006/02/08/in-memory-sqlite-database-for-rails-testing
+plugin: http://topfunky.net/svn/plugins/memory_test_fix
+license: MIT
+version: 0.1
+rails_version: 1.1+
2 .svn/text-base/init.rb.svn-base
@@ -0,0 +1,2 @@
+
+require 'memory_test_fix'
35 README
@@ -0,0 +1,35 @@
+MemoryTestFix
+=============
+
+A simple fix to run tests with sqlite. From example at
+
+http://blog.seagul.co.uk/articles/2006/02/08/in-memory-sqlite-database-for-rails-testing
+
+In your database.yml, use
+
+ test:
+ adapter: sqlite3
+ database: ":memory:"
+
+It runs much faster!
+
+You can also adjust the verbosity of the output:
+
+test:
+ adapter: sqlite3
+ database: ":memory:"
+ verbosity: silent
+
+== Authors
+
+Chris Roos
+
+Adapted by Geoffrey Grosenbach, http://nubyonrails.com
+
+Verbosity patch by Kakutani Shintaro
+
+== Changelog
+
+* Updated to look for either so it works with Rails 1.2 and also older versions
+* Updated to use ActiveRecord::ConnectionAdapters::SQLite3Adapter for Rails 1.2
+
22 Rakefile
@@ -0,0 +1,22 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the memory_test_fix plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the memory_test_fix plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'MemoryTestFix'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
7 about.yml
@@ -0,0 +1,7 @@
+author: Chris Roos
+summary: Makes SQLite3 memory tests possible by preloading the schema.
+homepage: http://blog.seagul.co.uk/articles/2006/02/08/in-memory-sqlite-database-for-rails-testing
+plugin: http://topfunky.net/svn/plugins/memory_test_fix
+license: MIT
+version: 0.1
+rails_version: 1.1+
2 init.rb
@@ -0,0 +1,2 @@
+
+require 'memory_test_fix'
11 lib/.svn/all-wcprops
@@ -0,0 +1,11 @@
+K 25
+svn:wc:ra_dav:version-url
+V 45
+/svn/plugins/!svn/ver/241/memory_test_fix/lib
+END
+memory_test_fix.rb
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svn/plugins/!svn/ver/241/memory_test_fix/lib/memory_test_fix.rb
+END
40 lib/.svn/entries
@@ -0,0 +1,40 @@
+8
+
+dir
+270
+http://topfunky.net/svn/plugins/memory_test_fix/lib
+http://topfunky.net/svn/plugins
+
+
+
+2007-08-20T16:38:00.139927Z
+241
+topfunky
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+798a5b91-ee08-0410-b43b-a734d69ea54e
+
+memory_test_fix.rb
+file
+
+
+
+
+2008-02-25T19:42:44.000000Z
+b164a6808322093743610c30e85f5962
+2007-08-20T16:38:00.139927Z
+241
+topfunky
+
1 lib/.svn/format
@@ -0,0 +1 @@
+8
44 lib/.svn/text-base/memory_test_fix.rb.svn-base
@@ -0,0 +1,44 @@
+
+# Update: Looks for the SQLite and SQLite3 adapters for
+# compatibility with Rails 1.2.2 and also older versions.
+def in_memory_database?
+ if ENV["RAILS_ENV"] == "test" and
+ (Rails::Configuration.new.database_configuration['test']['database'] == ':memory:' or
+ Rails::Configuration.new.database_configuration['test']['dbfile'] == ':memory:')
+ begin
+ if ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLite3Adapter
+ return true
+ end
+ rescue NameError => e
+ if ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLiteAdapter
+ return true
+ end
+ end
+ end
+ false
+end
+
+def verbosity
+ Rails::Configuration.new.database_configuration['test']['verbosity']
+end
+
+def inform_using_in_memory
+ puts "Creating sqlite :memory: database"
+end
+
+if in_memory_database?
+ load_schema = lambda {
+ load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
+ # ActiveRecord::Migrator.up('db/migrate') # use migrations
+ }
+ case verbosity
+ when "silent"
+ silence_stream(STDOUT, &load_schema)
+ when "quiet"
+ inform_using_in_memory
+ silence_stream(STDOUT, &load_schema)
+ else
+ inform_using_in_memory
+ load_schema.call
+ end
+end
44 lib/memory_test_fix.rb
@@ -0,0 +1,44 @@
+
+# Update: Looks for the SQLite and SQLite3 adapters for
+# compatibility with Rails 1.2.2 and also older versions.
+def in_memory_database?
+ if ENV["RAILS_ENV"] == "test" and
+ (Rails::Configuration.new.database_configuration['test']['database'] == ':memory:' or
+ Rails::Configuration.new.database_configuration['test']['dbfile'] == ':memory:')
+ begin
+ if ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLite3Adapter
+ return true
+ end
+ rescue NameError => e
+ if ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLiteAdapter
+ return true
+ end
+ end
+ end
+ false
+end
+
+def verbosity
+ Rails::Configuration.new.database_configuration['test']['verbosity']
+end
+
+def inform_using_in_memory
+ puts "Creating sqlite :memory: database"
+end
+
+if in_memory_database?
+ load_schema = lambda {
+ load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
+ # ActiveRecord::Migrator.up('db/migrate') # use migrations
+ }
+ case verbosity
+ when "silent"
+ silence_stream(STDOUT, &load_schema)
+ when "quiet"
+ inform_using_in_memory
+ silence_stream(STDOUT, &load_schema)
+ else
+ inform_using_in_memory
+ load_schema.call
+ end
+end

0 comments on commit f07b4de

Please sign in to comment.