similar to: Load a fixture manually in setup?

Displaying 20 results from an estimated 90000 matches similar to: "Load a fixture manually in setup?"

2006 Jun 08
4
datetime fixture format for Mysql 5.0
Hi All: I develop on several machines, most have Mysql 4.* and one has Mysql 5.0. On 4.*, the following erb for a fixture works fine: updated_at: <%= 1.days.ago.to_s:db%> But fails on 5.0. I had a similar deal when I had date fixtures, and switched forrmats so that both 4.* and 5.0 were happy. is there to_s:db_works_for_mysql_50() ? or similar? Thanks Forrest
2006 Dec 14
1
create and destroy fixture manually in method
Hi, My test case has two fixtures and eight methods. But one of the eight methods need one more fixture. How do I solve this? Okay, I put the additional fixture in common place so every method has additional access to the additional fixture. The problem is the additional fixture depend on that two fixtures (foreign key). When I run the test, it complains something like this:
2005 Jan 15
0
Model syntax errors obscured during fixture load
When I run unit tests with a syntax error in one of my models (in this case, it was an unterminated quote), I get this error, which suggests to me that whatever code is autoloading the model while it''s loading my fixtures is masking the error (I don''t get any notification of the syntax error, here, nor in the log). Bob bob@gemini:~/rails/windsong$ ruby -Ilib:test -S testrb
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`
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)
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 Mar 22
1
An easy one: Accessing fixture data in 1.0+
OK, we all know that Rails turned off instantiated fixtures by default in 1.0. That''s not a problem. However, what I''m now wondering is how to access the raw fixture data out of the YML file (as opposed to the database.) Mainly, for comparing my database results with my expected results in a DRY way. The book says if you have the command "fixtures :foo", that
2006 Feb 08
0
Fixture access question
Hi, I want to add the basic model record create tests for my rails app as in the "Agile Web Development with Rails" example: i.e. (header stuff and boring repitition missed) def test_create assert_kind_of Requirement, requirements(:requirement_1) assert_equal <at>requirements["requirement_1"]["name"], requirements(:requirement_1).name end Now I''m
2006 May 09
1
leftover fixture data causing errors
Maybe I''m not getting fixtures, but... I''m having problems as I start using fixtures in functional tests. Data is left in my test database after running functional tests. Not the data created by the test-method (I''m using transactional fixtures), but data from the fixtures themselves. Fixture loading will delete & reload the data again when the test is re-run, but
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
2005 Oct 28
2
Accessing fixture
I have a very simple problem. I can''t seem to access a the fixture by name I have a sites.yml with: simple_site: id: 1 name: demo description: A demo site created_on: 2005-10-25 00:00:00 updated_on: 2005-10-25 00:00:00 And I have a test class as: require File.dirname(__FILE__) + ''/../test_helper'' class SiteTest < Test::Unit::TestCase fixtures
2004 Dec 09
3
fixture problem, TypeError: nil is not a symbol
When I run rake against Rails 8.5 to test unaltered model tests with yaml fixtures I get the error and stack trace reproduced below for every one of my model objects. Has anyone seen something this before? Any idea what could be going on here? The following ruby-talk thread may or may not be relevant: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/95301. Thanks much,
2007 Jun 27
5
Mosquito Fixtures Won''t Load
I can''t get fixtures to load correctly in a Mosquito test. The first fixture loads in the unit test, but the rest don''t load at all. File structure: tracker/ tracker.rb test/ test_tracker.rb fixtures/ tracker_measurements.yml tracker_projects.yml Relevant test code: require ''rubygems''
2006 Apr 26
3
Test fixture syntax
OK, I know I''m doing something bone-headed, but I can''t for the life of me figure it out. I''ve read the test fixtures Rdoc about eight dozen times, and it says (to me) that if I have a YAML fixture file, dogs.yml that looks like this: fido: id: 1 breed: Terrier fifi: id: 2 breed: Poodle Then I can include fixtures :dogs in my functional test, and
2006 Jun 13
2
Locating an arbitrary fixture...
Is there a good way to get an arbitrary fixture from the generated fixture function? I need a way to get one of my fixtures, I don''t care which one. It doesn''t need to be random and could always return the same fixture. This is part of a support function for custom assertions and it doesn''t know what class its working on, let alone what fixture names are possible.
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
2006 Jan 16
2
My first test - named fixture not autoloading instance variable
I''m trying to write a test like the one at the bottom of page 148 in Agile Rails. I''m using rails 1.0 I''ve created the fixture correctly I''m pretty sure because the test database table is being populated per the fixture. I have what I think is a simple unit test: ========= require File.dirname(__FILE__) + ''/../test_helper'' class CaseTest
2007 Aug 13
1
Problem of using fixture in Rspec
Dear Fellows: I was using fixtures in the model tests using Rspec. I found that the test data specified in the fixtures was stored in the test database once I ran the spec and won''t be removed anyway. Is my observation correct? There might be another problem regarding the fixtures. When I ran the specs one by one, it was working. However, it failed when I tried to run all the
2006 Nov 04
0
How to reference fixture under folder ?
Hello all, I have a fixture under folder-grouping : ./fixtures/foo/bars.yml I need to reference the data in bars during functional test. methods.sort reveals ''foo/bars'' as a method in the current context (breakpointed), but I don''t know how to reference a method called ''foo/bars''. - OR - how should i reference the fixture when I''m using
2008 Apr 29
0
Fixture Scenarios plugin
Just curious if anything special needs to be done to use the Rails fixture scenarios plugin(http://code.google.com/p/fixture-scenarios/) with rspec? Would I just create the "scenarios" inside the spec/fixtures dir, as opposed to the test/fixtures dir? Thanks, Steve