mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Allow root URL to redirect to a conference via ENV var.
This commit is contained in:
parent
f062f7f4ee
commit
73c5c3c97a
5 changed files with 40 additions and 1 deletions
2
Gemfile
2
Gemfile
|
|
@ -263,6 +263,8 @@ group :test do
|
|||
gem 'json-schema'
|
||||
# For using 'assigns' in tests
|
||||
gem 'rails-controller-testing'
|
||||
# For managing the environment
|
||||
gem 'climate_control'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ GEM
|
|||
railties (> 3.1)
|
||||
chronic (0.10.2)
|
||||
chunky_png (1.3.8)
|
||||
climate_control (0.2.0)
|
||||
cliver (0.3.2)
|
||||
cloudinary (1.1.6)
|
||||
aws_cf_signer
|
||||
|
|
@ -586,6 +587,7 @@ DEPENDENCIES
|
|||
carrierwave
|
||||
carrierwave-bombshelter
|
||||
chart-js-rails
|
||||
climate_control
|
||||
cloudinary
|
||||
cocoon
|
||||
countable-rails (~> 0.0.1)
|
||||
|
|
|
|||
|
|
@ -214,5 +214,9 @@ Osem::Application.routes.draw do
|
|||
|
||||
get '/admin' => redirect('/admin/conferences')
|
||||
|
||||
root to: 'conferences#index', via: [:get, :options]
|
||||
unless ENV['OSEM_ROOT_CONFERENCE'].blank?
|
||||
root to: redirect("/conferences/#{ENV['OSEM_ROOT_CONFERENCE']}")
|
||||
else
|
||||
root to: 'conferences#index', via: [:get, :options]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ OSEM_HOSTNAME="localhost:3000"
|
|||
# The address OSEM uses for sending mails
|
||||
OSEM_EMAIL_ADDRESS="no-reply@localhost"
|
||||
|
||||
# (Optional) The Conference#short_title to redirect the root URL to
|
||||
#OSEM_ROOT_CONFERENCE=''
|
||||
|
||||
# The api key for transifex.com.
|
||||
# See TRANSLATION.md for details
|
||||
OSEM_TRANSIFEX_APIKEY=""
|
||||
|
|
|
|||
28
spec/routing/routing_spec.rb
Normal file
28
spec/routing/routing_spec.rb
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'Routing', type: :routing do
|
||||
let(:conference) { create(:conference) }
|
||||
|
||||
context 'the root URL' do
|
||||
it 'routes to conferences#index' do
|
||||
expect(get: '/').to route_to(
|
||||
controller: 'conferences',
|
||||
action: 'index'
|
||||
)
|
||||
end
|
||||
|
||||
# FIXME: this doesn't work due to routes being statically loaded
|
||||
# See https://github.com/rspec/rspec-rails/issues/817 for example
|
||||
# context 'with OSEM_ROOT_CONFERENCE set' do
|
||||
# it 'redirects to the conference' do
|
||||
# ClimateControl.modify OSEM_ROOT_CONFERENCE: conference.short_title do
|
||||
# expect(get: '/').to route_to(
|
||||
# controller: 'conferences',
|
||||
# action: 'show',
|
||||
# id: conference.short_title
|
||||
# )
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue