Sha256: 978a0ebc99f1b5bbfbcea557bdadb176a7c8d1a886ec61caf0c9e6b8129b9a5e
Contents?: true
Size: 1.86 KB
Versions: 34
Compression:
Stored size: 1.86 KB
Contents
require 'fluent_plugins_spec_helper' require 'flydata/plugin_support/context' describe ::Flydata::PluginSupport::Context do class DummySourcePos def initialize(str) @str = str end def self.load(str) self.new(str) end attr_reader :str end class TestContext < described_class SOURCE_POS_CLASS = DummySourcePos end let(:subject_object) { TestContext.new(params) } let(:sync_fm) { double('sync_fm') } describe '#initialize' do subject { subject_object } before do allow(sync_fm).to receive(:get_table_source_raw_pos) do |tbl| "#{tbl}_binlog_pos" end end context 'when no missing params' do let(:params) { { tables: %w(table_a table_b table_c), tag: 'test_tag', sync_fm: sync_fm, omit_events: {'table_c' => %i(delete truncate_table)}, table_revs: {'table_a' => 1, 'table_b' => 2, 'table_c' => 3}, } } it { expect{subject}.not_to raise_error } it { expect(subject.tables).to eq(%w(table_a table_b table_c)) } it { expect(subject.tag).to eq('test_tag') } it { expect(subject.sync_fm).to eq(sync_fm) } it { expect(subject.omit_events).to eq({'table_c' => %i(delete truncate_table)}) } it { expect(subject.table_revs).to eq({'table_a' => 1, 'table_b' => 2, 'table_c' => 3}) } =begin it do binlog_pos = subject.table_binlog_pos expect(binlog_pos.keys.size).to eq(3) expect(binlog_pos['table_a']).to be_kind_of(DummySourcePos) expect(binlog_pos['table_a'].str).to eq('table_a_binlog_pos') expect(binlog_pos['table_b']).to be_kind_of(DummySourcePos) expect(binlog_pos['table_b'].str).to eq('table_b_binlog_pos') expect(binlog_pos['table_c']).to be_kind_of(DummySourcePos) expect(binlog_pos['table_c'].str).to eq('table_c_binlog_pos') end =end end end end
Version data entries
34 entries across 34 versions & 1 rubygems