Open chrismytton opened 7 years ago
If you forget to specify the class name in the YAML the error message you get is quite hard to decipher.
$ bundle exec rake test Run options: --seed 5248 # Running: E Finished in 0.006394s, 156.4078 runs/s, 0.0000 assertions/s. 1) Error: Scraper tests#test_0001_should contain the expected data: TypeError: no implicit conversion of nil into String /Users/chris/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/bundler/gems/scraper_test-41fc622fe61a/lib/scraper_test.rb:32:in `const_get' /Users/chris/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/bundler/gems/scraper_test-41fc622fe61a/lib/scraper_test.rb:32:in `block (4 levels) in install_tasks' /Users/chris/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/bundler/gems/scraper_test-41fc622fe61a/lib/scraper_test.rb:29:in `each' /Users/chris/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/bundler/gems/scraper_test-41fc622fe61a/lib/scraper_test.rb:29:in `block (3 levels) in install_tasks' 1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
Check for the class key in the data file and if it's missing print a friendly error message if it's missing.
class
Running the tests for data files that don't have a class property should produce a friendly error message.
Problem
If you forget to specify the class name in the YAML the error message you get is quite hard to decipher.
Proposed solution
Check for the
class
key in the data file and if it's missing print a friendly error message if it's missing.Acceptance criteria
Running the tests for data files that don't have a
class
property should produce a friendly error message.