Sha256: 4b8730eb19671148130508ea1fb9404728f9aeea9f44574d95368e6b9ebc6a01
Contents?: true
Size: 1007 Bytes
Versions: 21
Compression:
Stored size: 1007 Bytes
Contents
require 'spec_helper' describe ::Protobuf::ActiveRecord::Transformer do let(:callable) { lambda { |proto| proto.name } } let(:proto) { ::UserMessage.new(:name => 'test', :nullify => ['name']) } let(:options) { {} } subject { described_class.new(callable, options) } describe '#call' do it 'calls the callable' do result = subject.call(proto) expect(result).to eq('test') end end describe '#nullify?' do context 'no nullify_on set' do it 'returns false' do expect(subject.nullify?(proto)).to eq(false) end end context 'nullify_on name' do let(:options) { { :nullify_on => :name } } context 'invalid message' do let(:proto) { ::UserSearchMessage.new } it 'returns false' do expect(subject.nullify?(proto)).to eq(false) end end context 'valid message' do it 'returns true' do expect(subject.nullify?(proto)).to eq(true) end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems