Sha256: 0823103d90258bd173fcd686a2dc79402dda202d65ef6ed0f822e63a398e9ef2

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "Query::Icao" do
  
  before(:each) do
    @valid = "KSFO"
    @invalid = "invalid"
  end
  
  describe "and class methods" do
    
    it "returns a format" do
      Query::Format::Icao.format.should == :icao
    end
    
    it "returns a country" do
      Query::Format::Icao.country_code.should be_nil
      Query::Format::Icao.country_code("KSFO").should == "US"
      Query::Format::Icao.country_code("CYYC").should == "CA"
      Query::Format::Icao.country_code("ETAA").should == "DE"
    end
    
    it "returns a regex" do
      Query::Format::Icao.regex.should_not be_nil
      Query::Format::Icao.regex.is_a?(Regexp).should be_true
    end
    
    it "returns the convertable_formats" do
      Query::Format::Icao.convertable_formats.should_not be_nil
      Query::Format::Icao.convertable_formats.is_a?(Array).should be_true
      Query::Format::Icao.convertable_formats.should == []
    end
    
    describe "is?," do
      
      it "recognizes a valid format" do
        Query::Format::Icao.is?(@valid).should be_true
      end
      
      it "recognizes non-valid format" do
        Query::Format::Icao.is?(@invalid).should be_false
      end
      
    end
  
    it "stubs to" do
      Query::Format::Icao.to.should be_nil
    end
    
    it "stubs convertable_formats" do
      Query::Format::Icao.convertable_formats.should == []
    end
    
    it "doesn't convert" do
      query = Barometer::Query.new(@valid)
      Query::Format::Icao.converts?(query).should be_false
    end
    
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
barometer-0.7.3 spec/formats/icao_spec.rb
barometer-0.7.2 spec/formats/icao_spec.rb
barometer-0.7.1 spec/formats/icao_spec.rb
barometer-0.7.0 spec/formats/icao_spec.rb
barometer-0.6.7 spec/formats/icao_spec.rb
barometer-0.6.6 spec/formats/icao_spec.rb