spec/view_spec.rb in censu-0.1.6 vs spec/view_spec.rb in censu-0.2.0
- old
+ new
@@ -1,25 +1,25 @@
-require 'spec_helper'
+# frozen_string_literal: true
describe Censys::API do
before(:context) do
@api = Censys::API.new
end
describe "#view", :vcr do
context "ipv4" do
- it "should return IPv4 response" do
+ it "should return an IPv4 response" do
view = @api.view(:ipv4, "8.8.8.8")
expect(view).to be_a(Censys::IPv4)
expect(view.tags).to be_a(Array)
expect(view.updated_at).to be_a(Time)
expect(view.autonomous_system).to be_a(AutonomousSystem)
expect(view.autonomous_system.routed_prefix).to eq("8.8.8.0/24")
expect(view.location).to be_a(Location)
- expect(view.location.city).to eq("Mountain View")
+ expect(view.location.country).to eq("United States")
expect(view.ports).to be_a(Hash)
expect(view.protocols).to be_a(Array)
expect(view.ip).to eq("8.8.8.8")
@@ -27,11 +27,11 @@
expect(view.protocols).to be_a(Array)
end
end
context "websites" do
- it "should return Website response" do
+ it "should return a Website response" do
view = @api.view(:websites, "google.com")
expect(view).to be_a(Censys::Website)
expect(view.domain).to eq("google.com")
expect(view.to_s).to eq("google.com")
expect(view.alexa_rank).to be_a(Integer)
@@ -45,16 +45,16 @@
expect(view["80.http.get.body"]).to be_a(String)
end
end
context "certificates" do
- it "should return Certificate response" do
+ it "should return a Certificate response" do
sha256 = "821a712a29d8e25915f66a9771519746c5aa73a45321fd4ca7ef644e1cadda59"
view = @api.view(:certificates, sha256)
expect(view).to be_a(Censys::Certificate)
expect(view.raw).to be_a(String)
expect(view.parsed).to be_a(Hash)
- expect(view.valid_nss).to eq(true)
+ expect(view.valid_nss).to eq(false)
end
end
end
end