Sha256: 61802b183d0f57b767c02a1e0a11f586498c6897781935ff2c982f681194cd69
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
require 'test_helper' RSpec.describe Location, type: :model do before(:each) do allow(Location).to receive(:request).and_return( JSON.parse(File.read("spec/data/locations.json")) ) end context "finder methods" do it "should find a location by ID" do l = Location.find(3520) l.name.should eq "Mytilene Airport" end it "should calculate a ruby timezone for a location" do l = Location.find(100) l.name.should eq "Gate 74" l.ruby_timezone.identifier.should eq "America/Los_Angeles" end it "should find a location by code" do l = Location.find_by_code("SFO") l.name.should eq "San Francisco International Airport" l = Location.find_by_code("94128-SFO-0019") l.name.should eq "Gate 22" end it "should find a gate by airport" do l = Location.find_by_airport_and_gate("SFO", "Gate 22") l.name.should eq "Gate 22" l.code.should eq "94128-SFO-0019" l = Location.find_by_airport_and_gate("SFO", "Gate 24") l.name.should eq "Gate 24" l.code.should eq "94128-SFO-0024" end it "should find a leaf node by a crumb trail of codes" do l = Location.find_by_codes(["SFO", "94128-SFO-0019"]) l.name.should eq "Gate 22" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
location-service-client-0.1.4 | spec/lib/location_spec.rb |
location-service-client-0.1.3 | spec/lib/location_spec.rb |
location-service-client-0.1.0 | spec/lib/location_spec.rb |