Sha256: c21d5abfe368502a89ed2db5f52a1cc28090fefcb2e58aa7407dbf52f021bc16
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe PhishTank::URLRequest do subject do PhishTank.configure { |c| c.api_key = API_KEY } described_class.new("http://www.google.com/?q=search query") end it "should URI-encode the search URL" do subject.url.should eq "http://www.google.com/?q=search%20query" end it "should have a search URI" do subject.search_uri.should eq "http://checkurl.phishtank.com/checkurl/" end it "should respond to search" do subject.should respond_to(:search) end describe "#search" do context "valid search", :vcr => { :cassette_name => "valid search" } do subject { described_class.new("http://www.grovesgas.co.uk/TAMFidelidade/clientetam.htm").search } it "should return a struct of data" do subject.should be_kind_of(OpenStruct) end it "should have a bunch of attributes" do subject.url.should eq "http://www.grovesgas.co.uk/TAMFidelidade/clientetam.htm" subject.in_database.should eq true subject.phish_id.should eq "1389753" end end context "invalid search", :vcr => { :cassette_name => "invalid search" } do it "should return false" do subject.search.should eq false end end end describe "#params" do its(:params) { should include(:format => "XML") } its(:params) { should include(:app_key => API_KEY)} its(:params) { should include(:url => "http://www.google.com/?q=search%20query") } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phishtank-0.1.2 | spec/phishtank/url_request_spec.rb |
phishtank-0.1.1 | spec/phishtank/url_request_spec.rb |