docs icon indicating copy to clipboard operation
docs copied to clipboard

The "Writing explicit tests for SQL kata" sample test suite does not compile

Open interrupt-routine opened this issue 6 months ago • 0 comments

URL: https://docs.codewars.com/languages/sql/explicit-tests

The code will fail to compile when tried in a kumite:

./spec/support/preloaded.rb:6:in `show_diff_table': uninitialized constant DaffWrapper (NameError)

After taking a look at https://github.com/codewars/sql_spec_helper/blob/main/lib/sql_spec_helper/daff_wrapper.rb , I came up with a hotfix for the issue: DaffWrapper needs to be qualified, since it's an inner class (no idea why it once compiled, perhaps because the preloaded SQL section used to be concatenated to the tests but is now in its separate file).

qualifying DaffWrapper --> SqlSpecHelper::DaffWrapper makes the code compile.

(Though the whole tutorial is probably a bit outdated. Also, maybe it would be good to at least provide a link to the https://github.com/codewars/sql_spec_helper/tree/main repository in the https://docs.codewars.com/languages/sql/rspec doc page that's currently entirely empty).

interrupt-routine avatar May 02 '25 21:05 interrupt-routine