Sha256: 7d90b800f3979b89e213dc0b6079e55f1a30683123bf79db72c214eb15fb787f

Contents?: true

Size: 735 Bytes

Versions: 1

Compression:

Stored size: 735 Bytes

Contents

require 'spec_helper'
require "divining_rod/rack"
require "rack/test"

describe DiviningRod do
  include Rack::Test::Methods

  def app
    DiviningRod::Rack.new(app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['foo']] })
  end

  before :each do
    DiviningRod::Mappings.define do |map|
      map.ua /iPhone/, :format => :webkit, :tags => [:iphone, :youtube, :geolocate] do |iphone|
        iphone.ua /iPad/, :tags => [:ipad]
      end
    end
  end

  it "should profile an incoming request" do
    header 'User-Agent', "iPhone Safari"
    get "/"
    last_request.env['divining_rod.profile'].should be_an_instance_of(DiviningRod::Profile)
    last_request.env['divining_rod.profile'].iphone?.should be_true
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
divining_rod-0.5.0 spec/rack_spec.rb