|
30 | 30 | end
|
31 | 31 |
|
32 | 32 | it 'encodes special characters' do
|
33 |
| - expect(utils.__escape('foo bar')).to eq('foo+bar') |
| 33 | + expect(utils.__escape('foo bar')).to eq('foo%20bar') |
34 | 34 | expect(utils.__escape('foo/bar')).to eq('foo%2Fbar')
|
35 | 35 | expect(utils.__escape('foo^bar')).to eq('foo%5Ebar')
|
36 | 36 | end
|
37 | 37 |
|
38 | 38 | it 'does not encode asterisks' do
|
39 | 39 | expect(utils.__escape('*')).to eq('*')
|
40 | 40 | end
|
41 |
| - |
42 |
| - it 'users CGI.escape by default' do |
43 |
| - expect(CGI).to receive(:escape).and_call_original |
44 |
| - expect(utils.__escape('foo bar')).to eq('foo+bar') |
45 |
| - end |
46 |
| - |
47 |
| - it 'uses the escape_utils gem when available', unless: defined?(JRUBY_VERSION) do |
48 |
| - require 'escape_utils' |
49 |
| - expect(CGI).not_to receive(:escape) |
50 |
| - expect(EscapeUtils).to receive(:escape_url).and_call_original |
51 |
| - expect(utils.__escape('foo bar')).to eq('foo+bar') |
52 |
| - end |
53 | 41 | end
|
54 | 42 |
|
55 | 43 | describe '#__listify' do
|
|
77 | 65 | context 'when the escape option is set to false' do
|
78 | 66 |
|
79 | 67 | it 'does not escape the characters' do
|
80 |
| - expect(utils.__listify(['foo', 'bar^bam'], :escape => false)).to eq('foo,bar^bam') |
| 68 | + expect(utils.__listify(['foo', 'bar^bam'], escape: false)).to eq('foo,bar^bam') |
81 | 69 | end
|
82 | 70 | end
|
83 | 71 | end
|
|
107 | 95 |
|
108 | 96 | let(:result) do
|
109 | 97 | utils.__bulkify [
|
110 |
| - { :index => { :_index => 'myindexA', :_type => 'mytype', :_id => '1', :data => { :title => 'Test' } } }, |
111 |
| - { :update => { :_index => 'myindexB', :_type => 'mytype', :_id => '2', :data => { :doc => { :title => 'Update' } } } }, |
112 |
| - { :delete => { :_index => 'myindexC', :_type => 'mytypeC', :_id => '3' } } |
| 98 | + { index: { _index: 'myindexA', _id: '1', data: { title: 'Test' } } }, |
| 99 | + { update: { _index: 'myindexB', _id: '2', data: { doc: { title: 'Update' } } } }, |
| 100 | + { delete: { _index: 'myindexC', _id: '3' } } |
113 | 101 | ]
|
114 | 102 | end
|
115 | 103 |
|
116 | 104 | let(:expected_string) do
|
117 | 105 | <<-PAYLOAD.gsub(/^\s+/, '')
|
118 |
| - {"index":{"_index":"myindexA","_type":"mytype","_id":"1"}} |
| 106 | + {"index":{"_index":"myindexA","_id":"1"}} |
119 | 107 | {"title":"Test"}
|
120 |
| - {"update":{"_index":"myindexB","_type":"mytype","_id":"2"}} |
| 108 | + {"update":{"_index":"myindexB","_id":"2"}} |
121 | 109 | {"doc":{"title":"Update"}}
|
122 |
| - {"delete":{"_index":"myindexC","_type":"mytypeC","_id":"3"}} |
| 110 | + {"delete":{"_index":"myindexC","_id":"3"}} |
123 | 111 | PAYLOAD
|
124 | 112 | end
|
125 | 113 |
|
|
379 | 367 | end
|
380 | 368 |
|
381 | 369 | let(:unsupported_params) do
|
382 |
| - [ { :foo => { :explanation => 'NOT_SUPPORTED'} }, :moo ] |
| 370 | + [ { foo: { explanation: 'NOT_SUPPORTED'} }, :moo ] |
383 | 371 | end
|
384 | 372 |
|
385 | 373 |
|
|
0 commit comments