Sha256: 1a461bf49dcf097beb803e15811b47654f9dde1e846fc50bdc460f927323bbc5

Contents?: true

Size: 1.6 KB

Versions: 19

Compression:

Stored size: 1.6 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))

describe 'Jpmobile::Mobile::valid_ip?' do
  [
    ['210.153.84.1', :Docomo],
    ['210.153.84.254', :Docomo],
    ['210.230.128.225', :Au],
    ['210.230.128.238', :Au],
    ['123.108.237.1', :Softbank],
    ['123.108.237.31', :Softbank],
    ['123.108.237.1', :Vodafone],
    ['123.108.237.31', :Vodafone],
    ['61.198.142.1', :Willcom],
    ['61.198.142.254', :Willcom],
    ['61.198.142.1', :Ddipocket],
    ['61.198.142.254', :Ddipocket],
    ['117.55.1.224', :Emobile],
    ['117.55.1.254', :Emobile],
  ].each do |remote_ip, carrier|
    it "should be return true if #{remote_ip} is in #{carrier} address" do
      expect(Jpmobile::Mobile.const_get(carrier).valid_ip?(remote_ip)).to eq(true)
    end
  end

  [
    ['127.0.0.1', :Docomo],
    ['210.153.83.1', :Docomo],
    ['210.153.83.254', :Docomo],
    ['127.0.0.1', :Au],
    ['210.169.41.1', :Au],
    ['210.169.41.254', :Au],
    ['127.0.0.1', :Softbank],
    ['123.108.238.1', :Softbank],
    ['123.108.238.254', :Softbank],
    ['127.0.0.1', :Vodafone],
    ['123.108.238.1', :Vodafone],
    ['123.108.238.254', :Vodafone],
    ['127.0.0.1', :Willcom],
    ['61.198.144.1', :Willcom],
    ['61.198.144.254', :Willcom],
    ['127.0.0.1', :Ddipocket],
    ['61.198.144.1', :Ddipocket],
    ['61.198.144.254', :Ddipocket],
    ['127.0.0.1', :Emobile],
    ['117.55.1.223', :Emobile],
  ].each do |remote_ip, carrier|
    it "should not be return true if #{remote_ip} is in #{carrier} address" do
      expect(Jpmobile::Mobile.const_get(carrier).valid_ip?(remote_ip)).not_to eq(true)
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
jpmobile-8.0.0 spec/unit/valid_ip_spec.rb
jpmobile-7.2.0 spec/unit/valid_ip_spec.rb
jpmobile-7.1.0 spec/unit/valid_ip_spec.rb
jpmobile-7.0.4 spec/unit/valid_ip_spec.rb
jpmobile-7.0.3 spec/unit/valid_ip_spec.rb
jpmobile-7.0.2 spec/unit/valid_ip_spec.rb
jpmobile-7.0.1 spec/unit/valid_ip_spec.rb
jpmobile-7.0.0 spec/unit/valid_ip_spec.rb
jpmobile-6.1.2 spec/unit/valid_ip_spec.rb
jpmobile-6.1.1 spec/unit/valid_ip_spec.rb
jpmobile-6.1.0 spec/unit/valid_ip_spec.rb
jpmobile-6.0.0 spec/unit/valid_ip_spec.rb
jpmobile-5.2.5 spec/unit/valid_ip_spec.rb
jpmobile-6.0.0.beta spec/unit/valid_ip_spec.rb
jpmobile-5.2.4 spec/unit/valid_ip_spec.rb
jpmobile-5.2.3 spec/unit/valid_ip_spec.rb
jpmobile-5.2.2 spec/unit/valid_ip_spec.rb
jpmobile-5.2.1 spec/unit/valid_ip_spec.rb
jpmobile-5.2.0 spec/unit/valid_ip_spec.rb