refactored conferences controller, dividing responsabilities using an service and an query

This commit is contained in:
Carlos Daniel Pohlod 2022-11-15 17:26:18 -03:00 committed by Henne Vogelsang
parent fd01351a92
commit 7b48daba07
6 changed files with 354 additions and 46 deletions

View file

@ -0,0 +1,35 @@
# frozen_string_literal: true
require 'spec_helper'
describe Queries::Conferences, type: :query do
describe '::conference_by_filter' do
let!(:conference) { create :conference }
it 'returns conference by flter' do
result = described_class::conference_by_filter({
id: conference.id
})
expect(result).to eq(conference)
end
end
describe '.sponsorship_levels' do
let!(:conference) { create :full_conference }
it 'returns sponsorship_levels' do
result = described_class.new(conference: conference).sponsorship_levels
expect(result.map(&:id).sort).to eq(conference.sponsorship_levels.map(&:id).sort)
end
end
describe '.confirmed_tracks' do
let!(:conference) { create :full_conference }
it 'returns confirmed_tracks' do
result = described_class.new(conference: conference).confirmed_tracks
expect(result.map(&:id).sort).to eq(conference.confirmed_tracks.map(&:id).sort)
end
end
end