Sha256: f488a817a81a35f5a32cd2fe7ba689872b3c86d634790dece0d77e17179d7d91

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

describe DomainFinder, :vcr do

  it 'GETs domains from registrar' do
    expect(DomainFinder::search(['thezets'])).to eq ["x  thezets.com", "o  thezets.net", "o  thezets.org", "o  thezets.co",
                                                     "o  thezets.io", "o  thezets.me", "x  th", "x  thez.et"]
  end

  it 'GETs multiple queries' do
    expect(DomainFinder::search(['twitbook', 'facetweet'])).
        to eq ["** twitbook **", "x  twitbook.com", "x  twitbook.net","o  twitbook.org", "o  twitbook.co",
               "o  twitbook.io", "o  twitbook.me", "o  twit.bo", "?  twit.book", "x  tw", "x  twit.boo", "x  tw.it",
               "** facetweet **", "x  facetweet.com", "x  facetweet.net", "o  facetweet.org", "x  facetweet.co",
               "o  facetweet.io", "x  facetweet.me", "o  facetw.ee", "?  face.tw", "x  facetwe.et", "x  fac.et", "x  f.ac"]

  end

  it 'raises an error if the API response code is unexpected (not 200 or 400)' do
    stub_request(:get, "https://domai.nr/api/json/search?q=thezets").to_return(status: 500, body: '', headers: {})
    expect{DomainFinder::search(['thezets'])}.to raise_error(RuntimeError, "Error 500 while accessing domain registrar")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
domain_finder-0.0.2 spec/domain_finder_spec.rb