Displaying 20 results from an estimated 10000 matches similar to: "STI and fixtures"
2008 Feb 18
5
uh... fixtures?
RSpec-ers:
I''m aware this is quite the FAQ. I have probably asked it myself, but I just
can''t Google up anything but others asking it.
I grabbed the source to Beast, to use as a Rails project uninfluenced by me, or
RSpec. Then I installed the CURRENT version of RSpec and rspec_on_rails, and set
up a model spec on Post.
Here''s the spec_helper.rb lines:
2007 May 30
4
aaf and dynamic attrs: a bug?
Hi!
I faced some issue while using it for dynamic attrs indexing/search.
Maybe I made something wrong. Here is test method. Everything works just
fine until last line http://pastie.caboo.se/66274 . Tested on both
stable and trunk of aaf and ferret 0.11.4.
the short version of code below:
Contact.acts_as_ferret :fields => [ :first_name ]
assert
2006 Jul 28
0
STI hiding attributes
I''ve written an extension to AR to allow hiding of attributes(aka
columns) in AR objects. If there''s interest in it I''ll roll it up
into a plugin. Here''s an example:
(straight from Agile Web Dev)
# The table
create table people (
id int not null auto_increment,
type varchar(20) not null,
/* common attributes */
name varchar(100) not null,
email
2009 May 05
9
no sql in the controller guideline
hello. i just checked Chad Fowler''s post "20 Rails Development No-No''s"
and
one guideline caught my attention. it says:
"Nothing that looks at all like SQL should go into a controller, view,
or helper."
it really came as a surprise to me as Rails itself seems to go against
such practice by its AR ''conditions'' option, which most of the times
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
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
2007 Jun 13
2
Delete the fixtures on a functionnal test
Hi,
Since couple a day, I block with the delete of my fixtures in my
functionnals test. In my controller, I need test a redirect if there
are no value.
But i load my fixtures in start of my test and in a specific test I
want delete all. Only in this method, not in other method. In API, I
discover the method delete_existing_fixtures, who seem the good
practice, but I can''t find how use
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 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
2007 Sep 21
1
Do fixture_scenarios and RSpec peacibly coexist?
Railsters:
I just installed fixture_scenarios ...
http://fixture-scenarios.googlecode.com/svn/trunk/fixture_scenarios
...into a project with some RSpec specifications. They all went kablooey.
I didn''t even create a scenario; the system just started calling its version
of fixtures(). The normal tests pass and the RSpec ones unanimously emit:
TypeError in ''Context (verbose
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
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
2007 Aug 08
1
Transactional fixtures not working as expected
Hi!
I am quite new to BDD and I just wrote my first tests. Suddenly I
received unexpected results because in a model test I load only
users-fixtures but when the views-fixtures in which I load the
posts-fixtures, are run before this model-test, the posts-fixtures are
loaded too. I test for example if there is one record in the posts-table
after creating one post. But when there are fixtures
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
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
2008 Feb 07
4
rspec fixtures stay in the test db - is this right?
I have some fixtures set up to put a few records in some of my tables.
In some of my rspec describe blocks, i''m *not* calling the fixtures, and
expecting the tables to be empty. But they''re not - the fixture data is
in there.
Am i using fixtures wrongly? I thought that the db was wiped at the
start of every test and the fixtures were only added if asked for. Is
that not the
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''
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 16
10
Scenarios Plugin Pre-Announcement
This is sort of a pre-announcement for a Rails plugin my friend Adam
Williams and I are working on. We''re in the process of extracting it
from a project we are working on so that it can be generally useful to
the Rails community. We are calling it "Scenarios". It is a drop in
replacement for Rails fixtures:
http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/README
2007 May 18
3
Fixtures considered harmful?
I''m trying to get really serious about doing true BDD for a new Rails
project, and I note that at <http://rspec.rubyforge.org/documentation/
rails/index.html> it says:
"we really don?t recommend the use of rails fixtures"
On the same page it also says (about Model specs):
"these are the only specs that we feel should actually interact with
the database"