Extracted Splashpage from Conference

#418
This commit is contained in:
Chrisbr 2014-08-30 12:08:24 +02:00
parent 7793497862
commit fedb0753bf
42 changed files with 578 additions and 236 deletions

View file

@ -21,21 +21,21 @@ describe Admin::RegistrationPeriodsController do
context 'valid attributes' do
it 'locates the requested audience object' do
it 'locates the requested registration period object' do
patch :update, conference_id: conference.short_title, conference: attributes_for(:registration_period)
expect(assigns(:registration_period)).to eq(conference.registration_period)
end
it 'changes audience attributes' do
it 'changes registration period attributes' do
the_date = 10.days.from_now.to_date
patch :update, conference_id: conference.short_title, registration_period:
attributes_for(:registration_period,
description: 'Test')
attributes_for(:registration_period, start_date: the_date)
conference.reload
expect(conference.registration_period.description).to eq('Test')
expect(conference.registration_period.start_date.to_s).to eq(the_date.to_s)
end
it 'redirects to the updated conference' do
it 'redirects to the updated registration period' do
patch :update, conference_id: conference.short_title, registration_period:
attributes_for(:registration_period)
conference.reload
@ -83,7 +83,7 @@ describe Admin::RegistrationPeriodsController do
end
context 'with invalid attributes' do
it 'does not save the conference to the database' do
it 'does not save the registration period to the database' do
expected = expect do
post :create,
conference_id: conference.short_title,
@ -106,7 +106,7 @@ describe Admin::RegistrationPeriodsController do
end
describe 'GET #edit' do
it 'assigns the requested conference to conference' do
it 'assigns the requested registration period to @registration_period' do
get :edit, conference_id: conference.short_title
expect(assigns(:registration_period)).to eq conference.registration_period
end
@ -118,7 +118,7 @@ describe Admin::RegistrationPeriodsController do
end
describe 'GET #show' do
it 'assigns the requested registration period to registration period' do
it 'assigns the requested registration period to @registration_period' do
get :show, conference_id: conference.short_title
expect(assigns(:registration_period)).to eq conference.registration_period
end
@ -130,7 +130,7 @@ describe Admin::RegistrationPeriodsController do
end
describe 'GET #new' do
it 'assigns a new conference to conference' do
it 'assigns a new registration period to @registration_period' do
get :new, conference_id: conference.short_title
expect(assigns(:registration_period)).to be_a_new(RegistrationPeriod)
end

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe ConferenceController do
let(:conference) { create(:conference, make_conference_public: true) }
let(:conference) { create(:conference, splashpage: create(:splashpage, public: true)) }
describe 'GET #show' do
context 'conference made public' do
@ -15,19 +15,7 @@ describe ConferenceController do
expect(response).to render_template :show
end
end
context 'conference is not public' do
before(:each) { conference.update_attribute(:make_conference_public, false) }
it 'redirects to root path' do
get :show, id: conference.short_title
expect(response).to redirect_to root_path
end
it 'renders flash saying conference not ready' do
get :show, id: conference.short_title
expect(flash[:alert]).to eq('You are not authorized to access this page.')
end
end
context 'gallery photos for splash' do
it 'return conference photos' do
xhr :get, :gallery_photos, id: conference.short_title