Displaying 20 results from an estimated 10000 matches similar to: "Unit tests leave data behind when they should not"
2007 Sep 02
4
unit test failing
I have unit tests set up with "self.use_transactional_fixtures =
true", so each test should roll back.
Run individually, all my tests succeed. But running "rake
test:units", I get the below error in 5 test cases. I''m not sure how
to solve this since I''m not sure how to debug tasks run thru rake. Any
ideas are appreciated.
1) Error:
test_delete(OrderTest):
2006 May 05
7
Testing model: test becomes dependent on previous test
Im having trouble with Testing models. im following the tutorials in the
book Agile Web Development with Rails. if i execute the code
product_test.rb, i get this error:
============================================================
1) Failure:
test_update2(ProductTest) [test/unit/product_test.rb:30]:
<29.95> expected but was
<99.95>.
3 tests, 11 assertions, 1 failures, 0 errors
2006 Jun 15
10
Finding out all terms from search results. How?
Hi everybody,
I need to find out all terms (field values) from one of the fields from
a set of documents returned by search.
In other words, I have indexed documents with two fields. I do search on
one field and then want to know all other field''s values from fount
documents.
How?
--
Sergei Serdyuk
Red Leaf Software LLC
web: http://redleafsoft.com
--
Posted via
2008 Feb 12
4
Funny behavior with Fixtures... on Ubuntu..
Hey Guys,
I''ve got a test class that loads a bunch of fixtures. My understanding
is that fixtures are reloaded between each test... and I even have the
following two method calls at the top of my test class to make doubly
sure...
class TaskTest < Test::Unit::TestCase
self.use_transactional_fixtures = true
self.use_instantiated_fixtures = false
When I run my tests
2006 Jun 20
7
Any fast way to update non-indexed fields?
Hi,
>From looking at Ruby sources it seems that every update method deletes
and reinserts documents. It makes sense if indexed fields are changed
but what if it is not the case? It would speed up update a lot indexes
did not have to be updated twice for nothing. Any quick way to do it?
--
Sergei Serdyuk
Red Leaf Software LLC
web: http://redleafsoft.com
--
Posted via
2006 Apr 06
3
Formating Float ActiveRecord attributes in text inputs
I have AMOUNT field that ActiveRecord maps to Float.
Then I use text_field helper to generate text inputs on forms.
Helper takes model object and attribute name and does not provide any
formatting abilities, thus 2.40 is shown as 2.4 which is fine with
floats but does not look good with currency.
I have worked around this issue by adding amount_f attribute to the
model that returns formatted
2005 Dec 15
4
Order of tests matters???
I have a problem with tests. I always thought that the order of tests doesn''t
matter because the fixtures are reloaded before every test method. However, I''ve
just discovered that this isn''t true.
This is a quote from the "Guide to testing the rails" howto:
"... if we had another test method, we wouldn’t have 10 users on the 2nd test
because they would
2006 Apr 03
1
debugging RJS output
Hi,
Is there a way to log RJS output in development.log?
Thank you.
--
Posted via http://www.ruby-forum.com/.
2006 Mar 22
3
STI and ActiveRecord attributes unprotected
Hi,
This does not seem to be covered anywhere. Since base class extends
ActiveRecord with a table that has fields for all heirs, would that mean
that any heir class can access any of those attributes, including ones
that belong to other heirs?
Or I am missing something?
--
Posted via http://www.ruby-forum.com/.
2006 Apr 16
7
Problem running unit tests
I am running Rails 1.1.2 with Ruby 1.82-15. My database is Postgresql. I
haven''t had any problems generating models, migrations, using scaffolds, and
generally building and using my application, but I haven''t been able to get
testing to work. I initially just ignored the problem and kept developing,
but would like to add proper testing from here on out.
Currently when I type
2005 Nov 18
6
wrong number of arguments (2 for 1) error message help
All,
This is really starting to get me as i can''t figure out why I am
getting this error. Here is what is going on. I have a table called
items and a item controller. When I add a new item to the items table
I am also creating several associated tables. the code for this so
that you can follow along is:
def create
@item = Item.new(params[:item])
# The item belongs to
2006 Jun 15
1
Ferret::Analysis::PerFieldAnalyzerWrapper is not exported
Hi,
I am on Ferret 0.9.3 and it seems to me that
Ferret::Analysis::PerFieldAnalyzerWrapper is not available in
ferret_ext.
--
Sergei Serdyuk
Red Leaf Software LLC
web: http://redleafsoft.com
--
Posted via http://www.ruby-forum.com/.
2007 Dec 18
3
MySQL transactions not working in unit tests?
I just installed acts_as_authenticated into an app and one of its unit
tests is failing. The cause is that another unit test''s changes to the
AAA fixtures aren''t being rolled back. I''m confused, since I have
transactional fixtures turned on and MySQL InnoDB engine being used.
Details:
- MySQL 5.0.24. InnoDB is the default engine, all tables in the test
db are using the
2006 May 19
1
imdex.update is 10 times slower than index.add_doc. Normal?
Hi,
I am seeing that
doc = index[''mykey'']
index.update ''mykey'', doc
is about 10 times slower than
doc = Document.new
doc[''id''] = ''mykey''
index << doc
It looks like #update is _much_ slower that #<<. Is it as expected?
Sergei.
--
Posted via http://www.ruby-forum.com/.
2006 May 17
1
Ferret causing "out of memory"
I am a bit puzzled. I am having issues with memory leaking away. It
seems to be related to searching documents by ''id'' column value.
This is what I am doing:
cached_annotations = Ferret::Index::Index.new(:path =>
"#{RAILS_ROOT}/db/ferret/tmp/annotations", :auto_flush => false)
100000.times { |x| doc=cached_annotations[x.to_s] }
Every 100000.times eats 100MB
2006 Apr 21
2
destory Test Case Messes up all tests
I am trying to create unit tests for my users model but when I add a
test that destroys a user, that user is not available in any of the
other test. If I remove the test that destroys the user all my other
tests work again.
All the fixtures are suppose be reloaded between tests right?
Here is my testcase :
require File.dirname(__FILE__) + ''/../test_helper''
class UserTest
2006 Mar 21
3
Instance variable shortcuts to fixture data are not working?
Hi,
I am following the Agile Web Development with Rails book and it looks
like either book is wrong or edge rails are broken.
I am trying to access fixture data through instance shortcuts. I.e.
customers.yml through @customers and it is not assigned.
Anybody knows why?
Sergei
--
Posted via http://www.ruby-forum.com/.
2006 Jun 23
1
Can not rescue ferret exception. What is wrong?
Hi,
I have a big index and wildcard query raises an exception. That is all
right. The problem is I can not rescue this exception and it bombs right
to user page. Why?
I am on Linux. Ferret 0.9.3 with C extentions.
>> class A
>> def self.b
>> Book.index.search(''isbn:00*'')
>> rescue
>> puts ''ok''
>> end
>> end
=>
2007 Aug 31
3
Setting use_transactional_fixtures=false for a single spec - a bad idea?
Hi!
I would really like to find a way to allow me to write RSpec
specifications for code that use database transactions. I know I can set
config.use_transactional_fixtures = false
in my spec_helper.rb. That works, and that''s great, but it will (I
think) slow down my specs quite a bit. I would like to turn off
transactional fixtures for just a single spec (describe), or even
2005 May 03
8
SQLite3 + RAM drive => 3 times faster unit tests
One problem I sort of always had with the ActiveRecord''s tight coupling
to the SQL backend is how slow it makes the unit tests. OK, there are
some ways to make it faster at a price of extra complexity (reusing the
fixtures, doing a rollback in the end of the test, etc), but still - it
is much slower than what I would like a unit test to be.
Today I had a very simple idea (why, oh why