Commit dbe6f55
Changed files (3)
lib
net
hippie
lib/net/hippie/content_type_mapper.rb
@@ -4,7 +4,7 @@ module Net
class ContentTypeMapper
def map_from(headers, body)
content_type = headers['Content-Type'] || ''
- return JSON.generate(body) if content_type.include?("json")
+ return JSON.generate(body) if content_type.include?('json')
body
end
end
test/net/client_test.rb
@@ -39,8 +39,8 @@ class ClientTest < Minitest::Test
def test_get_with_headers
headers = { 'Accept' => 'application/vnd.haveibeenpwned.v2+json' }
WebMock.stub_request(:get, 'https://haveibeenpwned.com/api/breaches')
- .with(headers: headers)
- .to_return(status: 201, body: {}.to_json)
+ .with(headers: headers)
+ .to_return(status: 201, body: {}.to_json)
uri = URI.parse('https://haveibeenpwned.com/api/breaches')
@@ -53,8 +53,8 @@ class ClientTest < Minitest::Test
uri = URI.parse('https://haveibeenpwned.com/api/breaches')
body = { 'hello' => 'world' }
WebMock.stub_request(:get, uri.to_s)
- .with(body: body.to_json)
- .to_return(status: 201, body: {}.to_json)
+ .with(body: body.to_json)
+ .to_return(status: 201, body: {}.to_json)
response = subject.get(uri, body: body)
@@ -136,7 +136,7 @@ class ClientTest < Minitest::Test
subject = Net::Hippie::Client.new(
certificate: certificate.to_pem,
key: private_key.export(OpenSSL::Cipher.new('AES-256-CBC'), passphrase),
- passphrase: passphrase,
+ passphrase: passphrase
)
uri = URI.parse('https://haveibeenpwned.com/api/breaches')
test/net/content_type_mapper_test.rb
@@ -20,7 +20,7 @@ class ContentTypeMapperTest < Minitest::Test
def test_return_html
subject = Net::Hippie::ContentTypeMapper.new
headers = { 'Content-Type' => 'text/html' }
- body = "<html></html>"
+ body = '<html></html>'
result = subject.map_from(headers, body)
assert_equal body, result
end