public
Description: Set of protected methods that use the subdomain as a way of identifying the current scope
Homepage:
Clone URL: git://github.com/jfernandez/submarine.git
submarine / spec / submarine / submarine_spec.rb
100644 32 lines (26 sloc) 0.841 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require File.dirname(__FILE__) + '/../spec_helper'
require 'spec'
 
module Submarine
  class UsersController < ActionController::Base
    include Submarine
    public :current_subdomain, :default_submarine_subdomain
    
    def index() render :nothing => true end
    alias_method :show, :index
    def rescue_action(e) raise end
  end
  
  class BlogsController < ActionController::Base
    include Submarine
    public :current_subdomain, :default_submarine_subdomain
    
    def subdomain_model; 'blog' end
    def subdomain_column; 'name' end
    def index() render :nothing => true end
    alias_method :show, :index
    def rescue_action(e) raise end
  end
end
 
describe Submarine::UsersController, :type => :controller do
  controller_name :users_controller
  
  it "should respond to #current_subdomain" do
    get 'index'
  end
end