Sha256: 2bb4493d878823f5720cab286fc6111ac6c78566a8e51e1f7c8e63b7b8c41137
Contents?: true
Size: 988 Bytes
Versions: 1
Compression:
Stored size: 988 Bytes
Contents
describe Mysql2QueryFilter do let(:client) { Mysql2::Client.new } context 'when using filters' do let(:filter1) do Class.new(Mysql2QueryFilter::Base) do def filter(sql, client); sql << ' through filter1'; end end end let(:filter2) do Class.new(Mysql2QueryFilter::Base) do def filter(sql, client); sql << ' through filter2'; end end end before do Mysql2QueryFilter.configure do |filter| filter.add filter1 filter.add filter2 end end it do expect(client).to receive(:query_without_filter).with('select 1 through filter1 through filter2') client.query('select 1') end end context 'when using a plug-in' do before do Mysql2QueryFilter.configure do |filter| filter.plugin :test_plugin end end it do expect(client).to receive(:query_without_filter).with('select 1 through plugin') client.query('select 1') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mysql2_query_filter-0.1.1 | spec/mysql2_query_filter_spec.rb |