similar to: Unit Testing failure

Displaying 20 results from an estimated 200 matches similar to: "Unit Testing failure"

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 30
2
Cannot see what I have done wrong.
In the Agile Rails tutorial I am revisiting building a cart. I have followed the steps given in the book to create the class ''Cart'' thus: class Cart attr_reader :items attr_reader :total_price def add_product(product) @items << LineItem.for_product(product) @total_price += product.price end def initialize @items = [] @total_price = 0.0 end
2006 Feb 12
0
no method error - you have a nil object....
hi, i''ve been cracking my head on this one for a while and would be humbly grateful for any pointers i''m working through Agile Web Devopment w Rails and, in the depot example have created the cart class for session handling, but am getting the following error, which suggests the @items variable is not being populated with any data from LineItem NoMethodError (You have a
2006 Feb 26
0
NoMethodError in Agile Web Devleopment Depot Tutorial
I''m working on building the shopping cart in the Depot tutorial in the Agile Web Development book. I''m at the part (about page 80) where you build the ability to add items to the cart. I''m able to get to /store/display_cart/ and it seems items are being added, but if I just click on a link to add an item (/store/add_to_cart/2) it gives me this: NoMethodError in
2006 Feb 01
1
Problems with sample code from "agile webdev. w. rails"
Hello, I am veeeery new to rails and also to ruby. I have 2 books here on my desk and try to go through it. The first book is "Agile Webdevelopment with Rails" and I have trouble with the following code which I have from the book. I cant get it working. I searched a lot on google - and also on the erata pages of the book publisher but without any luck. I hope someone can help me.
2006 Feb 27
1
Odd problem in Agile tutorial
I am getting an undefined method error in my cart.rb class when trying to find in an array. I cannot see what my error is. Perhaps a view more eyes can help me with this: #--------------------------------------------------------------- 1 class Cart 2 3 attr_reader :items 4 attr_reader :total_price 5 6 def initialize 7 @items = [] 8
2006 Aug 13
3
Logging in Rails
This is a newbie question, I have a class which is not derived from ActionController or ActiveRecord but I want to use logging, I tried require but still logging does not work - This class is located in a file in "model" directory. ------------------------------------ require ''logger'' class Cart def add_product(product) logger.info("Searching for product
2006 Jan 19
3
Troubleshooting Depot App
Hello! I am working my way through the Agile Web Development guide on RoR (the depot application). I am a bit lost as to where to debug the following error. The error is pasted below: ================================================================================================ NameError in Store#add_to_cart undefined local variable or method `product'' for LineItem:Class
2006 Jan 31
2
asigning values to atributies when source is nil
I want to use something similar to the following: @total_price += { product.price <> nil ? product.price : 0.0 } This fails in rails with a "nil can''t be coerced into Float" error. What is the (most) correct way to do this? On a related issue, what is the significance of the value 40 following "cart.rb" in the trace snippet below? The entire class file
2006 Jun 23
3
Yet another problem with NoMethodError in Store#display_cart
Hi everybody, I''ve search a lot on google to help me with this one without success. I know that some people had the same problem as I have, but there solutions doesn''t seems to work for me. I''m trying to do the depot example in the AWDwR book. But now I''m stock with a problem that I can''t solve. I get this error: <--- begin error here --->
2008 Apr 15
2
NoMethodError in StoreController#add_to_cart
I''m trying to set up the Depot app from Agile Web Development and I got this error after C1 - Creating a Cart. The exact error looks like this: ------------------------------------------------------------------- NoMethodError in StoreController#add_to_cart You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while
2006 Jul 24
1
Newbie error: undefined local variable or method
When I add an item to the shopping cart, I get an error: undefined local variable or method `cart_item'' for #<#<Class:0x3715a78>:0x3715a48> Session info says the cart being updated properly. I''m just not able to output two variables: <%= cart_item.quantity %> &times; <%= h(cart_item.title) %> I did some research, and I can grasp that local
2006 Jan 25
1
Agile arguement error
Working my way through chapter 8 of "Agile Web Development...", I''m getting the following error when clicking the add_to_cart button. ArgumentError in Store#add_to_cart wrong number of arguments (0 for 1) What am I doing wrong? I know it''s got to be some thing stupid. Request: Parameters: {"id"=>"1"} session dump: --- :cart:
2006 Aug 04
6
Errors ... errors and errors.
I bought the second edition of the ruby on rails, it seems to work fine now, did some adjustments to the code. But now I get a second error and I want to learn to understand to fix them myself. So here is the error. ArgumentError in StoreController#add_to_cart wrong number of arguments (1 for 0) #{RAILS_ROOT}/app/models/cart.rb:15:in `initialize'' #{RAILS_ROOT}/app/models/cart.rb:15:in
2006 Aug 02
7
Same error ... again.
I reached page 82 of the Book "Agile Development with Rails" First Edition. After I compiled the code I got the following error message. [CODE] NoMethodError in Store#display_cart Showing app/views/store/display_cart.rhtml where line #11 raised: undefined method `product'' for 1099.0:Float 8: <table> 9: <% 10: for item in @items 11: product = item.product 12:
2007 Aug 30
3
Rails - depot application
I''m doing the depot example in the Agle Web development book. I''m getting this error: "undefined method `product'' for #<BigDecimal:331ce70,''0.21E1'',8(8)> " "Extracted source (around line #9): 8: for item in @items 9: product = item.product 10: -%> 11: <tr> 12: <td><%= item.product%></td>"
2007 Feb 07
1
The Depot "Add to Cart" sessions question (2.ed agile book)
Hello, Im in the process of working my way through the 2.ed of the agile book. As many of you already know, the book goes through the regular development cycle of the Depot application. I have hit a wall when they started talking about the sessions and the exact mechanics of how an item is added to the session. The code looks like this: depot/app/controllers/store_controller: def add_to_cart
2008 Jul 10
5
Uninitialized constant (controller/model)
NameError in StoreController#add_to_cart uninitialized constant StoreController::Cart This is the controller: class StoreController < ApplicationController def index @products = Product.find_products_for_sale end def add_to_cart @cart = find_cart product = Product.find(params[:id]) @cart.add_product(product) end private def find_cart session[:cart] ||=
2006 Jan 25
2
Agile tutorial
Thank you for the comments on conditional replacements. I now have another oddity to deal with. When adding products to the session cart I am not able to have the count incremented if the product has already been selected, rather another item is added to the cart. I copied the code from the book as carefully as I could and could find no error but to be sure I then cut and pasted the code
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