similar to: Fixture like imports...

Displaying 20 results from an estimated 20000 matches similar to: "Fixture like imports..."

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
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
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
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
2007 May 27
1
annotate_models plugin to annotate RSpec specs and fixture
I have found useful to have the table information associated to models disp?ayed in the models and fixtures files of my rails applications. If you want to add this information to the spec_fixtures and specs add the following patch to your plugin. Index: vendor/plugins/annotate_models/lib/annotate_models.rb =================================================================== ---
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
2006 Feb 24
2
Problem Referencing Fixture Objects
In my tests, I use fixtures, eg pupils.yml might be: jimmy: id: 100003 known_as: Jimmy surname: Page academic_year_id: 1 gender: m In the test, @jimmy (the referencing style referred to in Agile Web Dev....) is nil, whereas pupil(:jimmy) returns the expected Pupil object. What gives? Robert
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
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 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 12
0
Maintain foreign key linkages in fixtures...
Is there anyway to refer to the entities being linked in a foreign key field of a fixture by name instead of id? Ie, if I have categories.yml some_cat: id: 1 name: Foo other_cat: id: 2 name: Bar data.yml some_item: id: 1 category_id: <%= categories(:some_cat).id %> name: Hello World The above doesn''t work due to scope, even if the fixtures are loaded in the proper
2005 Dec 15
3
Fixtures and table name
Is there a way to use table name other than the default or to turn it around have multiple fixture files associated to the same table. Here''s my use case: I have multiple unit test classes that all work with the same model class and hence the same database table. However, for each test class I want the data to be in a different state. So I''d like to have something like class
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
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,
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
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
2011 Apr 26
1
problem populating table using rake db:fixtures:load
I''m running Rails 3 and I''m trying to populate a table using rake db:fixtures:load, and I''m getting a "Could not find" file error. The table is called stores, and I''ve confirmed that it exists, and the data is in stores.yml in my test/fixtures directory. The command I''m running is rake db:fixtures:load FIXTURES=stores. The error message
2006 Aug 04
1
All Fixtures plugin
Just released a very simple plugin for including all fixtures in your tests. Once you have a large number of table, manually managing the fixtures for every single test stub can be quite tedious. Use as follows class BlogArticleTest < Test::Unit::TestCase all_fixtures def test_foo ... end end Couldn''t be easier. More info here:
2008 Apr 27
1
Odd fixtures behaviour
This is Rails 2.0.2 I have two yaml fixture files, both loading into ARs with acts_as_tree, so they both have the !!omap directive set. One, categories.yml, loads just fine. The other goes very weird, somehow fixtures.rb opens the file, reads "name: All" from the first record, and then tries to open a file called "All", which then fails miserably on line . I can''t