I run test:

test:units

lass ProductTest < ActiveSupport::TestCase

   test "product attributes not be empty" do
     product = Product.new
     assert product.invalid?
     assert product.errors[:title].any?
     assert product.errors[:description].any?
     assert product.errors[:price].any?
     assert product.errors[:image_url].any?

  end

  test "price musst be positive" do
    product = Product.new(
      title: "mybook",
      description: "yyy",
      image_url: "img.jpg")
    product.price = -1

    assert product.invalid?
    assert_equal "musst be greater than or equal to 0.01",
product.errors[:price].join(';')

    product.price = 0
    assert product.invalid?
    assert_equal "musst be greater than or equal to 0.01",
product.errors[:price].join(';')

    product.price = 1
    assert product.invalid?

  end
end

Show error: 1) Error:
test_product_attributes_not_be_empty(ProductTest):
ActiveRecord::Fixture::FormatError: a YAML error occurred parsing
/home/dima/RubyOnRails/Projects/depot/test/fixtures/products.yml. Please
note that YAML must be consistently indented using spaces. Tabs are not
allowed. The exact error was:
  Psych::SyntaxError: (<unknown>): did not find expected key while
parsing a block mapping at line 3 column 1

I dont undestand what they mean?

Its my product.yml:

one:
   title: MyString
  description: MyText
  image_url: MyString
  price: 9.99

two:
   title: MyString
  description: MyText
  image_url: MyString
  price: 9.99

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to