Displaying 20 results from an estimated 4000 matches similar to: "unit tests / table names"
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`
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
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 =
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 Mar 20
3
Unit tests leave data behind when they should not
Hi,
I was confused yesterday. I have bunch of tests and one of those was
testing ActiveRecord::save and it was all right, but next method failed
because table still had newly created record. All documentation suggests
that it should not be the case and that data is reloaded from fixtures
before every method is run.
I am running edge rails and really did not have anything special done
about
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
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 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 Apr 28
2
Accessing fixtures from unit tests
I have set up some fixtures in test/fixtures/users.xml:
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
admin:
id: 1
username: admin
password: admin
pbarry:
id: 2
username: pbarry
I have a unit test for my user model:
require File.dirname(__FILE__) + ''/../test_helper''
class UserTest < Test::Unit::TestCase
fixtures :users
def
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`,
2005 Dec 17
10
need some tips for applying patches
I am working with a legacy database that does not always follow the
conventions for table names, primary key and foreign key column names,
and join table names.
This is no problem in my application code because Rails allows me to
override the defaults. However it is making unit testing next to
impossible because fixtures will still try and insert data into the
wrong tables.
Changing the
2006 Jan 10
2
Default unit tests failing?
I''ve got a strange issue. My default unit tests are failing for two models. I
haven''t changed _anything_ in the test. Here''s an example:
Output:
1) Error:
test_truth(ShippingCostTypeTest):
NoMethodError: You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.find
2005 Dec 31
2
Test Unit Problem
Hello All,
I am experiencing the following test unit error working with Rails that
I can''t fathom.
I have a products.yml file which holds the following test fixture for
the products table:
dell_pc:
id: 1
title: Dell PC
description: Dell PC
image_url: http://.../pc_image.jpg
price: 15000.00
date_available: 2005-12-31 06:53:00
I also have the following product_test.rb file to
2006 Jul 21
9
multi-server rails deployment
I''m building an app in rails that will be deployed on 3 different
servers but am not sure the best way to deploy it. The app is
something like Google Adwords (an online advertising program,
essentially).
ServerA is the Administration server
ServerB is the Ad server (feeds ad requests to affiliates)
ServerC is the Click server (handles incoming clicks from our affiliate sites)
All 3
2006 Aug 08
6
[Very OT] Steve Jobs, is he sick?
For us "Railers" on Mac systems we all probably watched Steve Job''s
keynote at the WWDC yesterday. Was it just me, or did Steve look
"sick"? I mean he has lost a lot of weight and his skin was very drawn.
--
Posted via http://www.ruby-forum.com/.
2006 Jul 28
0
reserved words
I''ve seen this topic has been discussed a couple of times. However, I''m
wondering if a method exists in rails to test a name against the reserved
words listed on the wiki?
Just wanted to check before I write this myself (and type in all of those
names -- including PostgreSQL).
To explain the application:
I''ve written a project that manages ldap data. On a fresh
2006 Jan 06
0
bug rails activerecord association join
hi,
I found a bug in ActiveRecord association SQL INNER JOIN codes. in
has_many, has_one, habtm and belongs_to queries the foreign key is
determined from the table name of reflection and self. but that''s
worng because if you use a global prefix or suffix for your tables the
foreign keys will be in format of PREFIX_CLASSNAME_SUFFIX_id which is
wrong, because it breaks the advantage of
2006 Mar 09
4
Strange Unit Testing error - newbie question
I''m fairly new to Rails, and I''ve been learning from AGILE WEB
DEVELOPMENT WITH RAILS. Everything has been going smoothly until the
chapter on Unit Testing, where I''m getting some strange errors.
I''m up to page 141 in the Agile book, and attempting to run the test
program containing the method test_read_with_hash. The previous tests
work properly, but I
2006 Mar 01
1
maddening intermittent failures in unit tests with "working" code
Hi all,
This testing problem has been a sink for time today, and is still unresolved.
Basically I have some unit tests that test simple functions (example below)
that depend on join operations in a habtm relationship, and I suspect I am
getting "false" failures, i.e ones that do not logically make any sense. I
need fresh sets of eyes to take a look and see if I''m mising