When using the rails g administrate:dashboard generator with an
uninitialized model name, the method will raise a NameError but the
app/dashboards/#{foo}_dashboard.rb file will be created regardless.
This happens because the generator uses the built-in file_name
parameter to create the file name regardless of whether or not the rest
of the generator runs.
To solve this, we simply check whether or not klass is truthy before
actually generating the file because this is the same guard that we use for the
rest of the generator.
I did have a problem writing the test case for this. I expect the run_generator method to raise and expect the file to not exist. It's interesting because... it definitely does raise a NameError but it raises before the test expectations happen. Could use some direction there