similar to: How to write unit tests with respect to model callbacks?

Displaying 20 results from an estimated 3000 matches similar to: "How to write unit tests with respect to model callbacks?"

2006 Jul 06
0
problema con i test automatizzati
ciao a tutti.     come al solito, sto andando avanti a piccoli passi nel creare l''applicazione depot del libro "Sviluppare Applicazioni Web con Rails". Ora mi trovo nella fase di creazione dei test automatizzati. Ma c''è una cosa che proprio non capisco: Ho la seguente classe in ~/depot/test/unit/product_test.rb require File.dirname(__FILE__) +
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,
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 Feb 21
0
DB not being repopulated prior to Unit test execution
I''m working my way through the AWD book and have just started the testing chapter. The first two unit tests run as expected. When I add the test for the ''destroy'' function to product_test.rb, however, I''m getting a failure I don''t understand. The error I''m getting says that in the setup method for test_update, it "couldn''t
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
2009 May 18
0
[PATCH server] fixed functional tests after recent controller refactoring and managed node controller fixes.
Signed-off-by: Scott Seago <sseago at redhat.com> --- src/test/functional/host_controller_test.rb | 41 -------------------- .../functional/managed_node_configuration_test.rb | 14 ++++--- src/test/functional/nic_controller_test.rb | 8 ---- src/test/functional/permission_controller_test.rb | 15 ++++--- src/test/functional/quota_controller_test.rb | 2 +-
2007 Jan 10
3
ActiveRecord Error?
We spent a big chunk of yesterday hunting down a strange bug in one of our rails apps and created a test project to try out different theories on what was going on. The result so far is a very small test case app that perfectly reproduces the problem. The question is, is there anything *wrong* with what we''re doing here, or is it a problem with ActiveRecord? We''re on rails
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
2006 Mar 20
2
Testing Models And Fixtures
I have finally decided to look into testing and I am going through the examples in the AWDWR book and I tried the following and it does not work... even though I don''t see why it shouldn''t. =========== posts.yml =========== basic_post: id: 1 title: Title body: Body created_at: 2006-02-01 00:00:00 updated_at: 2006_02-02 00:00:00
2006 Jun 02
0
Problem updating child row from parent model
I developped a web site with Ruby on Rails, but I get a problem during the testing. I have a parent table called "orders" and a child table called "line_items". I created some data for the test in the files "test/fixtures/orders.yml" and "test/fixtures/line_items.yml". In the file "test/unit/order_test.rb" I wrote some code to test the
2006 Feb 01
3
Test data life cycle confusion
Hi, It states on page 140 of Agile Web Development with Rails: Here?s the bottom line: even if a test method updates the test database, the database is put back to its default state before the next test method is run. This is important because we don?t want tests to become dependent on the results of previous tests. Well, I''ve been running into a brick wall with some functional tests
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 May 03
1
Test not Reseting
My test are not resetting for each method in the test class. It was promised to me on page 146 of Agile Web Development on Rails that it would. Am I doing something wrong? The "@delete_victim = User.find(4)" bust the setup class each time it comes around, even though that is in my users.yml class UserTest < Test::Unit::TestCase fixtures :users def setup
2005 Sep 18
5
NameError: uninitialized constant Addres
I created some scaffolding for an Address model and an Addresses controller. When running the functional tests for the addresses controller, I get this exception: "NameError: uninitialized constant Addres" The exception seems to start from this function: def list @address_pages, @addresses = paginate :address, :per_page => 10 end I''m guessing pluralization bug?
2006 Feb 24
1
sqlite3 error: uninitialized constant API
I''m just starting my first rails app and I can''t figure out this error. It''s got something to do with connecting to sqlite3...Here''s the application trace: <code> /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in `const_missing''
2006 Jan 18
15
Anyone got Globalize working???
Hi all In another thread I complain about an error I get after trying to get Globalize working. http://www.ruby-forum.com/topic/51988#new Now I want to ask you, if anybody of you has ever got Globalize working? I have done exactly what''s written in the (absolutely much too short) tutorial of its wiki... http://globalize.diluvia.net/wiki ...and I''m very frustrated that no
2010 Oct 06
6
Error on running unity test: "no such file to load -- 'active_record/version'"
Hi folks! I''ve been experimenting an error messagem when I try to run unity test in any model of my project. Here it is: /home/fabricio/shopcell/config/environment.rb:1:in `require'': no such file to load -- active_record/version (LoadError) from /home/fabricio/shopcell/config/environment.rb:1 from ./test/test_helper.rb:2:in `require'' from ./test/test_helper.rb:2
2006 May 05
1
Adding methods to model based on foreign table rows
Hi all, I wondered if the following is implemented in ActiveRecord: I have three tables: "products", "properties" and "product_properties" the products table holds base information for the product, like product_id, name etc. >> Product.column_names => ["product_id", "name"] the properties table holds extra "columns" for the
2006 Jan 10
5
Oracle 10g Express - generate scaffold gives error
Hello, I have Oracle XE installed. I have a table USERS. When I try to generate a scaffold it gives me this error. I tried also with Mysql and it worked. E:\radrails\projects\MPS>ruby script\generate scaffold user exists app/controllers/ exists app/helpers/ create app/views/user exists test/functional/ dependency model exists app/models/ exists
2005 Dec 21
6
Rails without a db - how to run tests
I''m writing a simple app that doesn''t need to use a database. I added :active_record to the config.frameworks -= line in environment.rb file. This lets me run ./script/generate fine without complaining about no connection. However if I try to run a functional test, it complains about no connection being established. Well...I don''t want a connection to be established.