Sha256: 489a3a673dbf64898c66701e2664efc0234a07f2d26ca1ba9fed4586ef62e995

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require "spec_helper"

describe Moiper::Request do
  describe "#process" do
    it "returns a Response object" do
      response = Moiper::Request.new.process("<someXml></someXml>")
      response.should be_kind_of Moiper::Response
    end
  end

  describe "#client" do
    let(:client) { Moiper::Request.new.client }

    it "uses SSL" do
      client.use_ssl?.should be_true
    end

    it "verifies the certificate" do
      client.verify_mode.should == OpenSSL::SSL::VERIFY_PEER
    end

    it "uses the right ca file" do
      client.ca_file.should == Moiper::Request::CA_FILE
    end
  end

  describe "#request" do
    subject { Moiper::Request.new.request }
    its(:content_type) { should eq "text/xml" }

    it "sets the correct token and key parameters" do
      Net::HTTP::Post.any_instance.should_receive(:basic_auth).with(Moiper.token, Moiper.key)
      Moiper::Request.new.request
    end

    it "has the correct user agent" do
      subject.get_fields("user-agent")[0].should eq "Moiper/#{Moiper::VERSION}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moiper-0.1.2 spec/moiper/request_spec.rb