spec/profile_spec.rb in divining_rod-0.4.0 vs spec/profile_spec.rb in divining_rod-0.5.0
- old
+ new
@@ -1,11 +1,11 @@
require 'spec_helper'
describe DiviningRod do
before :each do
- @request = mock("rails_request", :user_agent => 'My iPhone which is actually an iPad')
+ @request = request_mock(:ua => 'My iPhone which is actually an iPad')
DiviningRod::Mappings.define do |map|
map.ua /iPhone/, :format => :webkit, :tags => [:iphone, :youtube, :geolocate] do |iphone|
iphone.ua /iPad/, :tags => [:ipad]
end
@@ -28,11 +28,11 @@
end
describe "without a default route" do
before :each do
- @request = mock("rails_request", :user_agent => 'My Foo Fone', :format => :html)
+ @request = request_mock(:ua => 'My Foo Fone', :format => :html)
DiviningRod::Mappings.define do |map|
map.ua /iPhone/, :format => :webkit, :tags => [:iphone, :youtube, :geolocate]
end
end
@@ -47,11 +47,11 @@
describe "with a default route" do
before :each do
- @request = mock("rails_request", :user_agent => 'My Foo Fone')
+ @request = request_mock(:ua => 'My Foo Fone')
DiviningRod::Mappings.define do |map|
map.ua /iPhone/, :format => :webkit, :tags => [:iphone, :youtube, :geolocate]
map.default :format => :html
end
@@ -66,11 +66,11 @@
end
describe "without a default definition" do
before :each do
- @request = mock("rails_request", :user_agent => 'Foo Fone', :format => :html)
+ @request = request_mock(:ua => 'Foo Fone', :format => :html)
DiviningRod::Mappings.define do |map|
map.ua /iPhone/, :format => :webkit, :tags => [:iphone, :youtube, :geolocate]
end
end
@@ -82,11 +82,11 @@
end
describe "matching a subdomain" do
before :each do
- @request = mock("rails_request", :user_agent => 'Foo Fone', :subdomains => ['wap'])
+ @request = request_mock(:ua => 'Foo Fone', :host => 'wap.example.com')
DiviningRod::Mappings.define do |map|
map.subdomain /wap/, :format => :wap, :tags => [:shitty]
end
end
@@ -100,10 +100,10 @@
end
describe "matching the weird requests(no user_agent passed)" do
before :each do
- @request = mock("rails_request", :user_agent => nil, :subdomains => [])
+ @request = request_mock(:ua => nil, :subdomains => [])
DiviningRod::Mappings.define do |map|
map.ua /iPhone/, :format => :wap, :tags => [:shitty]
end
end