Untitled

 avatar
unknown
plain_text
2 years ago
994 B
3
Indexable
# frozen_string_literal: true

require 'rails_helper'

describe Orders::NextFacilityForBookingSpec, type: :service do
  describe 'initialize' do
    let!(:facility) { create(:facility) }
    let!(:created_by_venue) { create(:created_by_venue) }
    let!(:internal_order_uuid) { create(:internal_order_uuid) }

    it { expect(service.facility).to eq(facility) }
    it { expect(service.created_by_venue).to eq(created_by_venue) }
    it { expect(service.internal_order_uuid).to eq(internal_order_uuid) }
  end

  describe 'validations' do
    it { is_expected.to validate_presence_of(:facility) }

    context 'validate_any_non_custom_booking_option_presence' do

    end
  end

  context 'when validation passed' do
    it 'returns true' do
      expect(service.perform).to be(true)
    end
  end

  context 'when validation failed' do
    before { allow(service).to receive(:valid?).and_return(false) }

    it 'returns falsey' do
      expect(service.perform).to be_falsey
    end
  end
end
Editor is loading...