|
268 | 268 | end |
269 | 269 | end |
270 | 270 |
|
271 | | - describe 'memoization' do |
272 | | - it "should memoize enum message" do |
273 | | - test_enum = Test::EnumTestMessage.new |
274 | | - test_enum.encode |
275 | | - expect(test_enum.instance_variable_get(:@encode)).to eq("") |
276 | | - test_enum.non_default_enum = 2 |
277 | | - expect(test_enum.instance_variable_get(:@encode)).to be_nil |
278 | | - end |
279 | | - |
280 | | - context "boolean fields" do |
281 | | - let(:values) { { :ext_is_searchable => true, :name => "STEPH CURRY" } } |
282 | | - let(:test_resource) { ::Test::Resource.new(values) } |
283 | | - |
284 | | - it "should memoize after bool values change " do |
285 | | - test_resource.encode |
286 | | - expect(test_resource.instance_variable_get(:@encode)).to eq(test_resource.encode) |
287 | | - test_resource.ext_is_searchable = false |
288 | | - expect(test_resource.instance_variable_get(:@encode)).to be_nil |
289 | | - end |
290 | | - end |
291 | | - |
292 | | - context "string" do |
293 | | - let(:values) { { :ext_is_searchable => true, :name => "STEPH CURRY" } } |
294 | | - let(:test_resource) { ::Test::Resource.new(values) } |
295 | | - |
296 | | - it "should memoize after bool values change " do |
297 | | - test_resource.encode |
298 | | - expect(test_resource.instance_variable_get(:@encode)).to eq(test_resource.encode) |
299 | | - test_resource.name = "MVP" |
300 | | - expect(test_resource.instance_variable_get(:@encode)).to be_nil |
301 | | - end |
302 | | - end |
303 | | - |
304 | | - context "string" do |
305 | | - let(:values) { { :ext_is_searchable => true, :name => "STEPH CURRY" } } |
306 | | - let(:test_resource) { ::Test::Resource.new(values) } |
307 | | - |
308 | | - it "should memoize after string values change " do |
309 | | - test_resource.encode |
310 | | - expect(test_resource.instance_variable_get(:@encode)).to eq(test_resource.encode) |
311 | | - test_resource.name = "MVP" |
312 | | - expect(test_resource.instance_variable_get(:@encode)).to be_nil |
313 | | - end |
314 | | - end |
315 | | - |
316 | | - context "Int64" do |
317 | | - let(:values) { { :name => "STEPH CURRY", :date_created => 1454712125 } } |
318 | | - let(:test_resource) { ::Test::Resource.new(values) } |
319 | | - |
320 | | - it "should memoize after Int64 values change " do |
321 | | - test_resource.encode |
322 | | - expect(test_resource.instance_variable_get(:@encode)).to eq(test_resource.encode) |
323 | | - test_resource.date_created = 5554712127 |
324 | | - expect(test_resource.instance_variable_get(:@encode)).to be_nil |
325 | | - end |
326 | | - end |
327 | | - end |
328 | | - |
329 | 271 | context "when there's no value for a required field" do |
330 | 272 | let(:message) { ::Test::ResourceWithRequiredField.new } |
331 | 273 |
|
|
0 commit comments