similar to: unit testing date columns

Displaying 20 results from an estimated 10000 matches similar to: "unit testing date columns"

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 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 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
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 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 Aug 07
4
Unit testing diffculty
ok, let me show you my "products" fixtures file: ram: id: 1 title: RAM description: ECC RAM Registered, 512MB image_url: images/test.jpg price: 29.95 date_available: 2005-01-25 00:00:00 busted_arsehole: id: 2 title: Busted Arsehole description: I have an arsehole, it is-e busted image_url: images/test.jpg price: 999.95
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 Apr 20
7
checking date
Radrails created a field for date <%= product.date_available.strftime("%y-%m-%d") %> What does this mean? Should the definition be date or datetime? I tried both and no results Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060420/ed0cbb14/attachment.html
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 Jan 27
4
testing for nil numeric value in find
In the agile/rails tutorial book the following construct is added to products.rb. def self.salable_items find( :all, :conditions => "date_available <= now()", :order => "date_available desc") end Now, I wish to extend :conditions => to exclude products that have a nil value for the price. I have tried different syntax
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 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
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 +++
2006 Feb 28
3
Agile Web Development Example Application Question
I''m new to Ruby and to fairly new to programming. I''ve been working through the "Agile Web Development with Rails" book, and I''m stuck on page 73 of the print version. The book''s online errata directed me here with my questions. I''m running Ruby 1.8.3 with MySQL 4.1.8 on OSX 10.3.9. I''ve created the scaffolding for Admin controller
2006 Dec 04
3
uninitialized constant Product
I am actually following the instructions/code snippets from "Agile Web Development with Rails" and got as far as page 73 where I did ruby script/generate controller Store index, then edited store_controller.rb to class StoreController < ApplicationController def index @products = Product.salable_items end end and product.rb to: def self.salable_items find(:all,
2006 Apr 04
3
model validates twice in tests, produces duplicate errors
In my unit tests for my User model, I''m testing some validation cases. What is really strange, and driving me crazy, is that in the unit tests, it seems like the save method is causing my validations to execute twice, and produce duplicate error messages. This is making my tests fail (because I''m checking for the number of errors that I expect). In the web browser, only one error
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
2007 Oct 07
10
Rails to English
I am currently using the book "Agile Web Development With Rails" (2005). I am working on a fully function web application that has a shopping cart. The web page displays this, ActiveRecord::StatementInvalid in AdminController#create Mysql::Error: #23000Column ''date_available'' cannot be null: INSERT INTO products (`image_url`, `date_available`, `price`, `title`,
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 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