Files
osem/spec/controllers/conferences_controller_spec.rb
Ana María Martínez Gómez d1180e2767 Use keyword arguments in tests
Raisl 5.1 removes support for non-keyword arguments in `#process`,
`#get`, `#post`, `#patch`, `#put`, `#delete`, and `#head` for the
`ActionDispatch::IntegrationTest` and `ActionController::TestCase`
classes. This means we have to add `params` everywhere in the controller
tests.
2019-05-14 14:10:36 +02:00

53 lines
1.4 KiB
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe ConferencesController do
let(:conference) { create(:conference, splashpage: create(:splashpage, public: true), venue: create(:venue)) }
let!(:cfp) { create(:cfp, program: conference.program) }
let(:room) { create(:room, venue: conference.venue) }
describe 'GET #index' do
it 'Response code is 200' do
get :index
expect(response.response_code).to eq(200)
end
end
describe 'GET #show' do
context 'conference made public' do
it 'assigns the requested conference to conference' do
get :show, params: { id: conference.short_title }
expect(assigns(:conference)).to eq conference
end
it 'renders the show template' do
get :show, params: { id: conference.short_title }
expect(response).to render_template :show
end
end
context 'accessing conference via custom domain' do
before do
conference.update_attribute(:custom_domain, 'lvh.me')
@request.host = 'lvh.me'
end
it 'assigns correct conference' do
get :show
expect(response).to render_template :show
expect(assigns(:conference)).to eq conference
end
end
end
describe 'OPTIONS #index' do
it 'Response code is 200' do
process :index
expect(response.response_code).to eq(200)
end
end
end