Sha256: faf56c88176fca73fb80e81c5597a005a495aceee8344e4ed9c7394ad2a2af4e

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Viglink::Product do

  let(:client) { Viglink::Client.new }

  describe "#find_products" do
    context "without search options" do

      before(:each) do
        @products_response = client.find_products
      end

      it "returns a Hash of products", vcr: true do
        @products_response.should be_kind_of Hash
      end

      it "retuns the total count of products", vcr: true do
        @products_response[:count].should_not be_nil
      end

      it "retuns an Array of products", vcr: true do
        @products_response.product.should_not be_nil
      end

    end

    context "with search options" do

      before(:each) do
        @products_response = client.find_products({full: true})
      end

      it "returns a Hash of products", vcr: true do
        @products_response.should be_kind_of Hash
      end

      context "response resources of product" do
        it "returns the `results`", vcr: true do
          @products_response[:results].should_not be_nil
        end

        it "returns the `parameters`", vcr: true do
          @products_response[:parameters].should_not be_nil
        end

        it "returns an `products`", vcr: true do
          @products_response.results.products.should_not be_nil
        end
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
viglink-api-0.1.1 spec/viglink_api/product_spec.rb
viglink-api-0.1.0 spec/viglink_api/product_spec.rb