Displaying 20 results from an estimated 4000 matches similar to: "Another test problem"
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 Jan 16
2
My first test - named fixture not autoloading instance variable
I''m trying to write a test like the one at the bottom of page 148 in
Agile Rails.
I''m using rails 1.0
I''ve created the fixture correctly I''m pretty sure because the test
database table is being populated per the fixture.
I have what I think is a simple unit test:
=========
require File.dirname(__FILE__) + ''/../test_helper''
class CaseTest
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 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
2005 Oct 27
2
Fixtures are not loading into instance variables. Why not?
Hi,
I have a fixture in a unit test and I see that the
fixture is loaded correctly into the database table,
but no instance variables are created.
So now I''m stuck.
More background: this is my first RoR project and I
have just installed the SaltedLoginGenerator and
generated its output.
Running the unit tests gives an error, so I cut it
down to just 1 test:
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
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 Mar 04
2
unittest, not loading yml data
Here is my products.yml
version_control_book:
  id:              1
  title:           Pragmatic Version Control
  description:     How to use version control
  image_url:       /images/sk_svn_small.jpg
  price:           29.95
  date_available:  2005-01-26 00:00:00
automation_book:
  id:              2
  title:           Pragmatic Project Automation
  description:     How to automate your project
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 +-
2005 Dec 23
6
Agile book - test error
Hi all,
I get an error when testing the "store_controller_test.rb"
The troublesome line is in the test below:
def test_add_to_cart
    get :add_to_cart, :id => @version_control_book.id		<<< 
    cart = session[:cart]
    assert_equal @version_control_book.price, cart.total_price
    assert_redirected_to :action => ''display_cart''
    follow_redirect 
  
2006 Apr 21
2
NoMethodError with test_read_with_hash
While running the product_test.rb test fixture in the Agile Web 
Development book (p. 148), but when I run
ruby test/unit/product_test.rb, I get the following error:
  1) Error:
test_read_with_hash(ProductTest):
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.[]
   
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
2008 Jun 19
0
Error loading fixtures with classes that set_table_name
Hi all,
I just hit a big wall involving a legacy database.  I''ve got an active
record class called "School" that uses "set_table_name ''old_school''" to
map to a legacy database table:
class School < ActiveRecord::Base
  set_table_name ''old_school''
end
It works great, until I''m testing and I want to use fixtures. 
2008 Jun 23
0
Error loading fixtures for classes that set_table_name
Hi all,
I just hit a big wall involving a legacy database.  I''ve got an active
record class called "School" that uses "set_table_name ''old_school''" to
map to a legacy database table:
class School < ActiveRecord::Base
  set_table_name ''old_school''
end
It works great, until I''m testing and I want to use fixtures. 
2006 Jun 08
2
accessing fixtures in tests
hi all,
my first attempt at tests and i''m having trouble accessing the  
fixture values, if anyone can make it suggestions.
i have news_release_test.rb, using new_releases.yml as the fixture file
according to the agile book, i should be able to access the fixture  
properties within my test as such:
assert_equal @first_test.id , @news_release.id
unfortunately, i try that and get:
2006 May 19
3
new to rails; problem with testing section in Agile book
Hello, I should give the expected disclaimer that I am brand new to 
rails and am going through the Agile web development with Rails book 
right now. I am in the testing section and I can''t get past an error.
this is my cart_test.rb test file:
require File.dirname(__FILE__) + ''/../test_helper''
class CartTest < Test::Unit::TestCase
  fixtures :products
	def setup
	
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 03
3
Rails Noob Question
Apparently the first time I posted this, it was tacked onto the end of 
another thread.  Please pardon my repost.  Won''t happen again.
--------
Howdy.  I''m just getting into Rails, and really enjoying it!  I''m coming
from the .NET world, so I''ll embarrassedly admit that I''m running it on
winXP and even using SQLServer (for now, may switch to mysql
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__) +
2009 Jun 29
0
[PATCH server] Add svc_vm_actions method to VmService.
Also includes a couple minor model changes to support better
error reporting.
This method was added so that a client could submit multiple
vms to the service layer in one call and get back appropriate
messages showing any failures without those failures also causing
the entire call to fail, or forcing the client to implement handling
(begin/rescue blocks) of these errors to continue through the