Sha256: 71b4fc8d39a98f0b7c97448bfbee795bbc2ac5b19a07ceed2cc298cbe4d224f9

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

require "spec_helper"

describe DiscountNetwork::Client do
  describe ".post_resource" do
    it "requests the resource via :post" do
      stub_discountnetwork_ping_request(:post, request_data)
      response = DiscountNetwork.post_resource("ping", request_data)

      expect(response.data).to eq("Pong!")
    end
  end

  describe ".get_resource" do
    it "requests the resource via :get" do
      stub_discountnetwork_ping_request(:get, request_data)
      response = DiscountNetwork.get_resource("ping", request_data)

      expect(response.data).to eq("Pong!")
    end
  end

  describe ".put_resource" do
    it "requests the resource via :put" do
      stub_discountnetwork_ping_request(:put, request_data)
      response = DiscountNetwork.put_resource("ping", request_data)

      expect(response.data).to eq("Pong!")
    end
  end

  def request_data
    { content: "Ping Request" }
  end

  def stub_discountnetwork_ping_request(method, data, end_point = "ping")
    stub_api_response(
      method, end_point, data: data, filename: "ping", status: 200
    )
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
discountnetwork-0.1.3 spec/discountnetwork/client_spec.rb
discountnetwork-0.1.2 spec/discountnetwork/client_spec.rb
discountnetwork-0.1.1 spec/discountnetwork/client_spec.rb
discountnetwork-0.1.0 spec/discountnetwork/client_spec.rb