Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
Quintus opened this Issue · 2 comments

2 participants

@Quintus

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
Owner

Duplicate of #2645

@tenderlove tenderlove was assigned
@tenderlove
Owner

Fixed in e46c4f1

@tenderlove tenderlove closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.