Skip to content

Commit edb2245

Browse files
committed
Merge pull request #513 from presidentJFK/query-with-boolean-values-fix
fix for #451
2 parents d79dc88 + cd70c65 commit edb2245

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

lib/webmock/util/query_mapper.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,6 @@ def to_query(parent, value, options = {})
259259
buffer << "#{to_query(new_parent, val, options)}&"
260260
end
261261
buffer.chop
262-
when TrueClass
263-
parent
264262
else
265263
encoded_value = Addressable::URI.encode_component(
266264
value.to_s.dup, Addressable::URI::CharacterClasses::UNRESERVED

spec/unit/util/query_mapper_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@
6666
it 'should transform array value' do
6767
expect(subject.to_query('a', ['b', 'c'])).to eq('a[0]=b&a[1]=c')
6868
end
69-
it 'should transform TrueClass value' do
70-
expect(subject.to_query('a', true)).to eq('a')
69+
it 'should transform boolean values' do
70+
expect(subject.to_query('a', true)).to eq('a=true')
71+
expect(subject.to_query('a', false)).to eq('a=false')
7172
end
7273
end
7374

0 commit comments

Comments
 (0)