mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
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.
44 lines
1.2 KiB
Ruby
44 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
describe Api::V1::SpeakersController do
|
|
let!(:conference) { create(:conference) }
|
|
let!(:event) { create(:event_full) }
|
|
let!(:conference_event) { create(:event_full, program: conference.program) }
|
|
|
|
let(:speaker) { create(:user, name: 'Speaker') }
|
|
let(:conference_speaker) { create(:user, name: 'Conf_Speaker') }
|
|
|
|
describe 'GET #index' do
|
|
before do
|
|
event.speakers = [speaker]
|
|
conference_event.speakers = [conference_speaker]
|
|
end
|
|
|
|
context 'without conference scope' do
|
|
it 'returns all speakers' do
|
|
|
|
get :index, params: { format: :json }
|
|
json = JSON.parse(response.body)['speakers']
|
|
expect(response).to be_success
|
|
expect(json.length).to eq(2)
|
|
expect(json[0]['name']).to eq('Speaker')
|
|
expect(json[1]['name']).to eq('Conf_Speaker')
|
|
end
|
|
end
|
|
|
|
context 'with conference scope' do
|
|
it 'returns all speakers of conference' do
|
|
|
|
get :index, params: { conference_id: conference.short_title, format: :json }
|
|
json = JSON.parse(response.body)['speakers']
|
|
|
|
expect(response).to be_success
|
|
|
|
expect(json.length).to eq(1)
|
|
expect(json[0]['name']).to eq('Conf_Speaker')
|
|
end
|
|
end
|
|
end
|
|
end
|