I can see the error is at the top. I was told that the test is looking for two arguments. I am still learning so I am not sure how to fix the arguments.
This is error in Terminal i separated all my errors with these ==== they where not apart of the error but I was displaying the files so that you can see how I got to where I am now. I really want to go ahead and finish this app.
new-host:depot Tony$ rake test:units
test': wrong number of arguments (1 for 2) (ArgumentError)
from /Users/Tony/work/depot/test/unit/product_test.rb:1:in <top (required)>’
from /Users/Tony/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in block in require’
from /Users/Tony/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in require’
block (2 levels) in <main>'
from /Users/Tony/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in each’
block in <main>'
from /Users/Tony/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in select’
from /Users/Tony/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `'
Command failed with status (1): [/Users/Tony/.rvm/rubies/ruby-1.9.3-p125...]
=================== this is my product_test.rb file ===================
class ProductTest < ActiveSupport::TestCase fixtures :products #… end
test “product is not valid without a unique title” do product = Product.new(title: products(:ruby).title, description: “yyy”, price: 1, image_url: “fred.gif”) assert !product.save assert_equal “has already been taken”, product.errors[:title].join(‘; ‘) end
test “product price must be positive” do product = Product.new(title: “My Book Title”, description: “yyy”, image_url: “zzz.jpg”) product.price = -1 assert product.invalid? assert_equal “must be greater than or equal to 0.01”, product.errors[:price].join(‘; ‘) product.price = 0 assert product.invalid? assert_equal “must be greater than or equal to 0.01”, product.errors[:price].join(‘; ‘) product.price = 1 assert product.valid? end
test “product is not valid without a unique title - i18n” do product = Product.new(title: products(:ruby).title, description: “yyy”, price: 1, image_url: “fred.gif”) assert !product.save assert_equal I18n.translate(‘activerecord.errors.messages.taken’), product.errors[:title].join(‘; ‘) end
===================== my products_controller_test.rb file ======================
test “should create product” do assert_difference(‘Product.count’) do post :create, product: @update end
assert_redirected_to product_path(assigns(:product)) end
# … test “should update product” do put :update, id: @product, product: @update assert_redirected_to product_path(assigns(:product)) end # … end
================== my file on the test_helper.rb ==================
ENV[“RAILS_ENV”] = “test” require File.expand_path(‘../../config/environment’, FILE) require ‘rails/test_help’
class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You’ll currently still have to declare fixtures explicitly in integration tests # – they do not yet inherit this setting fixtures :all
# Add more helper methods to be used by all tests here… end