Sha256: a5e7049dbfcbac646045a8db4be0bd9d1a959f48be572c0dab9b1d20e9dc36d7
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb') describe Jpmobile::MobileCarrier, 'iphone' do include Rack::Test::Methods context '端末種別で' do it 'iPhone を判別できること' do res = Rack::MockRequest.env_for( 'http://jpmobile-rails.org/', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; ja-jp) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16' ) env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1] expect(env['rack.jpmobile'].class).to eq(Jpmobile::Mobile::Iphone) expect(env['rack.jpmobile'].position).to be_nil expect(env['rack.jpmobile'].smart_phone?).to be_truthy expect(env['rack.jpmobile'].supports_cookie?).to be_truthy end end context 'IPアドレス制限で' do it 'Softbank 網からのアクセスでも invalid になること' do res = Rack::MockRequest.env_for( 'http://jpmobile-rails.org/', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; ja-jp) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16', 'REMOTE_ADDR' => '202.179.204.1' ) env = Jpmobile::MobileCarrier.new(UnitApplication.new).call(res)[1] expect(env['rack.jpmobile'].valid_ip?).to be_falsey end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jpmobile-5.0.1 | spec/rack/jpmobile/iphone_spec.rb |
jpmobile-5.1.1 | spec/rack/jpmobile/iphone_spec.rb |
jpmobile-5.1.0 | spec/rack/jpmobile/iphone_spec.rb |