Advice on writing Ruby tests for plugins

You need to use the directory name for you plugin here. So if it’s under /plugins/discourse-disraptor, then you run bundle exec rake plugin:spec[discourse-distraptor]

Why not just put the data in the database? Before testing the get_routes function, run this:

PluginStore.set(MyPlugin::PLUGIN_NAME, 'key', 'valuefortest')

The database is cleaned up automatically after each individual test. (tests run in a DB transaction, which is rolled back automatically)