Sha256: 20d7a9746529e07b14339e83ff64001a2f65f0455343ab4a6045d368c32478cc

Contents?: true

Size: 894 Bytes

Versions: 15

Compression:

Stored size: 894 Bytes

Contents

require 'spec_helper'

describe Ayadn::API do
	before do
    Ayadn::Settings.stub(:options).and_return({
        counts: {
          default: 50
        },
        timeline: {
          directed: 1,
          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_posts=0/
    end
    it 'returns a URL with html=0 anyway' do
      expect(Ayadn::API.build_query({html: 1})).to match /html=0/
    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

15 entries across 15 versions & 1 rubygems

Version Path
ayadn-3.0 spec/unit/api_spec.rb
ayadn-2.1 spec/unit/api_spec.rb
ayadn-2.0.12 spec/unit/api_spec.rb
ayadn-2.0.11 spec/unit/api_spec.rb
ayadn-2.0.10 spec/unit/api_spec.rb
ayadn-2.0.9 spec/unit/api_spec.rb
ayadn-2.0.8 spec/unit/api_spec.rb
ayadn-2.0.7 spec/unit/api_spec.rb
ayadn-2.0.6 spec/unit/api_spec.rb
ayadn-2.0.5 spec/unit/api_spec.rb
ayadn-2.0.4 spec/unit/api_spec.rb
ayadn-2.0.3 spec/unit/api_spec.rb
ayadn-2.0.2 spec/unit/api_spec.rb
ayadn-2.0.1 spec/unit/api_spec.rb
ayadn-2.0 spec/unit/api_spec.rb