suggested changes that includes:

moving actions for custom domain in its own controller
use separate service class for custom domains
updated help text for custom domains
increased test coverage for custom domains
This commit is contained in:
shlok007 2017-08-19 13:57:09 +05:30
parent d2b5ec1770
commit bc17f210a6
14 changed files with 208 additions and 73 deletions

View file

@ -0,0 +1,42 @@
require 'spec_helper'
describe Admin::ConferenceDomainsController do
let!(:admin) { create(:admin) }
let!(:conference) { create(:conference) }
context 'as signed in admin' do
before do
sign_in admin
end
describe 'GET #show' do
it 'redirects to edit if custom domain is not present' do
get :show, conference_id: conference.short_title
expect(response).to redirect_to(admin_conference_conference_domains_edit_path)
end
it 'renders correct template if custom domain is present' do
conference.update_attribute(:custom_domain, 'mydomain.conf')
get :show, conference_id: conference.short_title
expect(response).to render_template('show')
end
end
describe 'PATCH #update' do
before do
patch :update, conference_id: conference.short_title,
conference: { custom_domain: 'newdomain.conf' }
end
it 'successfully updates the custom domain' do
expect(conference.reload.custom_domain).to eq('newdomain.conf')
end
end
describe 'GET #edit' do
it 'renders correct template' do
get :edit, conference_id: conference.short_title
expect(response).to render_template('edit')
end
end
end
end

View file

@ -135,15 +135,6 @@ describe Admin::ConferencesController do
end
end
end
describe 'GET #custom_domain', blah: true do
it 'render custom domain' do
get :custom_domain, id: conference.short_title
expect(response).to render_template :custom_domain
expect(response).to be_success
end
end
end
shared_examples 'access as organization_admin' do