Displaying 8 results from an estimated 8 matches for "version_control_book".
2006 Jun 24
1
@version_control_book not available while testing - AWD book 1 page 148
In the page 148 of the AWD book it''s mentioned that the while testing
@products and @version_control_book are automatically made available.
That''s not the case with me. In my test environment I don''t get those two
variables.
I was wondering if anything has changed in Rails 1.1 because in the new
edition of the book (AWD - edition 2) there is no mention of such feature in
testing ch...
2006 May 19
3
new to rails; problem with testing section in Agile book
...his is my cart_test.rb test file:
require File.dirname(__FILE__) + ''/../test_helper''
class CartTest < Test::Unit::TestCase
fixtures :products
def setup
@cart = Cart.new
end
# Replace this with your real tests.
def test_add_unique_products
@cart.add_product products(:version_control_book)
@cart.add_product products(:automation_book)
assert_equal products(:version_control_book).price +
products(:automation_book).price, @cart.total_price
assert_equal 2, @cart.items.size
end
def test_add_duplicate_product
@card.add_product products(:version_control_book)
@card.add_product...
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 Aut...
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
assert_equal 1, assigns(:items).size
assert_template "store/display_cart"
end
An...
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 id of nil, use object_id
test/unit/group_test.rb:8:in `set...
2006 Mar 09
4
Strange Unit Testing error - newbie question
...ts.yml" fixture file is exactly as downloaded
from the Agile Web Dev site, I''ve checked it for syntax and spelling and
tabs-instead-of-spaces and the like.
"product_test.rb", in the method "test_read_with_hash" contains this
line:
vc_book = @products["version_control_book"]
When I run product_test.rb, I get a NoMethodError on this line:
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.[]
test/unit/product_test.rb:71:in `test_read_with_hash''...
2006 Apr 21
2
NoMethodError with test_read_with_hash
...e of Array.
The error occured while evaluating nil.[]
test/unit/product_test.rb:39:in `test_read_with_hash''
4 tests, 15 assertions, 0 failures, 1 errors
Below is my code for the the method:
def test_read_with_hash
assert_kind_of Product, @product
vc_book = @products["version_control_book"]
assert_equal vc_book["id"], @product.id
assert_equal vc_book["title"], @product.title
assert_equal vc_book["description"], @product.description
assert_equal vc_book["image_url"], @product.price
assert_equal vc_book["price"...
2005 Dec 30
1
Problems with Testing (Depot) demo app in Agile Rails book
...in advance if
I''ve made some really elementary mistake)
1. Purchased the Agile Web Devt with Rails book
2. Been following along with the "Book Depot" sample app - all going
well
3. Had already figured out (with the help of Google, a Mike Clark
article, etc.) that (e.g.) "@version_control_book" used in book didn''t
work - and had changed all references to (e.g.)
"products(:version_control_book)"
3. Got to "test_checkout" (in "Testing Controllers" on page 158) - then
all hell broke loose. Many, many errors scrolled past too quickly to
see.
4....