rc8: Obscure error message with invalid YAML in fixtures #2731

Closed
Quintus opened this Issue Aug 29, 2011 · 2 comments

Comments

Projects
None yet
2 participants
@Quintus

Quintus commented Aug 29, 2011

Hi there,

When putting invalid YAML into the files in test/fixtures, the errors are reported fine when using Syck as the YAML parser:

MainPageTest:
    ERROR should correctly determine languages (0.00s) 
          ActiveRecord::Fixture::FormatError: a YAML error occurred parsing some/path/here/test/fixtures/users.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html
The exact error was:
  ArgumentError: syntax error on line 28, col -1: `  first_name: "Foo"

However, when Psych (the default) is in action, the error message looks like this:

MainPageTest:
    ERROR should correctly determine languages (0.03s) 
          Psych::SyntaxError: couldn't parse YAML at line 29 column 2
          /opt/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0.rc8/lib/active_record/fixtures.rb:719:in `parse_yaml_string'

The latter is not really informative as it doesn't give me any clue in which file I have misformatted YAML code. It shouldn't be too hard to capture the Psych::SyntaxError exception the same way Syck errors are cought and formatted?

ruby -v: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
OS: Arch Linux
rails -v: Rails 3.1.0.rc8

Marvin

@tenderlove

This comment has been minimized.

Show comment Hide comment
@tenderlove

tenderlove Aug 29, 2011

Owner

Duplicate of #2645

Owner

tenderlove commented Aug 29, 2011

Duplicate of #2645

@tenderlove

This comment has been minimized.

Show comment Hide comment
@tenderlove

tenderlove Sep 1, 2011

Owner

Fixed in e46c4f1

Owner

tenderlove commented Sep 1, 2011

Fixed in e46c4f1

@tenderlove tenderlove closed this Sep 1, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment