require 'spec_helper'

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

  let(:request_options) do
    { device_serial_number: '12345678901', operator_name: 'sprint' }
  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
