Dmitrij B.
2013-Mar-14 16:26 UTC
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: (<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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Dmitrij B.
2013-Mar-14 19:59 UTC
Re: Error: did not find expected key while parsing a block mapping
help please) -- 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Mar-14 21:17 UTC
Re: Error: did not find expected key while parsing a block mapping
On 14 March 2013 16:26, Dmitrij B. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> ... > 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: MyTextThe 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 -- 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Dmitrij B.
2013-Mar-15 09:33 UTC
Re: Error: did not find expected key while parsing a block mapping
I read about the mistake, but I thought that this is due to the other. Thanks))) -- 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.