rambling-trie 1.0.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +6 -4
  3. data/Guardfile +3 -1
  4. data/README.md +4 -4
  5. data/Rakefile +4 -0
  6. data/lib/rambling-trie.rb +2 -0
  7. data/lib/rambling/trie.rb +25 -9
  8. data/lib/rambling/trie/comparable.rb +4 -1
  9. data/lib/rambling/trie/compressible.rb +6 -4
  10. data/lib/rambling/trie/compressor.rb +12 -10
  11. data/lib/rambling/trie/configuration.rb +3 -1
  12. data/lib/rambling/trie/configuration/properties.rb +15 -8
  13. data/lib/rambling/trie/configuration/provider_collection.rb +4 -1
  14. data/lib/rambling/trie/container.rb +7 -40
  15. data/lib/rambling/trie/enumerable.rb +2 -0
  16. data/lib/rambling/trie/inspectable.rb +2 -0
  17. data/lib/rambling/trie/invalid_operation.rb +3 -1
  18. data/lib/rambling/trie/nodes.rb +3 -1
  19. data/lib/rambling/trie/nodes/compressed.rb +53 -70
  20. data/lib/rambling/trie/nodes/missing.rb +2 -0
  21. data/lib/rambling/trie/nodes/node.rb +38 -6
  22. data/lib/rambling/trie/nodes/raw.rb +19 -26
  23. data/lib/rambling/trie/readers.rb +3 -1
  24. data/lib/rambling/trie/readers/plain_text.rb +2 -0
  25. data/lib/rambling/trie/serializers.rb +3 -1
  26. data/lib/rambling/trie/serializers/file.rb +2 -0
  27. data/lib/rambling/trie/serializers/marshal.rb +12 -2
  28. data/lib/rambling/trie/serializers/yaml.rb +18 -2
  29. data/lib/rambling/trie/serializers/zip.rb +6 -0
  30. data/lib/rambling/trie/stringifyable.rb +7 -1
  31. data/lib/rambling/trie/version.rb +3 -1
  32. data/rambling-trie.gemspec +21 -10
  33. data/spec/integration/rambling/trie_spec.rb +8 -4
  34. data/spec/lib/rambling/trie/comparable_spec.rb +2 -0
  35. data/spec/lib/rambling/trie/compressor_spec.rb +35 -33
  36. data/spec/lib/rambling/trie/configuration/properties_spec.rb +17 -9
  37. data/spec/lib/rambling/trie/configuration/provider_collection_spec.rb +10 -14
  38. data/spec/lib/rambling/trie/container_spec.rb +28 -53
  39. data/spec/lib/rambling/trie/enumerable_spec.rb +2 -0
  40. data/spec/lib/rambling/trie/inspectable_spec.rb +32 -7
  41. data/spec/lib/rambling/trie/nodes/compressed_spec.rb +2 -0
  42. data/spec/lib/rambling/trie/nodes/node_spec.rb +2 -0
  43. data/spec/lib/rambling/trie/nodes/raw_spec.rb +2 -0
  44. data/spec/lib/rambling/trie/readers/plain_text_spec.rb +3 -1
  45. data/spec/lib/rambling/trie/serializers/file_spec.rb +2 -0
  46. data/spec/lib/rambling/trie/serializers/marshal_spec.rb +2 -0
  47. data/spec/lib/rambling/trie/serializers/yaml_spec.rb +2 -0
  48. data/spec/lib/rambling/trie/serializers/zip_spec.rb +6 -4
  49. data/spec/lib/rambling/trie/stringifyable_spec.rb +7 -3
  50. data/spec/lib/rambling/trie_spec.rb +16 -9
  51. data/spec/spec_helper.rb +10 -7
  52. data/spec/support/config.rb +6 -0
  53. data/spec/support/helpers/add_word.rb +2 -0
  54. data/spec/support/helpers/one_line_heredoc.rb +11 -0
  55. data/spec/support/shared_examples/a_compressible_trie.rb +7 -3
  56. data/spec/support/shared_examples/a_serializable_trie.rb +2 -0
  57. data/spec/support/shared_examples/a_serializer.rb +2 -0
  58. data/spec/support/shared_examples/a_trie_data_structure.rb +2 -0
  59. data/spec/support/shared_examples/a_trie_node.rb +15 -5
  60. data/spec/support/shared_examples/a_trie_node_implementation.rb +10 -6
  61. metadata +17 -15
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Configuration::Properties do
@@ -6,27 +8,33 @@ describe Rambling::Trie::Configuration::Properties do
6
8
  describe '.new' do
7
9
  it 'configures the serializers' do
8
10
  serializers = properties.serializers
9
- expect(serializers.formats).to match_array %i(marshal yaml yml zip)
10
11
 
11
- expect(serializers[:marshal]).to be_instance_of Rambling::Trie::Serializers::Marshal
12
- expect(serializers[:yaml]).to be_instance_of Rambling::Trie::Serializers::Yaml
13
- expect(serializers[:yml]).to be_instance_of Rambling::Trie::Serializers::Yaml
14
- expect(serializers[:zip]).to be_instance_of Rambling::Trie::Serializers::Zip
12
+ expect(serializers.formats).to match_array %i(marshal yaml yml zip)
13
+ expect(serializers.providers.to_a).to match_array [
14
+ [:marshal, Rambling::Trie::Serializers::Marshal],
15
+ [:yaml, Rambling::Trie::Serializers::Yaml],
16
+ [:yml, Rambling::Trie::Serializers::Yaml],
17
+ [:zip, Rambling::Trie::Serializers::Zip],
18
+ ]
15
19
  end
16
20
 
17
21
  it 'configures the readers' do
18
22
  readers = properties.readers
19
- expect(readers.formats).to match_array %i(txt)
20
23
 
21
- expect(readers[:txt]).to be_instance_of Rambling::Trie::Readers::PlainText
24
+ expect(readers.formats).to match_array %i(txt)
25
+ expect(readers.providers.to_a).to match_array [
26
+ [:txt, Rambling::Trie::Readers::PlainText],
27
+ ]
22
28
  end
23
29
 
24
30
  it 'configures the compressor' do
25
- expect(properties.compressor).to be_instance_of Rambling::Trie::Compressor
31
+ compressor = properties.compressor
32
+ expect(compressor).to be_instance_of Rambling::Trie::Compressor
26
33
  end
27
34
 
28
35
  it 'configures the root_builder' do
29
- expect(properties.root_builder.call).to be_instance_of Rambling::Trie::Nodes::Raw
36
+ root = properties.root_builder.call
37
+ expect(root).to be_instance_of Rambling::Trie::Nodes::Raw
30
38
  end
31
39
  end
32
40
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Configuration::ProviderCollection do
@@ -13,7 +15,7 @@ describe Rambling::Trie::Configuration::ProviderCollection do
13
15
  Rambling::Trie::Configuration::ProviderCollection.new(
14
16
  :provider,
15
17
  configured_providers,
16
- configured_default
18
+ configured_default,
17
19
  )
18
20
  end
19
21
 
@@ -84,26 +86,20 @@ describe Rambling::Trie::Configuration::ProviderCollection do
84
86
  end
85
87
 
86
88
  context 'when the given value is not in the providers list' do
87
- it 'does not change the default provider' do
88
- expect do
89
- begin
90
- provider_collection.default = other_provider
91
- rescue
92
- end
93
- end.not_to change { provider_collection.default }
89
+ it 'raises an error and keeps the default provider' do
90
+ expect { provider_collection.default = other_provider }
91
+ .to raise_error
92
+ .and(not_change { provider_collection.default })
94
93
  end
95
94
 
96
95
  it 'raises an ArgumentError' do
97
- expect do
98
- provider_collection.default = other_provider
99
- end.to raise_error ArgumentError
96
+ expect { provider_collection.default = other_provider }
97
+ .to raise_error ArgumentError
100
98
  end
101
99
  end
102
100
 
103
101
  context 'when the providers list is empty' do
104
- let(:configured_providers) do
105
- {}
106
- end
102
+ let(:configured_providers) { {} }
107
103
 
108
104
  it 'accepts nil' do
109
105
  provider_collection.default = nil
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Container do
@@ -14,8 +16,8 @@ describe Rambling::Trie::Container do
14
16
  it 'yields the container' do
15
17
  yielded = nil
16
18
 
17
- container = Rambling::Trie::Container.new root, compressor do |container|
18
- yielded = container
19
+ container = Rambling::Trie::Container.new root, compressor do |c|
20
+ yielded = c
19
21
  end
20
22
 
21
23
  expect(yielded).to be container
@@ -188,7 +190,7 @@ describe Rambling::Trie::Container do
188
190
  children_tree: nil,
189
191
  compressed?: nil,
190
192
  each: nil,
191
- has_key?: nil,
193
+ key?: nil,
192
194
  inspect: nil,
193
195
  letter: nil,
194
196
  parent: nil,
@@ -225,11 +227,6 @@ describe Rambling::Trie::Container do
225
227
  expect(root).to have_received(:[]).with :yep
226
228
  end
227
229
 
228
- it 'delegates `#as_word` to the root node' do
229
- container.as_word
230
- expect(root).to have_received :as_word
231
- end
232
-
233
230
  it 'delegates `#children` to the root node' do
234
231
  container.children
235
232
  expect(root).to have_received :children
@@ -245,14 +242,19 @@ describe Rambling::Trie::Container do
245
242
  expect(root).to have_received :compressed?
246
243
  end
247
244
 
248
- it 'delegates `#has_key?` to the root node' do
245
+ it 'delegates `#key?` to the root node' do
246
+ container.key? :yup
247
+ expect(root).to have_received(:key?).with :yup
248
+ end
249
+
250
+ it 'aliases `#has_key?` to `#key?`' do
249
251
  container.has_key? :yup
250
- expect(root).to have_received(:has_key?).with :yup
252
+ expect(root).to have_received(:key?).with :yup
251
253
  end
252
254
 
253
255
  it 'aliases `#has_letter?` to `#has_key?`' do
254
256
  container.has_letter? :yup
255
- expect(root).to have_received(:has_key?).with :yup
257
+ expect(root).to have_received(:key?).with :yup
256
258
  end
257
259
 
258
260
  it 'delegates `#inspect` to the root node' do
@@ -260,25 +262,10 @@ describe Rambling::Trie::Container do
260
262
  expect(root).to have_received :inspect
261
263
  end
262
264
 
263
- it 'delegates `#letter` to the root node' do
264
- container.letter
265
- expect(root).to have_received :letter
266
- end
267
-
268
- it 'delegates `#parent` to the root node' do
269
- container.parent
270
- expect(root).to have_received :parent
271
- end
272
-
273
265
  it 'delegates `#size` to the root node' do
274
266
  container.size
275
267
  expect(root).to have_received :size
276
268
  end
277
-
278
- it 'delegates `#to_s` to the root node' do
279
- container.to_s
280
- expect(root).to have_received :to_s
281
- end
282
269
  end
283
270
 
284
271
  describe '#compress!' do
@@ -417,17 +404,8 @@ describe Rambling::Trie::Container do
417
404
  end
418
405
 
419
406
  it 'returns an array with the words that match' do
420
- expect(container.scan 'hi').to eq [
421
- 'hi',
422
- 'high',
423
- 'highlight',
424
- 'histerical'
425
- ]
426
-
427
- expect(container.scan 'hig').to eq [
428
- 'high',
429
- 'highlight'
430
- ]
407
+ expect(container.scan 'hi').to eq %w(hi high highlight histerical)
408
+ expect(container.scan 'hig').to eq %w(high highlight)
431
409
  end
432
410
 
433
411
  context 'and the root has been compressed' do
@@ -436,17 +414,8 @@ describe Rambling::Trie::Container do
436
414
  end
437
415
 
438
416
  it 'returns an array with the words that match' do
439
- expect(container.scan 'hi').to eq [
440
- 'hi',
441
- 'high',
442
- 'highlight',
443
- 'histerical'
444
- ]
445
-
446
- expect(container.scan 'hig').to eq [
447
- 'high',
448
- 'highlight'
449
- ]
417
+ expect(container.scan 'hi').to eq %w(hi high highlight histerical)
418
+ expect(container.scan 'hig').to eq %w(high highlight)
450
419
  end
451
420
  end
452
421
  end
@@ -457,7 +426,7 @@ describe Rambling::Trie::Container do
457
426
  end
458
427
 
459
428
  it 'returns an empty array' do
460
- expect(container.scan 'hi').to eq []
429
+ expect(container.scan 'hi').to eq %w()
461
430
  end
462
431
 
463
432
  context 'and the root has been compressed' do
@@ -466,7 +435,7 @@ describe Rambling::Trie::Container do
466
435
  end
467
436
 
468
437
  it 'returns an empty array' do
469
- expect(container.scan 'hi').to eq []
438
+ expect(container.scan 'hi').to eq %w()
470
439
  end
471
440
  end
472
441
  end
@@ -529,7 +498,8 @@ describe Rambling::Trie::Container do
529
498
 
530
499
  context 'phrase contains a few words' do
531
500
  it 'returns an array with all words found in the phrase' do
532
- expect(container.words_within 'xyzword otherzxyone').to match_array %w(word other one)
501
+ expect(container.words_within 'xyzword otherzxyone')
502
+ .to match_array %w(word other one)
533
503
  end
534
504
 
535
505
  context 'and the node is compressed' do
@@ -538,7 +508,8 @@ describe Rambling::Trie::Container do
538
508
  end
539
509
 
540
510
  it 'returns an array with all words found in the phrase' do
541
- expect(container.words_within 'xyzword otherzxyone').to match_array %w(word other one)
511
+ expect(container.words_within 'xyzword otherzxyone')
512
+ .to match_array %w(word other one)
542
513
  end
543
514
  end
544
515
  end
@@ -610,7 +581,11 @@ describe Rambling::Trie::Container do
610
581
  end
611
582
 
612
583
  it 'returns the container class name plus the root inspection' do
613
- expect(container.inspect).to eq '#<Rambling::Trie::Container root: #<Rambling::Trie::Nodes::Raw letter: nil, terminal: nil, children: [:a, :f, :w, :h]>>'
584
+ expect(container.inspect).to eq one_line <<~CONTAINER
585
+ #<Rambling::Trie::Container root: #<Rambling::Trie::Nodes::Raw letter: nil,
586
+ terminal: nil,
587
+ children: [:a, :f, :w, :h]>>
588
+ CONTAINER
614
589
  end
615
590
  end
616
591
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Rambling
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Inspectable do
@@ -12,19 +14,42 @@ describe Rambling::Trie::Inspectable do
12
14
  let(:terminal_node) { node[:o][:n][:l][:y] }
13
15
 
14
16
  it 'returns a pretty printed version of the node' do
15
- expect(node.inspect).to eq "#<Rambling::Trie::Nodes::Raw letter: nil, terminal: nil, children: [:o, :t, :w]>"
16
- expect(child.inspect).to eq "#<Rambling::Trie::Nodes::Raw letter: :o, terminal: nil, children: [:n]>"
17
- expect(terminal_node.inspect).to eq "#<Rambling::Trie::Nodes::Raw letter: :y, terminal: true, children: []>"
17
+ expect(node.inspect).to eq one_line <<~RAW
18
+ #<Rambling::Trie::Nodes::Raw letter: nil,
19
+ terminal: nil,
20
+ children: [:o, :t, :w]>
21
+ RAW
22
+
23
+ expect(child.inspect).to eq one_line <<~CHILD
24
+ #<Rambling::Trie::Nodes::Raw letter: :o,
25
+ terminal: nil,
26
+ children: [:n]>
27
+ CHILD
28
+
29
+ expect(terminal_node.inspect).to eq one_line <<~TERMINAL
30
+ #<Rambling::Trie::Nodes::Raw letter: :y,
31
+ terminal: true,
32
+ children: []>
33
+ TERMINAL
18
34
  end
19
35
 
20
36
  context 'for a compressed node' do
21
37
  let(:compressor) { Rambling::Trie::Compressor.new }
22
- let(:compressed_node) { compressor.compress node }
23
- let(:compressed_child) { compressed_node[:only] }
38
+ let(:compressed) { compressor.compress node }
39
+ let(:compressed_child) { compressed[:o] }
24
40
 
25
41
  it 'returns a pretty printed version of the compressed node' do
26
- expect(compressed_node.inspect).to eq "#<Rambling::Trie::Nodes::Compressed letter: nil, terminal: nil, children: [:only, :three, :words]>"
27
- expect(compressed_child.inspect).to eq "#<Rambling::Trie::Nodes::Compressed letter: :only, terminal: true, children: []>"
42
+ expect(compressed.inspect).to eq one_line <<~COMPRESSED
43
+ #<Rambling::Trie::Nodes::Compressed letter: nil,
44
+ terminal: nil,
45
+ children: [:o, :t, :w]>
46
+ COMPRESSED
47
+
48
+ expect(compressed_child.inspect).to eq one_line <<~CHILD
49
+ #<Rambling::Trie::Nodes::Compressed letter: :only,
50
+ terminal: true,
51
+ children: []>
52
+ CHILD
28
53
  end
29
54
  end
30
55
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Nodes::Compressed do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Nodes::Node do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Nodes::Raw do
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Readers::PlainText do
4
6
  describe '#each_word' do
5
7
  let(:filepath) { File.join(::SPEC_ROOT, 'assets', 'test_words.en_US.txt') }
6
- let(:words) { File.readlines(filepath).map &:chomp }
8
+ let(:words) { File.readlines(filepath).map(&:chomp) }
7
9
 
8
10
  it 'yields every word yielded by the file' do
9
11
  yielded = []
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Serializers::File do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Serializers::Marshal do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Serializers::Yaml do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Serializers::Zip do
@@ -10,17 +12,17 @@ describe Rambling::Trie::Serializers::Zip do
10
12
  properties.tmp_path = tmp_path
11
13
  end
12
14
 
13
- let(:filename) { File.basename(filepath).gsub /\.zip/, ''}
15
+ let(:filename) { File.basename(filepath).gsub %r{\.zip}, '' }
14
16
  let(:formatted_content) { zip Marshal.dump content }
15
17
 
16
18
  def zip content
17
- io = Zip::OutputStream.write_buffer do |io|
19
+ cursor = Zip::OutputStream.write_buffer do |io|
18
20
  io.put_next_entry filename
19
21
  io.write content
20
22
  end
21
23
 
22
- io.rewind
23
- io.read
24
+ cursor.rewind
25
+ cursor.read
24
26
  end
25
27
  end
26
28
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie::Stringifyable do
@@ -36,7 +38,8 @@ describe Rambling::Trie::Stringifyable do
36
38
  end
37
39
 
38
40
  it 'raises an error for a non terminal node' do
39
- expect { node[:l].as_word }.to raise_error Rambling::Trie::InvalidOperation
41
+ expect { node[:l].as_word }
42
+ .to raise_error Rambling::Trie::InvalidOperation
40
43
  end
41
44
  end
42
45
 
@@ -70,11 +73,12 @@ describe Rambling::Trie::Stringifyable do
70
73
 
71
74
  it 'returns the words for the terminal nodes' do
72
75
  expect(compressed_node[:m].as_word).to eq 'am'
73
- expect(compressed_node[:dd].as_word).to eq 'add'
76
+ expect(compressed_node[:d].as_word).to eq 'add'
74
77
  end
75
78
 
76
79
  it 'raise an error for non terminal nodes' do
77
- expect { compressed_node.as_word }.to raise_error Rambling::Trie::InvalidOperation
80
+ expect { compressed_node.as_word }
81
+ .to raise_error Rambling::Trie::InvalidOperation
78
82
  end
79
83
  end
80
84
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Rambling::Trie do
@@ -31,7 +33,10 @@ describe Rambling::Trie do
31
33
 
32
34
  before do
33
35
  receive_and_yield = receive(:each_word)
34
- words.inject(receive_and_yield) { |yielder, word| yielder.and_yield word }
36
+ words.inject(receive_and_yield) do |yielder, word|
37
+ yielder.and_yield word
38
+ end
39
+
35
40
  allow(reader).to receive_and_yield
36
41
  allow(container).to receive :<<
37
42
  end
@@ -40,7 +45,7 @@ describe Rambling::Trie do
40
45
  Rambling::Trie.create filepath, reader
41
46
 
42
47
  words.each do |word|
43
- expect(container).to have_received(:<<).with(word)
48
+ expect(container).to have_received(:<<).with word
44
49
  end
45
50
  end
46
51
  end
@@ -77,7 +82,7 @@ describe Rambling::Trie do
77
82
  end
78
83
 
79
84
  it 'uses the serializer to load the root node from the given filepath' do
80
- trie = Rambling::Trie.load filepath, serializer
85
+ Rambling::Trie.load filepath, serializer
81
86
  expect(serializer).to have_received(:load).with filepath
82
87
  end
83
88
 
@@ -98,16 +103,16 @@ describe Rambling::Trie do
98
103
  end
99
104
 
100
105
  it 'determines the serializer based on the file extension' do
101
- trie = Rambling::Trie.load 'test.marshal'
106
+ Rambling::Trie.load 'test.marshal'
102
107
  expect(marshal_serializer).to have_received(:load).with 'test.marshal'
103
108
 
104
- trie = Rambling::Trie.load 'test.yml'
109
+ Rambling::Trie.load 'test.yml'
105
110
  expect(yaml_serializer).to have_received(:load).with 'test.yml'
106
111
 
107
- trie = Rambling::Trie.load 'test.yaml'
112
+ Rambling::Trie.load 'test.yaml'
108
113
  expect(yaml_serializer).to have_received(:load).with 'test.yaml'
109
114
 
110
- trie = Rambling::Trie.load 'test'
115
+ Rambling::Trie.load 'test'
111
116
  expect(default_serializer).to have_received(:load).with 'test'
112
117
  end
113
118
  end
@@ -153,10 +158,12 @@ describe Rambling::Trie do
153
158
  context 'when provided with a format' do
154
159
  it 'uses the corresponding serializer' do
155
160
  Rambling::Trie.dump trie, "#{filename}.marshal"
156
- expect(marshal_serializer).to have_received(:dump).with root, "#{filename}.marshal"
161
+ expect(marshal_serializer).to have_received(:dump)
162
+ .with root, "#{filename}.marshal"
157
163
 
158
164
  Rambling::Trie.dump trie, "#{filename}.yml"
159
- expect(yaml_serializer).to have_received(:dump).with root, "#{filename}.yml"
165
+ expect(yaml_serializer).to have_received(:dump)
166
+ .with root, "#{filename}.yml"
160
167
  end
161
168
  end
162
169
  end