require 'spec_helper'

module UniaraVirtualParser
  describe Client do
    before :each do
      described_class.instance_variable_set :@client, nil
    end

    let(:client) { double(:client, post: true) }

    describe '.client' do
      it 'create only one hurley_client object' do
        expect(Hurley::Client).to receive(:new).once { client }
        described_class.post '/batman'
        described_class.post '/batman'
      end
    end

    describe '.post' do
      it 'calls hurley_client and send the post' do
        expect(client).to receive(:post).with('/batman')
        allow(Hurley::Client).to receive(:new) { client }
        described_class.post '/batman'
      end
    end
  end
end

require 'spec_helper'

module UniaraVirtualParser
  describe Client do
    after :each do
      described_class.instance_variable_set :@client, nil
    end

    let(:client) { double(:client, post: true) }

    describe '.client' do
      it 'create only one hurley_client object' do
        expect(Hurley::Client).to receive(:new).once { client }
        described_class.post '/batman'
        described_class.post '/batman'
      end
    end

    describe '.post' do
      it 'calls hurley_client and send the post' do
        expect(client).to receive(:post).with('/batman')
        allow(Hurley::Client).to receive(:new) { client }
        described_class.post '/batman'
      end
    end
  end
end

Fix the reset Client status in client
Fix the reset Client status in client
