David Taylor c9dab6fd08
DEV: Automatically require 'rails_helper' in all specs (#16077)
It's very easy to forget to add `require 'rails_helper'` at the top of every core/plugin spec file, and omissions can cause some very confusing/sporadic errors.

By setting this flag in `.rspec`, we can remove the need for `require 'rails_helper'` entirely.
2022-03-01 17:50:50 +00:00

29 lines
782 B
Ruby

# frozen_string_literal: true
describe DiscourseNarrativeBot::Store do
describe '.set' do
it 'should set the right value in the plugin store' do
key = 'somekey'
described_class.set(key, 'yay')
plugin_store_row = PluginStoreRow.last
expect(plugin_store_row.value).to eq('yay')
expect(plugin_store_row.plugin_name).to eq(DiscourseNarrativeBot::PLUGIN_NAME)
expect(plugin_store_row.key).to eq(key)
end
end
describe '.get' do
it 'should get the right value from the plugin store' do
PluginStoreRow.create!(
plugin_name: DiscourseNarrativeBot::PLUGIN_NAME,
key: 'somekey',
value: 'yay',
type_name: 'string'
)
expect(described_class.get('somekey')).to eq('yay')
end
end
end