source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ipapi_com_test.rb
Ruby
mit
6,440
master
3,403
# encoding: utf-8 require 'test_helper' class IpapiComTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ipapi_com) end def test_result_on_ip_address_search result = Geocoder.search("74.200.247.59").first assert result.is_a?(Geocoder::Result::IpapiCom) end def test_resu...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ipbase_test.rb
Ruby
mit
6,440
master
1,282
# encoding: utf-8 require 'test_helper' class IpbaseTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ipbase, lookup: :ipbase) end def test_no_results results = Geocoder.search("no results") assert_equal 0, results.length end def test_no_data results = Geocoder.sear...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/postcode_anywhere_uk_test.rb
Ruby
mit
6,440
master
2,011
# encoding: utf-8 require 'test_helper' class PostcodeAnywhereUkTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :postcode_anywhere_uk) set_api_key!(:postcode_anywhere_uk) end def test_result_components_with_placename_search results = Geocoder.search('Romsey') assert_equa...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ipqualityscore_test.rb
Ruby
mit
6,440
master
3,851
# encoding: utf-8 require 'test_helper' class IpqualityscoreTest < GeocoderTestCase def setup super # configuring this IP lookup as the address lookup is weird, but necessary # in order to run tests with the 'quota exceeded' fixture Geocoder.configure(lookup: :ipqualityscore, ip_lookup: :ipqualitysc...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/opencagedata_test.rb
Ruby
mit
6,440
master
2,729
# encoding: utf-8 require 'test_helper' class OpencagedataTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :opencagedata) set_api_key!(:opencagedata) end def test_result_components result = Geocoder.search("Madison Square Garden, New York, NY").first assert_equal "West 31s...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/google_test.rb
Ruby
mit
6,440
master
4,738
# encoding: utf-8 require 'test_helper' class GoogleTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :google) end def test_google_result_components result = Geocoder.search("Madison Square Garden, New York, NY").first assert_equal "Manhattan", result.address_components_o...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/abstract_api_test.rb
Ruby
mit
6,440
master
758
# encoding: utf-8 require 'test_helper' class AbstractApiTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :abstract_api) set_api_key!(:abstract_api) end def test_result_attributes result = Geocoder.search('2.19.128.50').first assert_equal 'Seattle, WA 98111, United Stat...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/maxmind_geoip2_test.rb
Ruby
mit
6,440
master
1,484
# encoding: utf-8 require 'test_helper' class MaxmindGeoip2Test < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :maxmind_geoip2) end def test_result_attributes result = Geocoder.search('1.2.3.4').first assert_equal 'Los Angeles, CA 90001, United States', result.address asse...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/maxmind_local_test.rb
Ruby
mit
6,440
master
807
# encoding: utf-8 require 'test_helper' class MaxmindLocalTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :maxmind_local) end def test_result_attributes result = Geocoder.search('8.8.8.8').first assert_equal 'Mountain View, CA 94043, United States', result.address asse...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/smarty_streets_test.rb
Ruby
mit
6,440
master
3,141
# encoding: utf-8 require 'test_helper' class SmartyStreetsTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :smarty_streets) set_api_key!(:smarty_streets) end def test_url_contains_api_key Geocoder.configure(:smarty_streets => {:api_key => 'blah'}) query = Geocoder::Query....
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ban_data_gouv_fr_test.rb
Ruby
mit
6,440
master
5,949
# encoding: utf-8 require 'test_helper' class BanDataGouvFrTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :ban_data_gouv_fr, use_https: true) end def test_query_for_geocode query = Geocoder::Query.new('13 rue yves toudic, 75010 Paris') lookup = Geocoder::Lookup.get(:ban_data...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/google_places_search_test.rb
Ruby
mit
6,440
master
4,995
# encoding: utf-8 require 'test_helper' class GooglePlacesSearchTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :google_places_search) set_api_key!(:google_places_search) end def test_google_places_search_result_contains_place_id assert_equal "ChIJhRwB-yFawokR5Phil-QQ3zM", ma...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ip2location_lite_test.rb
Ruby
mit
6,440
master
349
# encoding: utf-8 require 'test_helper' class Ip2locationLiteTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ip2location_lite, ip2location_lite: { file: File.join('folder', 'test_file') }) end def test_loopback result = Geocoder.search('127.0.0.1').first assert_equal '', r...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/nationaal_georegister_nl_test.rb
Ruby
mit
6,440
master
850
# encoding: utf-8 require 'test_helper' class NationaalGeoregisterNlTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :nationaal_georegister_nl) end def test_result_components result = Geocoder.search('Nieuwezijds Voorburgwal 147, Amsterdam').first assert_equal result.street, ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/mapbox_test.rb
Ruby
mit
6,440
master
5,647
# encoding: utf-8 require 'test_helper' class MapboxTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :mapbox) set_api_key!(:mapbox) end def test_url_contains_api_key Geocoder.configure(mapbox: {api_key: "abc123"}) query = Geocoder::Query.new("Leadville, CO") assert_equ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ip2location_io_test.rb
Ruby
mit
6,440
master
695
# encoding: utf-8 require 'test_helper' class Ip2locationIoTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ip2location_io) set_api_key!(:ip2location_io) end def test_ip2location_io_query_url query = Geocoder::Query.new('8.8.8.8') assert_equal 'https://api.ip2location....
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/here_test.rb
Ruby
mit
6,440
master
1,823
# encoding: utf-8 require 'test_helper' class HereTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :here) set_api_key!(:here) end def test_with_array_api_key_raises_when_configured Geocoder.configure(api_key: %w[foo bar]) Geocoder.configure(always_raise: :all) assert_r...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/melissa_street_test.rb
Ruby
mit
6,440
master
1,073
# encoding: utf-8 require 'test_helper' class MelissaStreetTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :melissa_street) set_api_key!(:melissa_street) end def test_result_components result = Geocoder.search("1 Frank H Ogawa Plz Fl 3").first assert_equal "1", result.num...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/geoapify_test.rb
Ruby
mit
6,440
master
5,636
# frozen_string_literal: true require 'test_helper' class GeoapifyTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :geoapify) set_api_key!(:geoapify) end def test_geoapify_forward_geocoding_result_properties result = Geocoder.search('Madison Square Garden, New York, NY').firs...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ipstack_test.rb
Ruby
mit
6,440
master
9,344
# encoding: utf-8 require 'test_helper' class SpyLogger def initialize @log = [] end def logged?(msg) @log.include?(msg) end def add(level, msg) @log << msg end end class IpstackTest < GeocoderTestCase def setup super @logger = SpyLogger.new Geocoder.configure( :api_key ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/latlon_test.rb
Ruby
mit
6,440
master
1,242
# encoding: utf-8 require 'test_helper' class LatlonTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :latlon) set_api_key!(:latlon) end def test_result_components result = Geocoder.search("6000 Universal Blvd, Orlando, FL 32819").first assert_equal "6000", result.number ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/geocodio_test.rb
Ruby
mit
6,440
master
2,184
# encoding: utf-8 require 'test_helper' class GeocodioTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :geocodio) set_api_key!(:geocodio) end def test_result_components result = Geocoder.search("1101 Pennsylvania Ave NW, Washington DC").first assert_equal 1.0, result.accur...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/db_ip_com_test.rb
Ruby
mit
6,440
master
2,451
require 'test_helper' class DbIpComTest < GeocoderTestCase def configure_for_free_api_access Geocoder.configure(ip_lookup: :db_ip_com, db_ip_com: { api_key: 'MY_API_KEY' }) set_api_key!(:db_ip_com) end def configure_for_paid_api_access Geocoder.configure(ip_lookup: :db_ip_com, db_ip_com: { api_key: ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/geoportail_lu_test.rb
Ruby
mit
6,440
master
2,377
# encoding: utf-8 require 'test_helper' class GeoportailLuTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :geoportail_lu) end def test_query_for_geocode query = Geocoder::Query.new('55 route de luxembourg, pontpierre') lookup = Geocoder::Lookup.get(:geoportail_lu) res = l...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ipdata_co_test.rb
Ruby
mit
6,440
master
2,072
# encoding: utf-8 require 'test_helper' class IpdataCoTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ipdata_co) end def test_result_on_ip_address_search result = Geocoder.search("74.200.247.59").first assert result.is_a?(Geocoder::Result::IpdataCo) end def test_resu...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/freegeoip_test.rb
Ruby
mit
6,440
master
1,185
# encoding: utf-8 require 'test_helper' class FreegeoipTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :freegeoip) end def test_result_on_ip_address_search result = Geocoder.search("74.200.247.59").first assert result.is_a?(Geocoder::Result::Freegeoip) end def test_re...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/yandex_test.rb
Ruby
mit
6,440
master
5,702
# encoding: utf-8 $: << File.join(File.dirname(__FILE__), "..", "..") require 'test_helper' class YandexTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :yandex, language: :en) end def test_yandex_viewport result = Geocoder.search('Kremlin, Moscow, Russia').first assert_equal ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/nominatim_test.rb
Ruby
mit
6,440
master
1,693
# encoding: utf-8 require 'test_helper' class NominatimTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :nominatim) set_api_key!(:nominatim) end def test_result_components result = Geocoder.search("Madison Square Garden, New York, NY").first assert_equal "10001", result.po...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/pdok_nl_test.rb
Ruby
mit
6,440
master
817
# encoding: utf-8 require 'test_helper' class PdokNlTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :pdok_nl) end def test_result_components result = Geocoder.search('Nieuwezijds Voorburgwal 147, Amsterdam').first assert_equal result.street, 'Nieuwezijds Voorburgwal'...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/osmnames_test.rb
Ruby
mit
6,440
master
2,135
# encoding: utf-8 require 'test_helper' class OsmnamesTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :osmnames) set_api_key!(:osmnames) end def test_url_contains_api_key Geocoder.configure(osmnames: {api_key: 'abc123'}) query = Geocoder::Query.new('test') assert_incl...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/bing_test.rb
Ruby
mit
6,440
master
2,767
# encoding: utf-8 require 'test_helper' class BingTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :bing) set_api_key!(:bing) end def test_query_for_reverse_geocode lookup = Geocoder::Lookup::Bing.new url = lookup.query_url(Geocoder::Query.new([45.423733, -75.676333])) ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ipinfo_io_test.rb
Ruby
mit
6,440
master
871
# encoding: utf-8 require 'test_helper' class IpinfoIoTest < GeocoderTestCase def test_ipinfo_io_lookup_loopback_address Geocoder.configure(:ip_lookup => :ipinfo_io) result = Geocoder.search("127.0.0.1").first assert_nil result.latitude assert_nil result.longitude assert_equal "127.0.0.1", resul...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/telize_test.rb
Ruby
mit
6,440
master
3,014
# encoding: utf-8 require 'test_helper' class TelizeTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :telize, telize: {host: nil}) set_api_key!(:telize) end def test_query_url lookup = Geocoder::Lookup::Telize.new query = Geocoder::Query.new("74.200.247.59") assert_...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/azure_test.rb
Ruby
mit
6,440
master
3,504
require 'test_helper' class AzureTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :azure, azure: { limit: 1 }) set_api_key!(:azure) end def test_azure_results_jakarta_properties result = Geocoder.search('Jakarta').first assert_equal 'Jakarta', result&.city assert_equa...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ipinfo_io_lite_test.rb
Ruby
mit
6,440
master
897
require 'test_helper' class IpinfoIoLiteTest < GeocoderTestCase def test_ipinfo_io_lite_lookup_loopback_address Geocoder.configure(ip_lookup: :ipinfo_io_lite) result = Geocoder.search('127.0.0.1').first assert_equal '127.0.0.1', result.ip end def test_ipinfo_io_lite_lookup_private_address Geocod...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ipregistry_test.rb
Ruby
mit
6,440
master
1,042
# encoding: utf-8 require 'test_helper' class IpregistryTest < GeocoderTestCase def test_lookup_loopback_address Geocoder.configure(:ip_lookup => :ipregistry) result = Geocoder.search("127.0.0.1").first assert_nil result.latitude assert_nil result.longitude assert_equal "127.0.0.1", result.ip e...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/geocoder_ca_test.rb
Ruby
mit
6,440
master
409
# encoding: utf-8 require 'test_helper' class GeocoderCaTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :geocoder_ca) set_api_key!(:geocoder_ca) end def test_result_components result = Geocoder.search([45.423733, -75.676333]).first assert_equal "CA", result.country_code ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/photon_test.rb
Ruby
mit
6,440
master
4,335
# frozen_string_literal: true require 'test_helper' # Test for Photon class PhotonTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :photon) end def test_photon_forward_geocoding_result_properties result = Geocoder.search('Madison Square Garden, New York, NY').first geometry ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/postcodes_io_test.rb
Ruby
mit
6,440
master
497
# encoding: utf-8 require 'test_helper' class PostcodesIoTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :postcodes_io) end def test_result_on_postcode_search results = Geocoder.search('WR26NJ') assert_equal 1, results.size assert_equal 'Worcestershire', results.first.co...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/google_places_details_test.rb
Ruby
mit
6,440
master
5,266
# encoding: utf-8 require 'test_helper' class GooglePlacesDetailsTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :google_places_details) set_api_key!(:google_places_details) end def test_google_places_details_result_components assert_equal "Manhattan", madison_square_garden.a...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/pointpin_test.rb
Ruby
mit
6,440
master
1,058
# encoding: utf-8 require 'test_helper' class PointpinTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :pointpin, api_key: "abc123") end def test_result_on_ip_address_search result = Geocoder.search("80.111.55.55").first assert result.is_a?(Geocoder::Result::Pointpin) end...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/amazon_location_service_test.rb
Ruby
mit
6,440
master
818
# encoding: utf-8 require 'test_helper' class AmazonLocationServiceTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :amazon_location_service, amazon_location_service: {index_name: "some_index_name"}) end def test_amazon_location_service_geocoding result = Geocoder.search("Madison ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ip2location_test.rb
Ruby
mit
6,440
master
1,413
# encoding: utf-8 require 'test_helper' class Ip2locationTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :ip2location) set_api_key!(:ip2location) end def test_ip2location_query_url query = Geocoder::Query.new('8.8.8.8') assert_equal 'https://api.ip2location.com/v2/?ip=...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/location_iq_test.rb
Ruby
mit
6,440
master
1,268
# encoding: utf-8 require 'unit/lookups/nominatim_test' require 'test_helper' class LocationIq < NominatimTest def setup super Geocoder.configure(lookup: :location_iq) set_api_key!(:location_iq) end def test_url_contains_api_key Geocoder.configure(location_iq: {api_key: "abc123"}) query = G...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/twogis_test.rb
Ruby
mit
6,440
master
3,287
# encoding: utf-8 require 'test_helper' class TwogisTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :twogis) set_api_key!(:twogis) end def test_twogis_point result = Geocoder.search('Kremlin, Moscow, Russia').first assert_equal [55.755836, 37.617774], result.coordinates ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/uk_ordnance_survey_names.rb
Ruby
mit
6,440
master
615
# encoding: utf-8 require 'test_helper' class UkOrdnanceSurveyNamesTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :uk_ordnance_survey_names) set_api_key!(:uk_ordnance_survey_names) end def test_result_on_placename_search result = Geocoder.search('London').first assert_in...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/ipgeolocation_test.rb
Ruby
mit
6,440
master
4,053
# encoding: utf-8 require 'test_helper' class IpgeolocationTest < GeocoderTestCase def setup super Geocoder.configure( :api_key => 'ea91e4a4159247fdb0926feae70c2911', :ip_lookup => :ipgeolocation, :always_raise => :all ) end def test_result_on_ip_address_search result = ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/google_premier_test.rb
Ruby
mit
6,440
master
1,256
# encoding: utf-8 require 'test_helper' class GooglePremierTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :google_premier) set_api_key!(:google_premier) end def test_result_components result = Geocoder.search("Madison Square Garden, New York, NY").first assert_equal "Man...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/pelias_test.rb
Ruby
mit
6,440
master
973
# encoding: utf-8 require 'test_helper' class PeliasTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :pelias, api_key: 'abc123', pelias: {}) # Empty pelias hash only for test (pollution control) end def test_configure_default_endpoint query = Geocoder::Query.new('Madison Square Ga...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/maxmind_test.rb
Ruby
mit
6,440
master
2,452
# encoding: utf-8 require 'test_helper' class MaxmindTest < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :maxmind) end def test_maxmind_result_on_ip_address_search Geocoder.configure(maxmind: {service: :city_isp_org}) result = Geocoder.search("74.200.247.59").first assert ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/mapquest_test.rb
Ruby
mit
6,440
master
1,632
# encoding: utf-8 require 'test_helper' class MapquestTest < GeocoderTestCase def setup super Geocoder.configure(lookup: :mapquest) set_api_key!(:mapquest) end def test_url_contains_api_key Geocoder.configure(mapquest: {api_key: "abc123"}) query = Geocoder::Query.new("Bluffton, SC") ass...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/unit/lookups/geoip2_test.rb
Ruby
mit
6,440
master
1,482
# encoding: utf-8 require 'test_helper' class Geoip2Test < GeocoderTestCase def setup super Geocoder.configure(ip_lookup: :geoip2, file: 'test_file') end def test_result_attributes result = Geocoder.search('8.8.8.8').first assert_equal 'Mountain View, CA 94043, United States', result.address ...
github
alexreisner/geocoder
https://github.com/alexreisner/geocoder
test/db/migrate/001_create_test_schema.rb
Ruby
mit
6,440
master
2,084
# CreateTestSchema creates the tables used in test_helper.rb superclass = ActiveRecord::Migration # TODO: Inherit from the 5.0 Migration class directly when we drop support for Rails 4. superclass = ActiveRecord::Migration[5.0] if superclass.respond_to?(:[]) class CreateTestSchema < superclass def self.up [ ...
github
hanami/hanami
https://github.com/hanami/hanami
Gemfile
Ruby
mit
6,362
main
1,240
# frozen_string_literal: true source "https://rubygems.org" gemspec eval_gemfile "Gemfile.devtools" unless ENV["CI"] gem "yard" gem "yard-junk" end if ENV["RACK_MATRIX_VALUE"] gem "rack", ENV["RACK_MATRIX_VALUE"] end gem "hanami-utils", github: "hanami/hanami-utils", branch: "main" gem "hanami-db", github: ...
github
hanami/hanami
https://github.com/hanami/hanami
hanami.gemspec
Ruby
mit
6,362
main
2,143
# frozen_string_literal: true # This file is synced from hanakai-rb/repo-sync. To update it, edit repo-sync.yml. lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "hanami/version" Gem::Specification.new do |spec| spec.name = "hanami" spec.authors ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/spec_helper.rb
Ruby
mit
6,362
main
737
# frozen_string_literal: true require "pathname" SPEC_ROOT = File.expand_path(__dir__).freeze LOG_DIR = Pathname(SPEC_ROOT).join("..").join("log") require_relative "support/coverage" if ENV["COVERAGE"].eql?("true") require "hanami" require "hanami/utils/file_list" require "hanami/devtools/unit" Hanami::Utils::File...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/universal_logger_spec.rb
Ruby
mit
6,362
main
9,813
# frozen_string_literal: true RSpec.describe Hanami::UniversalLogger do # Shared logger test doubles let(:structured_logger) do Class.new do attr_reader :logs def initialize @logs = [] end %i[debug info warn error fatal unknown].each do |level| define_method(level) do ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/slice_spec.rb
Ruby
mit
6,362
main
2,894
# frozen_string_literal: true require "hanami/slice" RSpec.describe Hanami::Slice, :app_integration do before do module TestApp class App < Hanami::App end end end describe ".app" do subject(:slice) { Hanami.app.register_slice(:main) } it "returns the top-level Hanami App slice" do...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/slice_name_spec.rb
Ruby
mit
6,362
main
1,242
# frozen_string_literal: true require "hanami/slice_name" require "dry/inflector" RSpec.describe Hanami::SliceName do subject(:slice_name) { described_class.new(slice, inflector: -> { inflector }) } let(:slice) { double(name: "Main::Slice") } let(:inflector) { Dry::Inflector.new } let(:slice_module) { Modul...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/port_spec.rb
Ruby
mit
6,362
main
2,656
# frozen_string_literal: true require "hanami/port" RSpec.describe Hanami::Port do context "Hanami::Port::DEFAULT" do it "returns default value" do expect(Hanami::Port::DEFAULT).to eq(2300) end end context "Hanami::Port::ENV_VAR" do it "returns default value" do expect(Hanami::Port::ENV...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/env_spec.rb
Ruby
mit
6,362
main
872
# frozen_string_literal: true RSpec.describe Hanami, ".env" do subject { described_class.env(e: env) } context "HANAMI_ENV, APP_ENV and RACK_ENV in ENV" do let(:env) { {"HANAMI_ENV" => "test", "APP_ENV" => "development", "RACK_ENV" => "production"} } it "is the value of HANAMI_ENV" do is_expected.t...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/settings_spec.rb
Ruby
mit
6,362
main
3,352
# frozen_string_literal: true require "hanami/settings" RSpec.describe Hanami::Settings do describe "#initialize" do it "uses values from the store when present" do settings_class = Class.new(described_class) do setting :database_url, default: "postgres://localhost/test_app_development" end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/slice_configurable_spec.rb
Ruby
mit
6,362
main
3,319
# frozen_string_literal: true require "hanami/app" require "hanami/slice_configurable" RSpec.describe Hanami::SliceConfigurable, :app_integration do before do module TestApp class App < Hanami::App register_slice :main register_slice :admin end class BaseClass extend H...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/logger/rack_formatter_spec.rb
Ruby
mit
6,362
main
4,575
# frozen_string_literal: true require "dry/logger" require "hanami/logger/rack_formatter" require "stringio" RSpec.describe Hanami::Logger::RackFormatter do def build_logger(stream:, colorize:) Dry.Logger( :test_app, stream: stream, level: :debug, formatter: described_class, colori...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/logger/sql_formatter_spec.rb
Ruby
mit
6,362
main
3,937
# frozen_string_literal: true require "dry/logger" require "hanami/logger/sql_formatter" require "stringio" RSpec.describe Hanami::Logger::SQLFormatter do # Returns true when the string contains the 256-colour escape sequences emitted by # Rouge::Formatters::Terminal256 (e.g. "\e[38;5;203m"). def rouge_highligh...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/render_detailed_errors_spec.rb
Ruby
mit
6,362
main
659
# frozen_string_literal: true require "dry/inflector" RSpec.describe Hanami::Config, "#render_detailed_errors" do let(:config) { described_class.new(app_name: app_name, env: env) } let(:app_name) { Hanami::SliceName.new(double(name: "MyApp::App"), inflector: Dry::Inflector.new) } subject(:render_detailed_error...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/console_spec.rb
Ruby
mit
6,362
main
567
# frozen_string_literal: true require "hanami/config" RSpec.describe Hanami::Config, "#console" do let(:config) { described_class.new(app_name: app_name, env: :development) } let(:app_name) { "MyApp::App" } subject(:console) { config.console } it "is a full console configuration" do is_expected.to be_an...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/actions_spec.rb
Ruby
mit
6,362
main
1,530
# frozen_string_literal: true require "hanami/config" require "hanami/action" RSpec.describe Hanami::Config, "#actions" do let(:config) { described_class.new(app_name: app_name, env: :development) } let(:app_name) { "MyApp::app" } subject(:actions) { config.actions } context "hanami-action is bundled" do ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/router_spec.rb
Ruby
mit
6,362
main
1,117
# frozen_string_literal: true require "hanami/config" RSpec.describe Hanami::Config, "#router" do let(:config) { described_class.new(app_name: app_name, env: :development) } let(:app_name) { "MyApp::app" } subject(:router) { config.router } context "hanami-router is bundled" do it "is a full router conf...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/views_spec.rb
Ruby
mit
6,362
main
2,296
# frozen_string_literal: true require "hanami/config" require "saharspec/matchers/dont" RSpec.describe Hanami::Config, "#views" do let(:config) { described_class.new(app_name: app_name, env: :development) } let(:app_name) { "MyApp::app" } subject(:views) { config.views } context "hanami-view is bundled" do ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/inflector_spec.rb
Ruby
mit
6,362
main
960
# frozen_string_literal: true require "hanami/config" RSpec.describe Hanami::Config do subject(:config) { described_class.new(app_name: app_name, env: :development) } let(:app_name) { "MyApp::app" } describe "inflector" do it "defaults to a Dry::Inflector instance" do expect(config.inflector).to be_k...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/db_spec.rb
Ruby
mit
6,362
main
998
# frozen_string_literal: true require "hanami/config" RSpec.describe Hanami::Config, "#db" do let(:config) { described_class.new(app_name: app_name, env: :development) } let(:app_name) { "MyApp::App" } subject(:db) { config.db } context "hanami-router is bundled" do it "is a full router configuration" d...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/logger_spec.rb
Ruby
mit
6,362
main
6,225
# frozen_string_literal: true require "hanami/config/logger" require "hanami/slice_name" require "dry/inflector" require "logger" require "stringio" RSpec.describe Hanami::Config::Logger do subject do described_class.new(app_name: app_name, env: env) end let(:app_name) do Hanami::SliceName.new(double(n...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/render_errors_spec.rb
Ruby
mit
6,362
main
632
# frozen_string_literal: true require "dry/inflector" RSpec.describe Hanami::Config, "#render_errors" do let(:config) { described_class.new(app_name: app_name, env: env) } let(:app_name) { Hanami::SliceName.new(double(name: "MyApp::App"), inflector: Dry::Inflector.new) } subject(:render_errors) { config.render...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/slices_spec.rb
Ruby
mit
6,362
main
835
# frozen_string_literal: true require "dry/inflector" require "hanami/config" require "hanami/slice_name" RSpec.describe Hanami::Config, "#slices" do subject(:config) { described_class.new(app_name: app_name, env: :development) } let(:app_name) { Hanami::SliceName.new(double(name: "MyApp::App"), inflector: Dry::I...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/base_url_spec.rb
Ruby
mit
6,362
main
731
# frozen_string_literal: true require "hanami/config" require "uri" RSpec.describe Hanami::Config, "base_url" do subject(:config) { described_class.new(app_name: app_name, env: :development) } let(:app_name) { "MyApp::app" } it "defaults to a URI of 'http://0.0.0.0:2300'" do expect(config.base_url).to eq U...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/actions/csrf_protection_spec.rb
Ruby
mit
6,362
main
1,252
# frozen_string_literal: true require "hanami/config/actions" RSpec.describe Hanami::Config::Actions, "#csrf_protection" do let(:app_config) { Hanami::Config.new(app_name: "MyApp::App", env: :development) } let(:config) { app_config.actions } subject(:value) { config.csrf_protection } context "non-finalized ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/actions/default_values_spec.rb
Ruby
mit
6,362
main
1,311
# frozen_string_literal: true require "hanami/config/actions" RSpec.describe Hanami::Config::Actions, "default values" do let(:app_config) { Hanami::Config.new(app_name: "MyApp::App", env: :development) } subject(:config) { app_config.actions } describe "sessions" do specify { expect(config.sessions).not_t...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/actions/content_security_policy_spec.rb
Ruby
mit
6,362
main
2,922
# frozen_string_literal: true require "hanami/config/actions" RSpec.describe Hanami::Config::Actions, "#content_security_policy" do let(:app_config) { Hanami::Config.new(app_name: "MyApp::App", env: :development) } let(:config) { app_config.actions } subject(:content_security_policy) { config.content_security_p...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/actions/sessions_spec.rb
Ruby
mit
6,362
main
1,125
# frozen_string_literal: true require "hanami/config/actions" RSpec.describe Hanami::Config::Actions, "#sessions" do let(:config) { described_class.new } subject(:sessions) { config.sessions } context "no session config specified" do it "is not enabled" do expect(sessions).not_to be_enabled end ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/config/actions/cookies_spec.rb
Ruby
mit
6,362
main
880
# frozen_string_literal: true require "hanami/config/actions" RSpec.describe Hanami::Config::Actions, "#cookies" do let(:config) { described_class.new } subject(:cookies) { config.cookies } context "default config" do it "is enabled" do expect(cookies).to be_enabled end it "is an empty hash"...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/router/errors/not_allowed_error_spec.rb
Ruby
mit
6,362
main
737
# frozen_string_literal: true require "hanami/router" require "hanami/extensions/router/errors" RSpec.describe(Hanami::Router::NotAllowedError) do subject(:error) { described_class.new(env, allowed_methods) } let(:env) { Rack::MockRequest.env_for("http://example.com/example", method: "POST") } let(:allowed_met...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/router/errors/not_found_error_spec.rb
Ruby
mit
6,362
main
556
# frozen_string_literal: true require "hanami/router" require "hanami/extensions/router/errors" RSpec.describe(Hanami::Router::NotFoundError) do subject(:error) { described_class.new(env) } let(:env) { Rack::MockRequest.env_for("http://example.com/example", method: "GET") } it "is a Hanami::Router::Error" do ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/web/rack_logger_spec.rb
Ruby
mit
6,362
main
2,600
# frozen_string_literal: true require "hanami/web/rack_logger" require "dry/logger" require "stringio" require "rack/mock" RSpec.describe Hanami::Web::RackLogger do subject { described_class.new(logger) } let(:logger) do Dry.Logger( app_name, stream: stream, level: :debug, filters: fi...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/extensions/view/context_spec.rb
Ruby
mit
6,362
main
1,489
# frozen_string_literal: true require "hanami/view" require "hanami/view/context" require "hanami/extensions/view/context" RSpec.describe(Hanami::View::Context) do subject(:context) { described_class.new(**args) } let(:args) { {} } describe "#assets" do context "assets given" do let(:args) { {assets:...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/providers/db/config_spec.rb
Ruby
mit
6,362
main
3,611
# frozen_string_literal: true require "dry/system" require "hanami/providers/db" RSpec.describe "Hanami::Providers::DB.config", :app_integration do subject(:config) { provider.source.config } let(:provider) { Hanami.app.prepare Hanami.app.configure_provider(:db) Hanami.app.container.providers[:db] ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/providers/db/config/gateway_spec.rb
Ruby
mit
6,362
main
2,012
# frozen_string_literal: true require "dry/system" require "hanami/providers/db" RSpec.describe "Hanami::Providers::DB / Config / Gateway config", :app_integration do subject(:config) { provider.source.config } let(:provider) { Hanami.app.prepare Hanami.app.configure_provider(:db) Hanami.app.containe...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/providers/db/config/default_config_spec.rb
Ruby
mit
6,362
main
2,356
# frozen_string_literal: true require "dry/system" require "hanami/providers/db" RSpec.describe "Hanami::Providers::DB / Config / Default config", :app_integration do subject(:config) { provider.source.config } let(:provider) { Hanami.app.prepare Hanami.app.configure_provider(:db) Hanami.app.containe...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/providers/i18n/backend_spec.rb
Ruby
mit
6,362
main
11,710
# frozen_string_literal: true require "dry/system" require "i18n" RSpec.describe Hanami::Providers::I18n::Backend do let(:i18n_backend) { I18n::Backend::Simple.new } let(:backend) { described_class.new(i18n_backend, locale: :en, default_locale: :en, available_locales: []) } before do i18n_backend.store_tra...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/settings/env_store_spec.rb
Ruby
mit
6,362
main
1,379
# frozen_string_literal: true require "hanami/settings/env_store" RSpec.describe Hanami::Settings::EnvStore do it "defaults to using ENV as the store" do orig_env = ENV.to_h ENV["FOO"] = "bar" expect(described_class.new.fetch("FOO")).to eq "bar" ENV.replace(orig_env) end describe "#fetch" do ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/settings/composite_store_spec.rb
Ruby
mit
6,362
main
2,515
# frozen_string_literal: true require "hanami/settings/composite_store" RSpec.describe Hanami::Settings::CompositeStore do describe "#fetch" do it "returns the value from the first store that has it" do store1 = {"FOO" => "from_store1"} store2 = {"FOO" => "from_store2"} composite = described_c...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/helpers/form_helper_spec.rb
Ruby
mit
6,362
main
102,526
# frozen_string_literal: true require "hanami/helpers/form_helper" require "hanami/view/erb/template" RSpec.describe Hanami::Helpers::FormHelper do subject(:obj) { Class.new { include Hanami::Helpers::FormHelper attr_reader :_context def initialize(context) @_context = context ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/helpers/assets_helper/javascript_tag_spec.rb
Ruby
mit
6,362
main
4,717
# frozen_string_literal: true RSpec.describe Hanami::Helpers::AssetsHelper, "#javascript", :app_integration do subject(:obj) { helpers = described_class Class.new { include helpers attr_reader :_context def initialize(context) @_context = context end }.new(context) } ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/helpers/assets_helper/video_tag_spec.rb
Ruby
mit
6,362
main
3,729
# frozen_string_literal: true RSpec.describe Hanami::Helpers::AssetsHelper, "#video", :app_integration do subject(:obj) { helpers = described_class Class.new { include helpers attr_reader :_context def initialize(context) @_context = context end }.new(context) } def...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/helpers/assets_helper/stylesheet_tag_spec.rb
Ruby
mit
6,362
main
3,870
# frozen_string_literal: true RSpec.describe Hanami::Helpers::AssetsHelper, "#stylesheet", :app_integration do subject(:obj) { helpers = described_class Class.new { include helpers attr_reader :_context def initialize(context) @_context = context end }.new(context) } ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/helpers/assets_helper/image_tag_spec.rb
Ruby
mit
6,362
main
2,388
# frozen_string_literal: true RSpec.describe Hanami::Helpers::AssetsHelper, "#image", :app_integration do subject(:obj) { helpers = described_class Class.new { include helpers attr_reader :_context def initialize(context) @_context = context end }.new(context) } def...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/helpers/assets_helper/asset_url_spec.rb
Ruby
mit
6,362
main
2,880
# frozen_string_literal: true RSpec.describe Hanami::Helpers::AssetsHelper, "#asset_url", :app_integration do subject(:obj) { helpers = described_class Class.new { include helpers attr_reader :_context def initialize(context) @_context = context end }.new(context) } ...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/helpers/assets_helper/audio_tag_spec.rb
Ruby
mit
6,362
main
3,596
# frozen_string_literal: true RSpec.describe Hanami::Helpers::AssetsHelper, "#audio", :app_integration do subject(:obj) { helpers = described_class Class.new { include helpers attr_reader :_context def initialize(context) @_context = context end }.new(context) } def...
github
hanami/hanami
https://github.com/hanami/hanami
spec/unit/hanami/helpers/assets_helper/favicon_tag_spec.rb
Ruby
mit
6,362
main
2,265
# frozen_string_literal: true RSpec.describe Hanami::Helpers::AssetsHelper, "#favicon", :app_integration do subject(:obj) { helpers = described_class Class.new { include helpers attr_reader :_context def initialize(context) @_context = context end }.new(context) } d...
github
hanami/hanami
https://github.com/hanami/hanami
spec/support/app_integration.rb
Ruby
mit
6,362
main
4,549
# frozen_string_literal: true require "hanami/devtools/integration/files" require "hanami/devtools/integration/with_tmp_directory" require "json" require "tmpdir" require "zeitwerk" module RSpec module Support module WithTmpDirectory private def make_tmp_directory Pathname(Dir.mktmpdir).tap...