similar to: data fixtures for non-activerecord models

Displaying 20 results from an estimated 9000 matches similar to: "data fixtures for non-activerecord models"

2006 Apr 27
0
Intergration testing with ordered fixtures
Hi all. I have a question on accessing fixtures by name. I''m doing integration testing very similar to what is described in Jamis''s excellent writeup at http://jamis.jamisbuck.org/articles/2006/03/09/integration-testing-in-rails-1-1. The problem is that I am using ordered yml fixtures so that rake loads each element in the correct sequence. I need to do this because my
2006 Feb 21
0
How do you order fixtures within each yml file?
Hi. I''ve come across the following documentation: Note that YAML fixtures are unordered. If you want ordered fixtures, use the omap YAML type. See yaml.org/type/omap.html for the specification. You will need ordered fixtures when you have foreign key constraints on keys in the same table. This is commonly needed for tree structures. Example: --- !omap - parent: id:
2011 Dec 25
1
Fixtures vs Fixture class, what is the intended purpose?
Hello, i am trying to fix the code for fixtures in rails because it is buggy and internal variable names are confusing, could somebody please explain to me what is the intended purpose of Fixture and Fixtures classes respectively? For example, why do we need both `Fixtures.initialize`and `Fixture.initialize`? They both "initialize" a single fixture, and in fact `Fixture.initialize`
2006 May 09
2
load fixtures
I''m finally getting beyond using basic test fixtures, and a few questions have popped up. Has anyone found ways to do these? 1. Use a test fixture that is named differently from its table name? We''d like to have more than one possible fixture per table. (Or perhaps use test fixtures named similarly but in different directories.) 2. Load a test fixture for one test method only
2006 May 23
2
Putting fixtures into subdirectories
I want to organize my fixtures just like the namespace of my models. So for example if I have a model Company::Employee I''d like the fixture to be in fixtures/company/employees.yml. However, I can''t figure out how to specify the path of the fixture file. If I do: fixtures :employees in my unit test it can''t find the fixture file. Any suggestions? Thanks, Todd
2005 Dec 12
2
Using a lib in YAML fixtures
I''m using the runt library [1] to do some temporal expression matching. I want to keep the expression in a binary field in my db. I figured that then in order to do the fixtures, I''d need to do some erb in the yaml file. So I came up with this: onetime: id: 1 name: One Time description: This event occurs only one time. timex: <%= REYear.new(7) & REMonth.new(24)
2006 Aug 03
2
Including ALL fixtures for a test
I am running into some issues with my functional tests because they need info from almost every single table in the database. I have long laundry lists of fixture names to include on these test files and then I have to troubleshooot bizarre test failures because of a fixture that was not included. So is there a way to simply include all fixtures in a test? Something like: fixtures :all
2007 Nov 05
0
loading fixtures into oracle
Any idea why this fixture would fail to load any data? <% %w( Admin Pharmacist PI/Co-PI Research\ Nurse ).each { |g| Group.create( :name => g ) } %> It works perfectly in irb but when I do rake db:fixtures:load I get no data, no errors, and no error logs. I realize my fixture doesn''t look like your typical run-of-the-mill fixture but it''s that way because I''m
2006 Mar 20
2
Testing Models And Fixtures
I have finally decided to look into testing and I am going through the examples in the AWDWR book and I tried the following and it does not work... even though I don''t see why it shouldn''t. =========== posts.yml =========== basic_post: id: 1 title: Title body: Body created_at: 2006-02-01 00:00:00 updated_at: 2006_02-02 00:00:00
2006 Apr 12
0
fixtures advanced question
Hello, in my database i have tables models,marques,cars. I wrote fixtures for models f1: id: 1 marque_id: 1 name: 100 NX f2: id: 2 marque_id: 1 name: 200 SX f3: id: 3 marque_id: 1 name: Almera f4: id: 4 marque_id: 1 name: Patrol f5: id: 5 marque_id: 1 name: Primera f6: id: 6 marque_id: 2 name: CLK f7: id: 7 marque_id: 2 name: CLS f8: id: 8 marque_id:
2006 Jul 26
1
fixtures not loading when running rake test - ok other times
Hallo -- I have the most bizzare problem. I have a test called PropertyTest that runs absolutely fine. Even if I totally clear the test database before running it, it happily scoots off, loads all necessary fixtures, runs & passes all tests. My problem arises when I run rake test:units. Then, all other tests pass fine, but this one starts failing as if the fixture data simply
2006 Jul 18
1
Fixtures Max Size? SystemStackError: stack level too deep
Hello, I have a table of zipcodes that I am using in my application, so there are approximately 50,000 rows in this table. I have dumped the table to a fixture yaml file to represent this data, but when I try to load it, I get this error: SystemStackError: stack level too deep Is there a max size allowed for a fixture file..? Here is the --trace output: rake db:fixtures:load --trace **
2006 Jan 06
4
Design flaw with Fixtures?
I''ve been trying to add unit testing for collection of models with complex relationships -- and failing miserably. Because of the complexity of the relationships, I''m using a database which validates foreign key constraints (PostgreSQL 8). I''m finding it nearly impossible to generate tests that are independent of each other. The basic problem is the DELETE then
2006 Jul 31
0
using Class#Find in dynamic fixtures
Hi, I am currently coding my tests and I made a lot of fixture files. To make everything simple (I thought), I didnt put the ID in the fixture, insted when I needed to put the id of something, I used Class.find_by_name "name of the item to find". When I use the file to import data in my migration everything is fine. But when I use the same files for my unit test, there is a
2006 May 30
7
Stripping HTML tags from a string
Hello, Is there a common way of stripping html tags from a string? Right now I''m just calling gsub!(/<.*?>/, ''''), but with a background in PHP and always having used its strip_tags() method, I wonder if the Rails community has standardized this fairly common task with something a bit less simpleminded than my quick fix. Thanks! Zack -------------- next part
2006 Apr 28
2
Accessing fixtures from unit tests
I have set up some fixtures in test/fixtures/users.xml: # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html admin: id: 1 username: admin password: admin pbarry: id: 2 username: pbarry I have a unit test for my user model: require File.dirname(__FILE__) + ''/../test_helper'' class UserTest < Test::Unit::TestCase fixtures :users def
2007 May 21
2
Rails'' fixtures suck! But what about something like this?
Sorry about the very long email, but this is a hairy topic that''s been annoying me for some time and I decided to try to do something about. Also, if you got this twice, I apologize too, but it didn''t seem to have successfully gone out the first time. Background: ---------- I''ve been dealing with Rails for about a year and a half now. I''ve been using
2010 Jun 03
2
creating fixtures for has_many :through
I''m stymied at how to create a fixture that establishes a has_many :through relationship. I''ve watched the railscast at: http://media.railscasts.com/videos/081_fixtures_in_rails_2.mov ... but that''s for HABTM relationships. I''ve read: http://www.ruby-forum.com/topic/145676 but that ultimately doesn''t answer any question. So with no further ado:
2006 Jul 10
1
rake db:fixtures:load FIXTURES=xyz
I am attempting to do selective fixture loading against my test database. When I run rake db:fixtures:load FIXTURES=DataSetInfo I get no output. (A full trace is below). I''m trying to figure out why nothing happens. 1) Does the command above attempt to operate against my test database? 2) DataSetInfo is the name of my table and the name of my yml file I generated these YAML
2005 Oct 27
2
Fixtures are not loading into instance variables. Why not?
Hi, I have a fixture in a unit test and I see that the fixture is loaded correctly into the database table, but no instance variables are created. So now I''m stuck. More background: this is my first RoR project and I have just installed the SaltedLoginGenerator and generated its output. Running the unit tests gives an error, so I cut it down to just 1 test: