Sha256: 0afe525212541ff786516b2492f532f48e0017f58702ff4f2ae5135fe03815cb

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require "spec_helper"

describe Paymill::Client do
  let(:valid_attributes) do
    { email: "stefan.sprenger@dkd.de", description: "First customer." }
  end

  let (:client) do
    Paymill::Client.new(valid_attributes)
  end

  describe "#initialize" do
    it "initializes all attributes correctly" do
      client.email.should eql("stefan.sprenger@dkd.de")
      client.description.should eql("First customer.")
    end
  end

  describe ".find" do
    it "makes a new GET request using the correct API endpoint to receive a specific client" do
      Paymill.should_receive(:request).with(:get, "clients/123", {}).and_return("data" => {})
      Paymill::Client.find("123")
    end
  end

  describe ".all" do
    it "makes a new GET request using the correct API endpoint to receive all clients" do
      Paymill.should_receive(:request).with(:get, "clients/", {}).and_return("data" => {})
      Paymill::Client.all
    end
  end

  describe ".delete" do
    it "makes a new DELETE request using the correct API endpoint" do
      Paymill.should_receive(:request).with(:delete, "clients/123", {}).and_return(true)
      Paymill::Client.delete("123")
    end
  end

  describe ".create" do
    it "makes a new POST request using the correct API endpoint" do
      Paymill.should_receive(:request).with(:post, "clients", valid_attributes).and_return("data" => {})
      Paymill::Client.create(valid_attributes)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paymill-0.1.0 spec/paymill/client_spec.rb
paymill-0.0.3 spec/paymill/client_spec.rb