Displaying 2 results from an estimated 2 matches for "ruby_book".
2006 Jan 04
5
check if a file exists?
Hello all!
I have a list of people on a page, and some of this people have pictures
of them stored on the web server. So I have an image tag like this on my
page:
<%= image_tag "/images/people/" + person.pers_id.to_s + ".jpg" %>
But not all have a picture, so if the file for pers_id=1899 does not
exist, i would like to display a custom image for that guy.
How can I do
2006 Jun 25
1
Unit Testing failure
...but was
<3579>.
2 tests, 3 assertions, 1 failures, 0 errors
require File.dirname(__FILE__) + ''/../test_helper''
class CartTest < Test::Unit::TestCase
fixtures :products
def setup
@cart = Cart.new
@rails = products(:rails_book)
@ruby = products(:ruby_book)
end
def test_add_unique_products
@cart.add_product @rails
@cart.add_product @ruby
assert_equal 2, @cart.items.size
assert_equal @rails.price + @ruby.price, @cart.total_price
end
def test_add_duplicate_product
@cart.add_product @rails
@cart.add_product...