initialize(data_source: MovieProduction) super end def find_by_id(id) wrap(data_source.find_by_id(id)) end def search_by_title(title) wrap(data_source.search_by_title(title)) end end
repo: ProductionRepo.new) super end def call # validate inputs # is it okay to onboard a production? # cover edge cases # notify others about a production being onboarded end end end
} let(:vertical_id) { SecureRandom.uuid } let(:response) do described_class.call(production_id: production_id, vertical_id: vertical_id, repo: repo) end describe 'when a production already exists' do let(:repo) { instance_double(Workflow::ProductionRepo, find_by_id: existing_production) } it 'the response is a failure' do expect(response).to be_a_failure end end ... end