require 'spec_helper'

describe Conduit::Driver::Fusion::PortSwapMdn do
  include SharedOptions

  let(:request_options) do
    {
      old_mdn: '1234567890', new_mdn: '9876543210', authorized_by: '123',
      first_name: 'Tudor', last_name: 'Robertson', street_number: '424',
      street_name: 'Main St', street_direction: 'SW', city: 'Palm Beach Gardens',
      state: 'FL', zip: '33413', account: 'user123', password: 'password'
    }
  end

  context 'with a host override' do
    subject do
      options = request_options.merge(credentials).
        merge(host_override: host_override)
      described_class.new(options)
    end

    it_should_behave_like 'a conduit-fusion action with host override'
  end

  context 'with a response' do
    subject do
      options = request_options.merge(credentials).merge(response_status)
      instance = described_class.new(options)
      response = instance.perform
      response.parser
    end

    context '(success)' do
      let(:response_status) { mock_success }
      it_should_behave_like 'a conduit-fusion action with a success response'
    end

    context '(failure)' do
      let(:response_status) { mock_failure }
      it_should_behave_like 'a conduit-fusion action with a failure response'
    end

    context '(error)' do
      let(:response_status) { mock_error }
      it_should_behave_like 'a conduit-fusion action with a error response'
    end
  end
end
