spec/consumer_spec.rb in deimos-ruby-1.7.0.pre.beta1 vs spec/consumer_spec.rb in deimos-ruby-1.8.0.pre.beta1

- old
+ new

@@ -1,14 +1,14 @@ # frozen_string_literal: true # :nodoc: module ConsumerTest - describe Deimos::Consumer do + describe Deimos::Consumer, 'Message Consumer' do prepend_before(:each) do # :nodoc: - consumer_class = Class.new(Deimos::Consumer) do + consumer_class = Class.new(described_class) do schema 'MySchema' namespace 'com.my-namespace' key_config field: 'test_id' # :nodoc: @@ -119,32 +119,32 @@ expect(MyConsumer.new.decode_key('test_id' => '123')).to eq('123') expect { MyConsumer.new.decode_key(123) }.to raise_error(NoMethodError) end it 'should use the key schema if set' do - consumer_class = Class.new(Deimos::Consumer) do + consumer_class = Class.new(described_class) do schema 'MySchema' namespace 'com.my-namespace' key_config schema: 'MySchema_key' end stub_const('ConsumerTest::MySchemaConsumer', consumer_class) expect(MyConsumer.new.decode_key('test_id' => '123')).to eq('123') expect { MyConsumer.new.decode_key(123) }.to raise_error(NoMethodError) end it 'should not decode if plain is set' do - consumer_class = Class.new(Deimos::Consumer) do + consumer_class = Class.new(described_class) do schema 'MySchema' namespace 'com.my-namespace' key_config plain: true end stub_const('ConsumerTest::MyNonEncodedConsumer', consumer_class) expect(MyNonEncodedConsumer.new.decode_key('123')).to eq('123') end it 'should error with nothing set' do - consumer_class = Class.new(Deimos::Consumer) do + consumer_class = Class.new(described_class) do schema 'MySchema' namespace 'com.my-namespace' end stub_const('ConsumerTest::MyErrorConsumer', consumer_class) expect { MyErrorConsumer.new.decode_key('123') }. @@ -154,10 +154,10 @@ end describe 'timestamps' do before(:each) do # :nodoc: - consumer_class = Class.new(Deimos::Consumer) do + consumer_class = Class.new(described_class) do schema 'MySchemaWithDateTimes' namespace 'com.my-namespace' key_config plain: true # :nodoc: