Sha256: 9c8291da67669ef335e3948526a67534401d463727cf36d0d3d56f47952d51df

Contents?: true

Size: 1.55 KB

Versions: 11

Compression:

Stored size: 1.55 KB

Contents

require File.expand_path('../../test_helper', __FILE__)

describe 'DataSift::HistoricsPreview' do
  before do
    auth      = DataSiftExample.new
    @datasift = auth.datasift
    @data     = OpenStruct.new

    @data.valid_csdl = 'interaction.content contains "ruby"'
    @data.sources = 'tumblr'
    @data.parameters = 'language.tag,freqDist,5;interaction.id,targetVol,hour'
    @data.start = '1398898800'
    @data.end = '1398985200'
  end

  ##
  # /preview/create
  #
  describe '#create' do
    before do
      VCR.use_cassette('preview/before_preview_create') do
        @hash = @datasift.compile(@data.valid_csdl)[:data][:hash]
      end
    end

    it 'can_create_historics_preview' do
      VCR.use_cassette('preview/preview_create_success') do
        response = @datasift.historics_preview.create(
          @hash, @data.sources, @data.parameters, @data.start, @data.end
        )
        assert_equal STATUS.accepted, response[:http][:status]
      end
    end
  end

  ##
  # /preview/get
  #
  describe '#get' do
    before do
      VCR.use_cassette('preview/before_preview_get') do
        @hash = @datasift.compile(@data.valid_csdl)[:data][:hash]
        @preview = @datasift.historics_preview.create(
          @hash, @data.sources, @data.parameters, @data.start, @data.end
        )
      end
    end

    it 'can get an Historics Preview' do
      VCR.use_cassette('preview/preview_get_success') do
        response = @datasift.historics_preview.get(@preview[:data][:id])
        assert_equal STATUS.accepted, response[:http][:status]
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
datasift-3.7.2 test/datasift/historics_preview_api_test.rb
datasift-3.5.2 test/datasift/historics_preview_api_test.rb
datasift-3.5.1 test/datasift/historics_preview_api_test.rb
datasift-3.7.1 test/datasift/historics_preview_api_test.rb
datasift-3.7.0 test/datasift/historics_preview_api_test.rb
datasift-3.6.2 test/datasift/historics_preview_api_test.rb
datasift-3.6.1 test/datasift/historics_preview_api_test.rb
datasift-3.6.0 test/datasift/historics_preview_api_test.rb
datasift-3.5.0 test/datasift/historics_preview_api_test.rb
datasift-3.4.0 test/datasift/historics_preview_api_test.rb
datasift-3.3.0 test/datasift/historics_preview_api_test.rb