Sha256: 7015cc1bde8786f8f284d74ba43e0131e528993a1e4522eaaf29d6dd7c312f0f

Contents?: true

Size: 797 Bytes

Versions: 4

Compression:

Stored size: 797 Bytes

Contents

require "spec_helper"

describe DiscountNetwork::Provider do
  describe ".where" do
    it "retrieve all providers for a specific type" do
      provider_type = "hotel"
      stub_provider_listing_api(provider_type)
      providers = DiscountNetwork::Provider.where(type: provider_type)

      expect(providers.count).to eq(2)
      expect(providers.first.name).not_to be_nil
      expect(providers.first.images.thumb).not_to be_nil
    end
  end

  describe ".find_by_slug" do
    it "retrieves a specific provider by a slug" do
      provider_slug = "hotel-one"
      stub_provider_find_by_slug_api(provider_slug)
      provider = DiscountNetwork::Provider.find_by_slug(provider_slug)

      expect(provider.name).not_to be_nil
      expect(provider.slug).to eq(provider_slug)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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