Displaying 20 results from an estimated 8000 matches similar to: "need some tips for applying patches"
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
2006 Jan 10
5
problems overriding module with plugin
Hi I am trying to create a plug-in to fix the error in the rails core
produced by the multiple delete on a HABTM relationship. I have
confirmed that my plug-in is being included into the base during
runtime however the code does not seem to be overridding the base
class.
module ActiveRecord
module Associations
module ClassMethods
def has_and_belongs_to_many(association_id, options =
2006 Feb 01
5
Sybase ctlib Adapter
Hi,
I''ve been trying to update Will Sobel''s sybase-ctlib adapter to pass
unit tests on Rails 1.0. It''s been a slow, sloggy process for me so
far, as I''ve been learning Ruby, Rails, and Sybase administration all
in one go. (c: It''s been a saving grace to have a good starting
point (thanks Will!).
http://dev.rubyonrails.org/ticket/2030
2006 Jan 19
4
hash fixture access broken in functional test
I have a functional test class that uses the "topics" fixture. I
verified that the fixture is loaded into the database by doing this:
assert_equal 2, Topic.find_all.size
So I should have an instance variable called @topics and instance
variables for each of the rows in the fixture, in this case, @first and
@another. But all those variables are nil inside my test method.
Is that
2006 Jan 25
3
Resetting sequences in unit tests with pg
Hi all,
Rails 1.0
Postgresql 8.1
Ruby 1.8.4
Is there a way to reset sequences in unit tests when loading fixture data? I
came across mention of a "Fixtures.reset_sequences method here:
http://api.rubyonrails.com/files/vendor/rails/activerecord/CHANGELOG.html
However, when I tried to call Fixtures.reset_sequences in the setup method, I
got a NoMethodError.
Any ideas?
Thanks,
Dan
2007 Feb 14
2
File into database migration
Hi,
I am trying to figure out an approach to load in our initial data into our
database.
I have written some load_data migrations which populate a lot of the stuff,
how some of the database
items are images etc and I am trying to figure out how to approach added
them to the database
during a rake db:migrate
I am thinking if I store the files in a folder off the RAILS_ROOT I should
be able to
2006 Mar 18
1
Fixtures and single table inheritance
I''m wondering what the accepted method for doing unit tests on STI models is.
I tried to create a fixture for the class but Rails tries to load that
data into the non-existent child table. I could create a fixture named
for the real, parent table, but then it would be very difficult to
test for the individual functionality and integrity of each sub-class.
I saw this page
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
2009 Sep 22
6
Import excel / csv files
Hey,
What way is the best to do imports of CSV files?
2006 Jul 14
5
migration and inserting default data
Hi,
I''m wondering is there a way to load default data in the migration script?
So, for example I''m creating new table to store the order status, I also
want to pre-populate the table with some data from a sql file.
I have done a quick search on the list but cannot find anything.
thanks,
- reynard
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jan 11
4
Help with Non-model classes
Hey guys,
I''ve been trying to teach myself Rails by building a relatively
complex app for work. I''ve started it twice and now I''m thinking
about restarting it a third time. I need some help with some of my
code.
I''m creating an app to help us manage time. We have a number of
developers on a number of teams who are assigned to any number of
projects
2007 Jul 22
18
db:fixtures:load order
I was trying to deal with foreign key issues related to order of
fixture loading when I came across this:
http://techpolesen.blogspot.com/2007/04/rails-fixture-tips.html
This got me looking deeper into rails and I noticed that
db:fixtures:load calls Fixtures.create_fixtures once for each fixture
file. However, Fixtures.create_fixtures is capable of taking multiple
files and also handle the
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
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
===================================================================
---
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 =
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 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`,
2006 May 26
4
Using ''validates_inclusion_of'' to validate foreign key
I seem to be missing something trying to use ''validates_inclusion_of'' to
validate a foreign key and was hoping some one could piont out my
mistake?
The problem seems to be that Order.find_all.collect is not returning an
array that contains the order_id, if I replace it with a hardcoded array
everything works as expected.
The model:
class OrderItem < ActiveRecord::Base
2009 Mar 31
3
Accept POST data from external source?
Ok, this is harder than I thought. I''ve got a hunk of XML coming in
from an entirely external source that I do not control (but another
department in my company does, so it''s not like a giant security hole).
I was hoping to just have them POST their data to me, and then I''d read
the raw stream and parse it.
I''m sure folks know what I ran into -- Invalid