Displaying 20 results from an estimated 2000 matches similar to: "Fixtures vs Fixture class, what is the intended purpose?"
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 May 26
3
Plugin test fixtures
Just spent a good bit of time trying to figure out why I couldn''t get
fixtures to work in a plugin test. I was including
ActiveRecord::TestFixtures into ActiveSupport::TestCase and trying to
get fixtures to automatically reload for every test like regular Rails
tests.
The problem was in the first line of
ActiveRecord::TestFixtures.setup_fixtures:
return unless defined?(ActiveRecord)
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 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 Jun 10
5
[REL] Manage Fixtures 2.0.0
Just released a new version of the _Managed Fixtures_ plugin, previously
known as _Export Fixtures_.
The name change comes with some added functionality for managing the
fixtures, primarily with two new import tasks for importing specific Models
or all of them within the test/fixtures directory.
Both new import tasks take the exported fixtures, and allow you to directly
import one, or all of
2006 Mar 30
3
Export Fixtures Plugin
= Description
This plugin is a super lightweight tool used to export data into the
test/fixtures directory.
So if you want to export all your data from your production server into your
development environment, this will simplify the process without having to
load up your database manager.
[%] rake db:fixtures:export_all RAILS_ENV=development
[%] rake db:fixtures:load
= INSTALLATION
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:
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 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.
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 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
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 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
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
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
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 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