Created
March 14, 2012 14:57
-
-
Save cmar/2037033 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spree_shared/apartment_elevator' | |
require 'action_dispatch' | |
require 'rails/rack/logger' | |
module Apartment | |
module Elevators | |
describe Subdomain do | |
before do | |
@env = double("env") | |
@request = double("request") | |
@request.stub(:url => "http://fancy-mart-123.spreeworks.com/cart", | |
:subdomain => "fancy-mart-123") | |
ActionDispatch::Request.stub(:new => @request) | |
@app = double("app") | |
@rack = Apartment::Elevators::Subdomain.new(@app) | |
end | |
it "sets the cache to internal_subdomain name" do | |
@app.should_receive(:call).with(@env) | |
@rack.call(@env) | |
ENV['RAILS_CACHE_ID'].should eq "fancy-mart-123" | |
end | |
it "parses out the subdomain" do | |
@rack.subdomain(@request).should eq 'fancy-mart-123' | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment