Sha256: af50f4f4e8be5a6af10e10836e812d4036fa7e0fe0aecccaef5ce9672ef11b58

Contents?: true

Size: 1.6 KB

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
jpmobile-5.0.1 spec/unit/valid_ip_spec.rb
jpmobile-5.1.1 spec/unit/valid_ip_spec.rb
jpmobile-5.1.0 spec/unit/valid_ip_spec.rb