Sha256: 5367d71f19b0f7e97174c83cde77774b8c1347be17daf4d4597ee06fc96ce1bc

Contents?: true

Size: 907 Bytes

Versions: 8

Compression:

Stored size: 907 Bytes

Contents

# -*- coding: utf-8 -*-
require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb')

describe Jpmobile::Rack::MobileCarrier, "android" do
  include Rack::Test::Methods

  context "端末種別で" do
    it "Android を判別できること" do
      res = Rack::MockRequest.env_for(
        'http://jpmobile-rails.org/',
        'HTTP_USER_AGENT' => 'Mozilla/5.0 (Linux; U; Android 1.6; ja-jp; SonyEriccsonSO-01B Build/R1EA018) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1')
      env = Jpmobile::Rack::MobileCarrier.new(UnitApplication.new).call(res)[1]

      expect(env['rack.jpmobile'].class).to            eq(Jpmobile::Mobile::Android)
      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
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jpmobile-4.2.5 spec/rack/jpmobile/android_spec.rb
jpmobile-4.2.4 spec/rack/jpmobile/android_spec.rb
jpmobile-4.1.5 spec/rack/jpmobile/android_spec.rb
jpmobile-4.2.3 spec/rack/jpmobile/android_spec.rb
jpmobile-4.2.2 spec/rack/jpmobile/android_spec.rb
jpmobile-4.2.1 spec/rack/jpmobile/android_spec.rb
jpmobile-4.2.0 spec/rack/jpmobile/android_spec.rb
jpmobile-4.1.4 spec/rack/jpmobile/android_spec.rb