Sha256: 49e99268e76e47f7d8fefd6ac7a789984c65cb433cf8ee5b9086c14449cd7cea

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require "spec_helper"

describe Fastbill::Automatic do
  describe ".request" do
    context "no api key and no email exists" do
      it "raises an authentication error" do
        expect { Fastbill::Automatic.request("Customer.get", {}) }.to raise_error(Fastbill::Automatic::AuthenticationError)
      end
    end
  end

  describe ".request_method" do

    before do
      Fastbill::Automatic.request_method = :https
    end
    after do
      Fastbill::Automatic.request_method = :https
    end

    context "supported request methods" do
      it "is set to HTTPS by default" do
        Fastbill::Automatic.request_method.should equal(:https)
      end
      it "can be set to :test" do
        Fastbill::Automatic.request_method = :test
        Fastbill::Automatic.request_method.should equal(:test)
      end
    end
    context "non supported request method" do
      it "raises an non supported error" do
        expect { Fastbill::Automatic.request_method = :test123 }.to raise_error(Fastbill::Automatic::NonSupportedRequestMethod)
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fastbill-automatic-0.0.4 spec/fastbill-automatic_spec.rb
fastbill-automatic-0.0.3 spec/fastbill-automatic_spec.rb