aiwilliams / dataset Goto Github PK
View Code? Open in Web Editor NEWAn exceptional tool for creating test data sets using ActiveRecord.
Home Page: http://aiwilliams.github.com/dataset
License: MIT License
An exceptional tool for creating test data sets using ActiveRecord.
Home Page: http://aiwilliams.github.com/dataset
License: MIT License
Using dataset erased all data from all tables in the test db. In my case, working with a legacy database that only needs to be read from, this is a Bad Thing. This monkey patch at the bottom of spec_helper.rb helps:
module Dataset
module Database # :nodoc:
# Provides Dataset a way to clear, dump and load databases.
class Base
include FileUtils
def clear
connection = ActiveRecord::Base.connection
ActiveRecord::Base.silence do
connection.tables.each do |table_name|
unless %w{table_to_keep another_table even_another_table}.include? (table_name)
puts "Emptying #{table_name}"
connection.delete "DELETE FROM #{connection.quote_table_name(table_name)}",
"Dataset::Database#clear" unless table_name == ActiveRecord::Migrator.schema_migrations_table_name
else
puts "Skipping #{table_name}"
end
end
end
end
end
end
end
It would be great to have a setting in dataset that lets me specify either which tables NOT to empty and/or which tables TO empty.
in the the README I find the following text:
The goal is to see a marked improvement in overall test run speed, basing this on the assumption that it is faster to have the OS
copy a file or mySQL dump and load. Of course, we may find this to be a false assumption, but there were plenty of bugs in the
former 'Scenarios' - addressing that afforded the opportunity to test the assumption.
Did you find answer to that assumption? I believe that the dataset approach can increase my test suite's speed greatly, but I would love to hear your experience?
Thanks a lot,
Jeroen
NB. I still have to integrate dataset into my application's test suite therefore it would be nice to get an answer on the above before i go into all the effort.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.