Sha256: f79755f58c4d28a844a7967dd7df1c63ccaacc00c9f9fb74b08aa28ce3c88ff8
Contents?: true
Size: 968 Bytes
Versions: 6
Compression:
Stored size: 968 Bytes
Contents
require 'spec_helper' require 'apartment/elevators/domain' describe Apartment::Elevators::Domain do subject(:elevator){ described_class.new(Proc.new{}) } describe "#parse_tenant_name" do it "parses the host for a domain name" do request = ActionDispatch::Request.new('HTTP_HOST' => 'example.com') elevator.parse_tenant_name(request).should == 'example' end it "ignores a www prefix and domain suffix" do request = ActionDispatch::Request.new('HTTP_HOST' => 'www.example.bc.ca') elevator.parse_tenant_name(request).should == 'example' end it "returns nil if there is no host" do request = ActionDispatch::Request.new('HTTP_HOST' => '') elevator.parse_tenant_name(request).should be_nil end end describe "#call" do it "switches to the proper tenant" do Apartment::Database.should_receive(:switch).with('example') elevator.call('HTTP_HOST' => 'www.example.com') end end end
Version data entries
6 entries across 6 versions & 1 rubygems