Sha256: 02c702ecc6837efcc50554357962b6ae434c35bc5d62c31bdf2cea2d03d7a302

Contents?: true

Size: 1.38 KB

Versions: 13

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe Ayadn::Endpoints do
  before do
    Ayadn::Settings.stub(:user_token).and_return('XXX')
    Ayadn::Settings.stub(:options).and_return({
        counts: {
          unified: 33,
          default: 100
        },
        timeline: {
          directed: 1,
          deleted: 0,
          html: 0,
          annotations: 1
        }
      })
  end
  describe '#token_info' do
    it "returns the Token url" do
      expect(Ayadn::Endpoints.new.token_info).to eq 'https://alpha-api.app.net/stream/0/token/?access_token=XXX'
    end
  end
  describe '#unified' do
    it "returns the Unified url" do
      expect(Ayadn::Endpoints.new.unified({})).to eq 'https://alpha-api.app.net/stream/0/posts/stream/unified?access_token=XXX&count=33&include_html=0&include_directed=1&include_deleted=0&include_annotations=1'
    end
    it "returns the Unified url" do
      expect(Ayadn::Endpoints.new.unified({count: 66, html: 1})).to eq 'https://alpha-api.app.net/stream/0/posts/stream/unified?access_token=XXX&count=66&include_html=1&include_directed=1&include_deleted=0&include_annotations=1'
    end
    it "returns the Unified url" do
      expect(Ayadn::Endpoints.new.unified({since_id: 336699})).to eq 'https://alpha-api.app.net/stream/0/posts/stream/unified?access_token=XXX&count=100&include_html=0&include_directed=1&include_deleted=0&include_annotations=1&since_id=336699'
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ayadn-1.0.12 spec/unit/endpoints_spec.rb
ayadn-1.0.11 spec/unit/endpoints_spec.rb
ayadn-1.0.10 spec/unit/endpoints_spec.rb
ayadn-1.0.9 spec/unit/endpoints_spec.rb
ayadn-1.0.8 spec/unit/endpoints_spec.rb
ayadn-1.0.7 spec/unit/endpoints_spec.rb
ayadn-1.0.6 spec/unit/endpoints_spec.rb
ayadn-1.0.5 spec/unit/endpoints_spec.rb
ayadn-1.0.4 spec/unit/endpoints_spec.rb
ayadn-1.0.3 spec/unit/endpoints_spec.rb
ayadn-1.0.2 spec/unit/endpoints_spec.rb
ayadn-1.0.1 spec/unit/endpoints_spec.rb
ayadn-1.0.0 spec/unit/endpoints_spec.rb