Displaying 20 results from an estimated 6000 matches similar to: "Ordering Fixtures"
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`
2005 Aug 23
0
Fixtures: pluraly bitten
With my functional tests (on PgSQL) I get strange errors like this
1) Error:
test_create(AufgabeControllerTest):
ActiveRecord::StatementInvalid: ERROR: duplicate key violates unique
constraint "aufgaben_pkey"
Tracking this down, I found that sequences are only reset for some of
the tables I''m using. The reason? Inconsistent singularization.
I won''t go so far as
2008 Jul 26
0
fixtures, how to set a serialized Hash object
I defined in my model :
...
serialize :unavailables
..
which is set like this (Hash : "year" => 2-dimensional Array)
{"2008" => Array.new(13).map!{ Array.new(32, 1)} }
In my fixture I need to initiliaze this field with the following
hash :
{"2008" => Array.new(4).map!{ Array.new(32, 1)} + Array.new(1).map!
{ [1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2006 Jan 24
0
Fixtures subdirectories
Hi,
[This is a repost, I can?t find where went my previous post,
]
I wanted to create subdirectories in the fixtures directory in order to be
able to manage many different initial states for my system (or to sort
fixtures / corresponding model subpackages).
I came up with the idea of writing:
Test::Unit::TestCase.fixture_path = RAILS_ROOT + "/test/fixtures/selling"
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
===================================================================
---
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 Jun 23
0
to_yaml problem with option hash
Hi,
I''m trying to make a fixture for testing with a serialized column. In
the YAML fixture I''m trying to fill the serialized column with the
to_yaml function. But I keep getting the ''---'' separator, which I don''t
want because it is only a ''partial'' yaml fill.
According to the documentation to_yaml takes a hash of options, so
2007 Feb 07
0
strange sqlite3 errors - validates_associated & failing activerecord unit tests
I''m getting two strange errors, both which I believe relate to sqlite3.
The first one is with validates associated. Here is my test:
require File.dirname(__FILE__) + ''/../test_helper''
class SubscriptionPlanTest < Test::Unit::TestCase
fixtures :subscription_plans
fixtures :publications
def setup
@six_month_gold = subscription_plans(:six_month_gold)
2006 Sep 30
6
generating unique tracking numbers
Hello,
I''m interested in learning what folks in the Rails community do when
they need to
generate permanent unique numbers for tracking objects such as packing
slips, inventory items, customers, employees, etc.
It''s tempting to use the autogenerated id, but they''re not pretty
enough for human consumption and it can be problematic having assigned
ids if tables ever need
2006 Nov 23
0
TypeError on loading fixtures for integration tests
Functional tests properly load fixtures, but my integration test
chokes:
# def self.create_fixtures(fixtures_directory, table_names,
class_names = {})
# puts("fixtures dir: "+(fixtures_directory.nil? ? "nil" :
fixtures_directory))
It''s only nil for my integration tests. I''m on rails edge. Does anyone
know what I''m doing wrong here?
1) Error:
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 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 =
2012 Jul 05
1
hash to_yaml in erb template not giving valid yaml
Hi,
I want to use a file resource to write a facts.yaml file for
Mcollective. For some reason it won''t provide a valid yaml format if I
dump my scope to hash and convert to_yaml.
file {
"/etc/mcollective/facts.yaml" :
owner => root,
group => root,
mode => 400,
loglevel => debug,
#content => inline_template("<%= scope.to_hash.reject {
2006 Mar 23
5
Polymorphic associations
I have just updated rails and added polymorphic associations but they
are not working properly. I''m following the recipe 17 of "Rails Recipes"
and I''m getting an "Unknown key(s): as" error. These associations work
properly on the console. The problem occurs when I''m listing the
items... perhaps the problem is pagination. Is this a bug or what
2010 Jul 17
1
not able to find to_yaml definition
I am looking at rails edge source code.
I am able to do
puts User.find.to_yaml
However I am not able to find piece of code where ''def to_yaml'' is.
How this to_yaml serialization is working?
can fully understand how to_json and to_xml is working but to_yaml
beats me.
Thanks
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2007 Oct 07
1
How to store a Mechanize object in the database?
Hi,
I am trying to save a Mechanize object in database (using a Rails Model).
But the save operation throws a TypeError
Considering that "agent" is an instance of a Rails Model and "user" is
defined as a "text" type in the Model.
irb(main):039:0> agent.user = WWW::Mechanize.new
#<WWW::Mechanize:0xb71295f0 @follow_meta_refresh=false, @key=nil,
2007 Oct 18
4
Feeding the framework ?
Hi there,
Is it just me or do many other rspec / rpsec_on_rails users spend more
time than they would like feeding the framework ?
Don''t get me wrong, I love rpsec, but I seem to spend about 2/3 hours
per week hunting down rspec problems.
For example, today `rake spec:models` is broken. When I migrate, load
fixtures and run `spec -cfs` all is well. When I run `rake spec:models`,
2011 Mar 29
0
Issue / code smell in AssociationProxy
I came across an issue in my code and after a hard debug session I
found something that smells.
First the context of my issue. I have a AR object that has a
polymorphic belongs_to currently tied to nothing, I want to dump it to
YAML.
record.to_yaml
This raises the following exception:
TypeError: wrong argument type nil (expected Data)
from
2006 Aug 11
1
unit tests / table names
I recently underwent a (forced) schema change and had to change my "Keyword"
class''s table name to "keywords_raw". Changing this in the model was no
problem. All my existing unit tests obviously assumed everything was named
"keywords" so I''m trying to change things to work, but I can''t figure out
the right combo. I''ve tried
2006 Mar 27
5
Fixtures, Postgres & Constraints
Anyone have any tips for handling postgres constraints when using
fixtures to load the database, other than to sort out the proper
insertion orders or leaving the constraints out? I''d prefer not to do
the former since I''d rather use my app to generate my fixture data
(using a dump_fixtures task) and I''d prefer not to do the latter
because leaving out constraints till the