similar to: create and destroy fixture manually in method

Displaying 20 results from an estimated 1000 matches similar to: "create and destroy fixture manually in method"

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
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
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
2006 Jan 19
4
hash fixture access broken in functional test
I have a functional test class that uses the "topics" fixture. I verified that the fixture is loaded into the database by doing this: assert_equal 2, Topic.find_all.size So I should have an instance variable called @topics and instance variables for each of the rows in the fixture, in this case, @first and @another. But all those variables are nil inside my test method. Is that
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 Aug 10
0
Load a fixture manually in setup?
I''m running into a problem where one of my fixtures uses ERb to get an id for a row that isn''t created yet. In setup, I create that row. Since it appears that fixtures are loaded before setup is run, that''s a problem. I can''t put the row creation in a fixture - its part of the business rules of one of my models. Anyone know how to load a fixture manually
2009 Jul 13
1
Running a single fixture.
Hello. I need to run a single fixture on my server as part of an update to my application. I noticed that the other tables lost their data when I run "rake db:fixtures:load". How do I make it so that only a single fixture runs and ignores the rest?
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.
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 22
1
Agile Web Dev unit test fails with fixture instance variable
I''m following Agile Edition 1. On page 148 it suggests using instance variables named after the fixture, for example: assert_equal @version_control_book.id, @product.id When I introduce this type of instance variable into my test, I get the following error: 1) Error: test_not_owner(GroupTest): RuntimeError: Called id for nil, which would mistakenly be 4 -- if you really wanted the
2006 Jan 05
1
Fixture files for inserting tree like behavior doesn''t work
Hi folks around, hope you could help me with my problem. I have a porblem while testing my Acts_as_Tree behavior with fixtures. Because all data in the fixture file will be commited at the end the entries I want to map my tree like structure to will not be present at this point. Due to this I get a foreign key constraints fails from the database. Is there any way to solve this problem? Here
2006 Mar 02
1
Fixture accessors broken for polymorphism, in need of redesign
Ticket 4052 (http://dev.rubyonrails.org/ticket/4052) just came through trac, which introduces the need for a better way to access fixtures. I believe the basic problem is the same as 3935 (http://dev.rubyonrails.org/ticket/3935) in that the accessor method which is constructed by the fixture call can''t infer the class name from the table name. The band-aid in 3935 was to allow you to
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 Feb 08
4
Fixture question...
Ok, I''m pretty sure I''ve seen this done before. I have a fixture that isn''t named the same as the table I want to insert the stuff into. Whats the right way to go about this?! Google has failed me! :( -Nick
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 Jul 29
1
Anything wrong with this test? Cannot access fixture
Hi, I have problem accessing the testfixture. The values from the YML-Fixture-File are correctly written into database, but accessing the fixture is impossible. It is always nil. Is anything wrong with this test? class MyModelTest < Test::Unit::TestCase fixtures :my_model def test_simple a = MyModel.find(@my_model["first"].id) # Accessing @my_model is impossible ...
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
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
2005 Dec 22
2
nonstandard postgresql sequence names
I''m working with a legacy postgresql database where the names of tables, columns, etc., do not usually follow Rails conventions. I''ve been able to work around it for the most part, but I ran into this: I have the following test: require File.dirname(__FILE__) + ''/../test_helper'' class SponsorTest < Test::Unit::TestCase self.use_transactional_fixtures =
2006 Mar 21
3
Instance variable shortcuts to fixture data are not working?
Hi, I am following the Agile Web Development with Rails book and it looks like either book is wrong or edge rails are broken. I am trying to access fixture data through instance shortcuts. I.e. customers.yml through @customers and it is not assigned. Anybody knows why? Sergei -- Posted via http://www.ruby-forum.com/.