Sha256: 24fe75b3ad98b2d4cf41b2743f5301b3a3c571eaf681eec85d175a9dd3a88f96

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

require "spec_helper"

describe Emites::Client do
  let(:token) { "7A75E575CFDEDB91FF7E2CE22089181A" }
  subject     { described_class.new(token) }

  describe "#authenticated?" do
    context "with a valid token" do
      it "returns true" do
        VCR.use_cassette("client/authenticated/true") do
          expect(subject.authenticated?).to be_truthy
        end
      end
    end

    context "with an invalid token" do
      subject { described_class.new("FAKE-TOKEN") }

      it "returns false" do
        VCR.use_cassette("client/authenticated/false") do
          expect(subject.authenticated?).to be_falsey
        end
      end
    end
  end

  describe "#emitters" do
    it "returns an instance of Emites::Resources::Emitter" do
      expect(subject.emitters).to be_a(Emites::Resources::Emitter)
    end
  end

  describe "#webhooks" do
    it "returns an instance of Emites::Resources::Webhook" do
      expect(subject.webhooks).to be_a(Emites::Resources::Webhook)
    end
  end

  describe "#nfse" do
    it "returns an instance of Emites::Resources::Nfse" do
      expect(subject.nfse).to be_a(Emites::Resources::Nfse)
    end
  end

  describe "#takers" do
    it "returns an instance of Emites::Resources::Taker" do
      expect(subject.takers).to be_a(Emites::Resources::Taker)
    end
  end

  describe "#services" do
    it "returns an instance of Emites::Resources::Service" do
      expect(subject.services).to be_a(Emites::Resources::Service)
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
emites-client-0.1.4 spec/emites/client_spec.rb
emites-client-0.1.3 spec/emites/client_spec.rb
emites-client-0.1.2 spec/emites/client_spec.rb
emites-client-0.1.1 spec/emites/client_spec.rb
emites-client-0.1.0 spec/emites/client_spec.rb
emites-client-0.0.4 spec/emites/client_spec.rb
emites-client-0.0.3 spec/emites/client_spec.rb