Sha256: d116850ac9dfcc9858806e8798914a1352a11d3c4933824d720a8e77ba53ec49

Contents?: true

Size: 1.72 KB

Versions: 9

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'

describe Indico do
    before do
        api_key = ENV['INDICO_API_KEY']
        private_cloud = 'indico-test'
        @config = { api_key: api_key, cloud: private_cloud}
    end

    it 'should tag text with correct political tags' do
      expected_keys = Set.new(%w(Conservative Green Liberal Libertarian))
      data = ['Guns don\'t kill people.', ' People kill people.']
      response = Indico.political(data, @config)

      expect(Set.new(response[0].keys)).to eql(expected_keys)
      expect(Set.new(response[1].keys)).to eql(expected_keys)
    end

    it 'should tag text with correct political tags' do
      expected_keys = Set.new(%w(Conservative Green Liberal Libertarian))
      response = Indico.political('Guns don\'t kill people. People kill people.')

      expect(Set.new(response.keys)).to eql(expected_keys)
    end

    it 'single political should return the right response' do
        expected_keys = Set.new(%w(Conservative Green Liberal Libertarian))

        config = @config.clone
        config["version"] = 1
        response = Indico.political('Guns don\'t kill people. People kill people.')

        expect(Set.new(response.keys)).to eql(expected_keys)
    end

    it 'batch political should return the right response' do
        expected_keys = Set.new(%w(Conservative Green Liberal Libertarian))
        data = 'Guns don\'t kill people. People kill people.'

        config = @config.clone
        config["version"] = 1
        response = Indico.political([data, data])

        expect(response.length).to eql(2)
        expect(Set.new(response[0].keys)).to eql(expected_keys)
        expect(Set.new(response[1].keys)).to eql(expected_keys)
    end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
indico-0.10.5 spec/political_spec.rb
indico-0.10.4 spec/political_spec.rb
indico-0.10.3 spec/political_spec.rb
indico-0.9.6 spec/political_spec.rb
indico-0.10.2 spec/political_spec.rb
indico-0.10.1 spec/political_spec.rb
indico-0.10.0 spec/political_spec.rb
indico-0.9.5 spec/political_spec.rb
indico-0.9.4 spec/political_spec.rb