Error: did not find expected key while parsing a block mapping

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: (): 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

help please)

On 14 March 2013 16:26, Dmitrij B. [email protected] wrote:

Its my product.yml:

one:
title: MyString
description: MyText

The clue is in the error message, which says there is a problem with
line above and says that yaml must be consistently indented using
spaces. It looks from your pasted text that line three two has three
spaces and line three has two, so the spacing is not consistent.

Colin

I read about the mistake, but I thought that this is due to the other.
Thanks)))

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs