From 3a3682ee90eddeb9432031243cedc962b57ab14a Mon Sep 17 00:00:00 2001 From: Anton Maminov Date: Fri, 5 Apr 2024 11:23:19 +0300 Subject: [PATCH] add specs --- README.md | 2 ++ spec/ipapi_spec.cr | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 590aca1..7f52af9 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ Crystal bindings for (IP Address Location & Geolocation API) ```crystal require "ipapi" +client = Ipapi::Client.new + location = client.locate("50.1.2.3") # => # diff --git a/spec/ipapi_spec.cr b/spec/ipapi_spec.cr index 4286b7e..03b40a7 100644 --- a/spec/ipapi_spec.cr +++ b/spec/ipapi_spec.cr @@ -1,9 +1,14 @@ require "./spec_helper" describe Ipapi do - # TODO: Write tests + it "#locate" do + client = Ipapi::Client.new - it "works" do - false.should eq(true) + location = client.locate("50.1.2.3") + + location.ip.should eq("50.1.2.3") + location.city.should eq("Antelope") + location.region.should eq("California") + location.country.should eq("US") end end