similar to: Unit Testing - Persistence of Destroyed Objects?

Displaying 20 results from an estimated 4000 matches similar to: "Unit Testing - Persistence of Destroyed Objects?"

2005 Mar 09
9
Unit testing + instance variables
After *much* digging and playing around, I finally figured out how to unit test instance variables that are created by actions. It was more difficult than I expected. It seems like there should have been a more straight forward way to do this. Can someone enlighten me? A simplified and somewhat contrived example of what I am current doing: Thanks. Matt >> # My Controller of interest
2005 Dec 20
0
Problem destroying in unit tests with HABTM
Hi converted two of my models to HABTM today but I am having a real hard time getting my unit tests to pass now. Specifically, when I destroy a record I get this error: ...many many lines of this above... (eval):4:in `destroy_without_habtm_shim_for_categories'' (eval):4:in `destroy_without_habtm_shim_for_categories'' (eval):4:in
2009 Jul 01
1
[PATCH server] fixed expected status messages that were failing unit/functional tests.
--- .../functional/cloud/instance_controller_test.rb | 2 +- src/test/unit/vm_service_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/functional/cloud/instance_controller_test.rb b/src/test/functional/cloud/instance_controller_test.rb index 71d132b..0d713d4 100644 --- a/src/test/functional/cloud/instance_controller_test.rb +++
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 Jun 25
1
Unit Testing failure
When I run the unit testing code in Unit Testing Models chapter of the Agile Rails book, I get the following error: $ ruby test/unit/cart_test.rb Loaded suite test/unit/cart_test Started F. Finished in 0.21806 seconds. 1) Failure: test_add_duplicate_product(CartTest) [test/unit/cart_test.rb:22]: <4690> expected but was <3579>. 2 tests, 3 assertions, 1 failures, 0 errors require
2006 Mar 19
2
Unit test confusion
Hey all, I''m following along with AWDWR, specifically the unit testing. On page 148, it shows you how Test::Unit::TestCase will automatically define instance variables based on your fixtures. It doesn''t seem to actually work, though. It seems that both @artists ["beatles"]["name"] and @beatles.name are nil objects in my test, where as
2006 Feb 22
3
Unit test failure - nil object?
I''m following instructions in the Agile book, page 146 for testing an object update to the database. Here''s my code: def test_update assert_equal "jack@smiths.com", @user.email @user.email = "jack@smiths.org" assert @user.save, @user.errors.full_messages.join("; ") @user.reload assert_equal @user.email,
2005 Dec 22
1
How to write unit tests with respect to model callbacks?
Hello, I am exploring the "Testing" part of Rails, but It seems some things work differently than I thought it would. Consider the following model: class Client < ActiveRecord::Base has_one :project def after_create Project.new(:name => self.name, :is_client => true, :client_id => self.id).save end def after_update
2005 Jul 22
3
testing application_helper.rb
I am trying to run some functional (or are they unit?) tests on my application_helper.rb. So far, I''ve not had any success in being able to call the methods defined in application_helper.rb. Here is my app/test/functional/helpers.rb require File.dirname(__FILE__) + ''/../test_helper'' require File.dirname(__FILE__) +
2006 Sep 29
7
help needed in UNIT Testing
hi guys, I needed help in Unit test. i just try to save new data intomy test database. but save method does not works for me. the result shows here def test_new_avail avail = Avail.new(:vendor_id => 1, :last_mod_by => ''Murali'', :updated_at => ''2006-08-17 13:14:59) assert avail.valid? assert avail.save end
2007 Jan 25
8
Mongrel with mephisto on a Virtual Private Server
Hello everyone, I am trying to setup Mongrel to work with Apache on a VPS as part of a mephisto installation. Has anyone done this, and if so how did you edit your conf file to make it work? I used the info found on the mongrel site at: http://mongrel.rubyforge.org/docs/apache.html<http://mongrel.rubyforge.org/docs/apache.html> and one time I did get a mephisto splash screen, but it was
2006 Apr 30
0
weird error when running my unit tests
How can this be possible: I have two tests: def find_all_active_and_inactive assert_equal Concept.find_all_active_and_inactive.size, @concepts.size end and def test_find_all_inactive assert_equal Concept.find_all_inactive.size, (@concepts.size - Concept.find_all.size) end Concept.find_all returns 2 concepts (I overwrote the method to return only the active concepts)
2006 Jan 28
1
Unit Tests Behavior
Hi, Working on unit tests and I have a few cascade delete constraints I am testing. The unit tests stop at the first assert_raise test. Is this typical? def test_destroy_all_cascade_delete assert_equal 1, Iep.find(:first).client_id assert_equal 1, Encounter.find(:first).client_id @client.destroy assert_raise(ActiveRecord::RecordNotFound) { Iep.find(1) } <--
2011 Dec 08
0
[hivex] [PATCH 7/8] ruby: Add unit test for new RLenValue type
Signed-off-by: Alex Nelson <ajnelson at cs.ucsc.edu> --- ruby/tests/tc_120_rlenvalue.rb | 46 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-) create mode 100644 ruby/tests/tc_120_rlenvalue.rb diff --git a/ruby/tests/tc_120_rlenvalue.rb b/ruby/tests/tc_120_rlenvalue.rb new file mode 100644 index 0000000..ff920af --- /dev/null +++
2006 Mar 26
4
A unit test that should pass
Hi, I wonder why this unit test fails. The model : class Article < ActiveRecord::Base set_table_name "publish_articles" belongs_to :category validates_presence_of :title, :excerpt #snip end The test : def test_validate @article.title = nil @article.excerpt = nil assert !@article.save assert_equal 2, !@article.errors.count end !@article.errors.count returns
2006 Feb 08
8
Liquid with database?
Hello, Just wondering if someone here as successfully ported Liquid to use with a database. I would like to try it out but not sure how Liquid integrates with current templates. Thanks Frank --------------------------------- Yahoo! Mail - Helps protect you from nasty viruses. -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Mar 07
3
STI and unit testing
Hi all, I''m having a bit of a problem with unit testing. I''ve simplified my models to try and get my head round it but I''m still struggling. I''m using STI and trying to write tests for the extended models (code below). I''ve written test cases for the extended models which themselves extend the test case for the parent model, so BarTest extends
2011 Feb 28
7
XCP - migration from xend
Hello there, I have some issues regarding xend domU migration to XCP VM. I try to migrate my old xend domU''s to my xen Could using the xva.py script. All seems to work quite ok, the migration process doesn''t throw any errors, i get a .xva file with a proper Size. When importing that file, immidiately the VG and LV is created, and VM properties are assigned correctly. But when
2006 Jan 28
1
Unit Tests Take 2
Different question this time, and maybe only a core developer can answer. In 1.0, use_instantiated_fixtures is turned off by default. What is the new best-practice for not tying your tests to your test data? Before you would use: In clients.yml first_client: id: 1 name: Fred In a test case: def test_sometest assert_equal @first_client.name, @client.name end
2006 Nov 17
5
[Tweaking-Typo-4.0.3] acts_as_ferret `method_missing''
Hey Folks, after following the instructions for tweaking Typo to use rather ferret than DB queries to search article I got a strange NoMethod error when starting the console or the server scripts. /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1129:in `method_missing'':NoMethodError: undefined method `acts_as_ferret'' for Content:Class As you can