Displaying 20 results from an estimated 6000 matches similar to: "Fixtures and single table inheritance"
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 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 Mar 05
4
Help implementing a 43things-like ''activity'' measurement
I''m trying to implement something in my app akin to 43things'' main
page, where more active topics are bigger than the less active topics.
The difference in my app is that I''m building a business-oriented app
and want to have a list of clients, where clients with recent activity
are larger than others.
My perhaps too-clever way of going about this is by feeding each job
2007 Nov 14
1
New Foxy Fixtures (Rails 2) & STI (Single Table Inheritance)
I''ve got some problems right now using the new model for relationships
in fixtures (by label, not by id) and STI. What I''ve got, is a couple
of models:
Attachment
--> FileDownload
Version
Version has_one file_download with file_download_id on the versions
table
In my fixtures, I have two FileDownloads in my attachments.yml like
so:
hemingway_alpha_zip:
size: 100
2006 Mar 28
2
Testing STI models
Hi everyone!
I have a question: what is the preferred way (in terms of simplicity) to
test models with single table inheritance. Right now I have 1 test case
and 1 fixture for all of the STI models, but it''s very hard to maintain
it (too many tests and records in fixture). It would be better if
fixtures could be named separately from DB tables.
I know, Engines plugin has
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
2008 Jul 20
10
STI and fixtures
Hi all !
Loading fixtures doens''t seems to associate my 2 objects, do know what''s
wrong ?
In app/
class Manager < Employee
has_many :employees,
:foreign_key => :reports_to
end
class Employee < Person
belongs_to :manager,
:foreign_key => ''reports_to''
end
class Person < ActiveRecord::Base
belongs_to :address
end
fixtures for
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
2009 Mar 28
10
Use fixtures within fixtures?
Heya,
I''m using globalize2 and have following problem with my fixtures:
categories.yml:
one:
parent_id: two
color: #ff00aa
two:
color: #00ff11
three:
parent_id: two
color: #ab00ab
category_translations.yml
one-en:
id: one
locale: en
name: Cars
one-es:
id: one
locale: es
name: Coches
two-en:
id: two
locale: en
name: Start
two-es:
id: two
locale: es
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:
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`
2007 Sep 07
4
fixtures in before(:all)
I was planning on using a fixture within a description that didn''t modify
the fixture, so I put it in a before(:all) block:
describe "Customer", "xml" do
fixtures :customers
before(:all) do
one = customers(:one)
end
# ...
As a result, I got this message:
1)
NoMethodError in ''Customer xml before(:all)''
You have a nil object when you
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
2009 Dec 22
1
Rails fixtures - defining a table name?
Hi,
At the minute all my fixtures have the same name as the table that they
are intended for, because of a recent issue with rails it doesn''t seem
possible to have a fixture beginning with the word ''test''
Does anyone know of a way to have a different fixture name and then map
it to the correct table?
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You received
2006 Jun 08
2
accessing fixtures in tests
hi all,
my first attempt at tests and i''m having trouble accessing the
fixture values, if anyone can make it suggestions.
i have news_release_test.rb, using new_releases.yml as the fixture file
according to the agile book, i should be able to access the fixture
properties within my test as such:
assert_equal @first_test.id , @news_release.id
unfortunately, i try that and get:
2006 Apr 17
2
binary info in test fixtures?
Hi all,
I have a shopping application I am testing, and one of the models is an
Order model, within which a credit card number is encrypted and stored
in the db (mysql) as a BLOB field. When trying to run my unit tests, I
cannot get my model fixtures to load the encrypted data.
If, in my dynamic fixture (YAML) file, I could have access to my app''s
models, the problem would be trivial..
2007 Dec 01
10
Fixtures Cleanup
All,
I''ve been playing a bit with some patches to make the fixture loading
and management code a little bit easier to maintain. If I were to
start chopping out features, how would you feel about losing:
Fixture instantiation,
Old school single-file fixtures,
CSV fixtures,
The ability to specify a subset of fixtures (everything''s always
loaded instead),
The ability to
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
2005 Mar 03
4
Loading data with fixtures
Can anyone point me to an easy way to load fixture
data into the development (not test) database?
- Tim
__________________________________
Celebrate Yahoo!''s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/
2007 Oct 21
13
[ANN/RFC] Rathole, a fixtures extension plugin
Like lots of other folks, I''ve been searching for a way to scratch my
fixture itches. Rathole is my extraction of a few techniques we''ve
successfully applied at my day job.
We''ve been using Rathole for a month or so now, but I''d really like
some feedback from a wider audience. Rathole tackles:
* Conflicting PK''s (no more id''s in fixture