Sha256: d085f56cec19d5e036cc66011ca6f53b0b0453d3f98c364d3f90dfd805449959

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe "resource" do
  before(:each) do
    ActionController::Routing::Routes.clear!
    SubdomainRoutes::Config.stub!(:domain_length).and_return(2)
  end
  
  describe "mappings" do
    it "should pass the specified subdomains to any nested routes" do
      map_subdomain(:admin) do |admin|
        admin.resources(:users) { |user| user.options[:subdomains].should == [ "admin" ] }
        admin.resource(:config) { |config| config.options[:subdomains].should == [ "admin" ] }
      end
    end
  end
    
  describe "routes" do
    before(:each) do
      map_subdomain(:admin) do |admin|
        admin.resources :users
        admin.resource :config
      end
    end
      
    it "should include the subdomains in the routing conditions" do
      ActionController::Routing::Routes.routes.each do |route|
        route.conditions[:subdomains].should == [ "admin" ]
      end
    end
    
    it "should include the subdomains in the routing conditions" do
      ActionController::Routing::Routes.routes.each do |route|
        route.requirements[:subdomains].should == [ "admin" ]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mholling-subdomain_routes-0.1.0 spec/resources_spec.rb