* Throw away old system * Add new system * Add new example files * Replace all calls * add the most important docs * Add Specs * rename disable_ssl_requirement to require_ssl * cloudfiles isn't used/called in our code * since community_spotlight.list is only used as enable flag replace it with such one and remove all legacy and irelevant codepaths around it * die if session secret is unset and on heroku * First basic infrastructure for version information
69 lines
1.7 KiB
Ruby
69 lines
1.7 KiB
Ruby
# Copyright (c) 2010-2012, Diaspora Inc. This file is
|
|
# licensed under the Affero General Public License version 3 or later. See
|
|
# the COPYRIGHT file.
|
|
|
|
require 'spec_helper'
|
|
|
|
describe ApplicationController do
|
|
controller do
|
|
def user_signed_in?
|
|
nil
|
|
end
|
|
|
|
def current_user
|
|
nil
|
|
end
|
|
|
|
def index
|
|
render :nothing => true
|
|
end
|
|
end
|
|
|
|
describe '#set_diaspora_headers' do
|
|
it 'sets the version header' do
|
|
get :index
|
|
response.headers['X-Diaspora-Version'].should include AppConfig.version.number.get
|
|
end
|
|
|
|
context 'with git info' do
|
|
before do
|
|
AppConfig.stub(:git_available?).and_return(true)
|
|
AppConfig.stub(:git_update).and_return('yesterday')
|
|
AppConfig.stub(:git_revision).and_return('02395')
|
|
end
|
|
|
|
it 'sets the git header' do
|
|
get :index
|
|
response.headers['X-Git-Update'].should == 'yesterday'
|
|
response.headers['X-Git-Revision'].should == '02395'
|
|
end
|
|
end
|
|
end
|
|
|
|
describe '#mobile_switch' do
|
|
it 'sets the format to :mobile' do
|
|
request.format = :html
|
|
session[:mobile_view] = true
|
|
get :index
|
|
request.format.mobile?.should be_true
|
|
end
|
|
|
|
it 'uses :html for :tablets' do
|
|
request.format = :tablet
|
|
session[:tablet_view] = true
|
|
get :index
|
|
request.format.html?.should be_true
|
|
end
|
|
|
|
it "doesn't mess up other formats, like json" do
|
|
get :index, :format => 'json'
|
|
request.format.json?.should be_true
|
|
end
|
|
|
|
it "doesn't mess up other formats, like xml, even with :mobile session" do
|
|
session[:mobile_view] = true
|
|
get :index, :format => 'xml'
|
|
request.format.xml?.should be_true
|
|
end
|
|
end
|
|
end
|