Sha256: a8c149a7bc404347311689628a73f2693d1cb7b2c9ac81688ffaaaf1518763f8

Contents?: true

Size: 903 Bytes

Versions: 14

Compression:

Stored size: 903 Bytes

Contents

require 'spec_helper'

describe Ayadn::API do
	before do
    Ayadn::Settings.stub(:options).and_return({
        counts: {
          default: 50
        },
        timeline: {
          directed: 1,
          deleted: 0,
          html: 0,
          annotations: 1
        }
      })
  end
  describe ".build_query" do
    it 'returns a URL with count=12' do
      expect(Ayadn::API.build_query({count: 12})).to match /count=12/
    end
    it 'returns a URL with directed=0' do
      expect(Ayadn::API.build_query({directed: 0})).to match /directed=0/
    end
    it 'returns a URL with html=1' do
      expect(Ayadn::API.build_query({html: 1})).to match /html=1/
    end
  end
  describe "#check_response_meta_code" do
    it "returns original response if code is 200" do
      res = {'meta' => { 'code' => 200 }}
      expect(Ayadn::API.new.check_response_meta_code(res)).to eq res
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ayadn-1.8.2 spec/unit/api_spec.rb
ayadn-1.8.1 spec/unit/api_spec.rb
ayadn-1.8.0 spec/unit/api_spec.rb
ayadn-1.7.7 spec/unit/api_spec.rb
ayadn-1.7.6 spec/unit/api_spec.rb
ayadn-1.7.5 spec/unit/api_spec.rb
ayadn-1.7.4 spec/unit/api_spec.rb
ayadn-1.7.3 spec/unit/api_spec.rb
ayadn-1.7.2 spec/unit/api_spec.rb
ayadn-1.7.1 spec/unit/api_spec.rb
ayadn-1.7.0 spec/unit/api_spec.rb
ayadn-1.6.0 spec/unit/api_spec.rb
ayadn-1.5.1 spec/unit/api_spec.rb
ayadn-1.5.0 spec/unit/api_spec.rb