Merge f3358ec20b into bd95c5e628
This commit is contained in:
commit
2196b66bb1
2 changed files with 38 additions and 3 deletions
|
|
@ -6,6 +6,11 @@ class ConferencesController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc)
|
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc)
|
||||||
@antiquated = @conferences - @current
|
@antiquated = @conferences - @current
|
||||||
|
|
||||||
|
redirect_to @current.first if @current.count == 1 and
|
||||||
|
@current.first.splashpage and
|
||||||
|
@current.first.splashpage.public
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,39 @@ describe ConferencesController do
|
||||||
let(:room) { create(:room, venue: conference.venue) }
|
let(:room) { create(:room, venue: conference.venue) }
|
||||||
|
|
||||||
describe 'GET #index' do
|
describe 'GET #index' do
|
||||||
it 'Response code is 200' do
|
context 'without conference' do
|
||||||
get :index
|
it 'Response code is 200' do
|
||||||
expect(response.response_code).to eq(200)
|
conference.destroy!
|
||||||
|
get :index
|
||||||
|
expect(response.response_code).to eq(200)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with one next conference' do
|
||||||
|
describe 'with splashpage' do
|
||||||
|
it 'Response code is 200 when is not public' do
|
||||||
|
current = Conference.first
|
||||||
|
current.splashpage.public = false
|
||||||
|
current.splashpage.save
|
||||||
|
get :index
|
||||||
|
expect(response.response_code).to eq(200)
|
||||||
|
end
|
||||||
|
it 'Response code is 302 when is public' do
|
||||||
|
get :index
|
||||||
|
expect(response.response_code).to eq(302)
|
||||||
|
end
|
||||||
|
it 'Redirect to conference#show' do
|
||||||
|
get :index
|
||||||
|
expect(response).to redirect_to(conference_path(conference))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
describe 'without splashpage' do
|
||||||
|
it 'Response code is 200' do
|
||||||
|
conference.splashpage.destroy!
|
||||||
|
get :index
|
||||||
|
expect(response.response_code).to eq(200)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue