Sha256: 4043864650debab8d3f0976b723950d65dc4e8679cdccc19a1dcebe0aec55cd0

Contents?: true

Size: 1.37 KB

Versions: 10

Compression:

Stored size: 1.37 KB

Contents

require "spec_helper"

describe Myfinance::Entities::WebhookCollection do
  let(:response) do
    double(
      headers: {},
      parsed_body: [
        {
          "webhook" => {
            "account_id" => 3613,
            "created_at" => "2015-09-21T15:41:05-03:00",
            "description" => "Webhook test",
            "entity_id" => 3798,
            "healthy_check_code" => "200",
            "id" => 76,
            "updated_at" => "2015-09-21T16:08:48-03:00",
            "url" => "https://sandbox.myfinance.com.br/docs/api/webhooks"
          }
        },{
          "webhook" => {
            "account_id" => 3613,
            "created_at" => "2015-09-21T16:15:22-03:00",
            "description" => "Webhook 1",
            "entity_id" => 3798,
            "healthy_check_code" => "200",
            "id" => 77,
            "updated_at" => "2015-09-21T16:15:35-03:00",
            "url" => "https://sandbox.myfinance.com.br/docs/api/webhooks"
          }
        }
      ]
    )
  end

  subject { Myfinance::Entities::WebhookCollection.new(response) }

  describe "#build" do
    it "returns order collection" do
      expect(subject.build).to be_a(Myfinance::Entities::WebhookCollection)
    end

    it "returns order" do
      subject.build
      expect(subject.collection.count).to eq(2)
      expect(subject.collection.first).to be_a(Myfinance::Entities::Webhook)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
myfinance-1.4.1 spec/lib/myfinance/entities/webhook_collection_spec.rb
myfinance-1.4.0 spec/lib/myfinance/entities/webhook_collection_spec.rb
myfinance-1.3.1 spec/lib/myfinance/entities/webhook_collection_spec.rb
myfinance-1.3.0 spec/lib/myfinance/entities/webhook_collection_spec.rb
myfinance-1.2.1 spec/lib/myfinance/entities/webhook_collection_spec.rb
myfinance-1.2.0 spec/lib/myfinance/entities/webhook_collection_spec.rb
myfinance-1.1.0 spec/lib/myfinance/entities/webhook_collection_spec.rb
myfinance-1.0.0 spec/lib/myfinance/entities/webhook_collection_spec.rb
myfinance-0.7.0 spec/lib/myfinance/entities/webhook_collection_spec.rb
myfinance-0.6.0 spec/lib/myfinance/entities/webhook_collection_spec.rb