Displaying 20 results from an estimated 20000 matches similar to: "seeding a database"
2006 Jan 27
5
Before I write this myself, is there already an easier way?
Recently I''ve wanted to be able to take the data I''ve painstakingly
defined in my fixture files and slurp it up into my development database
so I can play with my website (locally, in development mode) with the
same data I use in my tests.
In a similar vein, I want to take the table definitions in the
development_structure.sql file and use it to re-define my development
2006 Jan 20
6
Pre-populate db with yaml outside of testing?
Hi.
What is the best way to pre-populate your database with records while
developing, not testing?
For example, I want to:
1) > [run this command to populate db]
2) > ruby script/server
3) now I can surf to localhost:3000 and my app will already have relevant
data
I''m hoping to use yaml to suck it in.
Is there a way to use the Fixture class to handle this even though this is
2005 Nov 26
4
activerecord rake test_mysql
Hi (I''m resubmitting this because
First question: This is the rails dev list, correct?
I''d like to submit a patch and am following the steps on this page:
http://dev.rubyonrails.org/
Here''s what I did (using mysql 5.0.15-nt):
created 2 databases:
activerecord_unittest
activerecord_unittest2
created 1 user: rails (giving all priveleges to both databases)
ran
2005 Nov 10
6
Manually loading fixture data
Hi all,
I''ve got some tables with fixed amounts of data in them (a "states"
table, for example). For tables like this I can easily put *all* of the
data in the fixture.
For general futzing purposes, and for those times I want to reload a
database from scratch outside of testing (for whatever reason), what''s
the best approach? I thought perhaps ActiveRecord::Base had
2006 Jun 29
14
TDD and migrations?
TDD, SVN and migrations seem to be a natural combination for model
development: create a test, add the column with a migration, write the
code, and check it all in when you''re done.
The trouble is that this ends up creating one migration per field. I guess
it''s not horrible in and of itself, but it does have a code smell to it.
Has anyone come up with a different way of doing
2006 Nov 24
7
Anyone know whats going on with PostgreSQL async_exec errors?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Anyone know what''s going on with ActiveRecord Edge and 1.2RC1 unit
tests. I get 13 failures from the "async_exec" method call. ie:
test_callback_rollback_in_save(ConcurrentTransactionTest):
ActiveRecord::StatementInvalid: NoMethodError: undefined method
`async_exec'' for #<PGconn:0xb75a8754>: SET
2006 Feb 22
15
Fixtures and Relationships
In my daily development, I migrate back and forth between versions, and
often do: rake load_fixtures...
... in order to populate my development database with fun data.
Now, with any HABTM relationship, there are failures, as there is no way to
say "which" fixtures to load first.
Within an actual functional or unit test case, you could simply load them in
the proper order, but
2006 Feb 16
2
fixtures outside of rails
Is there an easy way to use fixtures outside of a rails app? I''m using
activerecord for a project and would love to use fixtures as well, but I
haven''t found any info on doing this. I''m hoping it''s something quick
and simple someone can explain to me so I don''t have to dig through the
rails source :)
--
Posted via http://www.ruby-forum.com/.
2011 Jul 25
4
Rails 3 test database issues
I am having a problem using the test database in Rails 3. It
apparently has kept track of aspects of the database that I deleted
completely from my migrations at some point. I don''t always use the
''down'' part of a migration and sometimes just recreate the whole
database. I did rake db:migrate:reset and rake db:test:prepare, but
when I run my test it is trying to access
2008 Jun 05
3
what is proper way to load lookup/reference data into test database?
I''m just getting into writing tests for my first RoR app. I''ve got a
few data migrations to load reference data (i.e. 2-char state abbrevs,
payment types, etc.). How do I get that data into the test database?
I understand fixtures are to load test data. But if I duplicate these
lookup tables in test fixtures, it seems like that is violating the
DRY principle. Is that OK in
2005 Dec 23
2
SQLite in-memory
I left ":memory:" in database.yml for testing and the most simple
tests in the Agile book do not work (see trace below for test_truth).
Since that''s what comes with the distributed database.yml I suppose
it''s me doing something wrong.
Did someone get SQLite ":memory:" working? How does it grab the schema?
-- fxn
% rake test_units
(in
2006 Jun 24
5
Rake vs Ruby for running tests (error discrepency)
I''m having (to me) a strange problem with errors when running my tests
with rake as opposed to using ruby. If I do rake test:units I get this
error for several tests, but not all:
13) Error:
test_player_has_game_statistics_for_season(PlayerSeasonTest):
ActiveRecord::StatementInvalid: Mysql::Error: Duplicate entry ''22'' for
key 1: INSERT INTO positions (`name`, `id`,
2006 Jan 02
3
rake test_units not loading any fixtures
Hello All,
If I run my unit tests individually using Ruby, they all work correctly.
However, if I try to run them using "rake test_units", I get a bunch of
error messages.
The error messages appear to be caused by rake not loading any of the
fixtures into the test database.
I am using PostgreSQL on Windows.
Does anyone have any suggestions?
Many thanks,
Bruce.
--
Posted via
2007 Jul 22
18
db:fixtures:load order
I was trying to deal with foreign key issues related to order of
fixture loading when I came across this:
http://techpolesen.blogspot.com/2007/04/rails-fixture-tips.html
This got me looking deeper into rails and I noticed that
db:fixtures:load calls Fixtures.create_fixtures once for each fixture
file. However, Fixtures.create_fixtures is capable of taking multiple
files and also handle the
2007 Feb 14
2
File into database migration
Hi,
I am trying to figure out an approach to load in our initial data into our
database.
I have written some load_data migrations which populate a lot of the stuff,
how some of the database
items are images etc and I am trying to figure out how to approach added
them to the database
during a rake db:migrate
I am thinking if I store the files in a folder off the RAILS_ROOT I should
be able to
2006 Mar 31
1
rails + svn automation script
Anyone got a script to share that:
1. Creates a trunk directory
2. Creates a trunk/vendor directory
3. Adds the above to svn
4. Modifies trunk/vendor to use a certain rails revision (i.e. trunk or 1.1)
5. Runs trunk/vendor/rails/.../bin/rails to generate a rails directory skeleton
6. Modifies the svn:ignore for the logs and config/database.yml
7. Moves config/database.yml to
2006 Jul 24
3
Creating performance test fixtures from development db? How?
Hi all!
I''m looking into the testing chapter of Agile Web Development With Rails
(2nd ed.).
I want to performance test my app, but I''m too lazy to write fixtures for
performance test.
I''d rather use the data from my development db (because the data is so close
to the production data).
How do I get the data into the test db without writing fixtures?
Could you please
2006 Nov 25
2
RSpec 0.7.3
Hi all,
I just released RSpec 0.7.3. It''s got a few bug fixes and the rails
plugin *should* run against both Rails 1.1.6 and 1.2.0-RC1.
If you run into problems, please report bugs and feature requests in
the tracker at rubyforge:
http://rubyforge.org/tracker/?group_id=797
Cheers,
David
2007 Feb 13
16
Error against latest trunk while testing via spec for model
Hi
I just did an update to lates trunk
=================
context "Given a generated venue_spec.rb with fixtures loaded" do
fixtures :venues
specify "fixtures should load two Venues" do
Venue.should have(2).records
end
end
==================
gives me
==========
1)
TypeError in ''Given a generated venue_spec.rb with fixtures loaded
fixtures should load two
2006 Mar 27
5
Fixtures, Postgres & Constraints
Anyone have any tips for handling postgres constraints when using
fixtures to load the database, other than to sort out the proper
insertion orders or leaving the constraints out? I''d prefer not to do
the former since I''d rather use my app to generate my fixture data
(using a dump_fixtures task) and I''d prefer not to do the latter
because leaving out constraints till the