Sha256: 5e37f7ec5c054ca31303f396f6cbc57d6d78909f5295e3e723c9b22e4d278fd0

Contents?: true

Size: 883 Bytes

Versions: 1

Compression:

Stored size: 883 Bytes

Contents

require "webmock/test_unit"
require "test/unit"
require "shoulda"
require_relative "../../lib/rsift"

class DataTest < Test::Unit::TestCase
  include WebMock::API

  def setup
    @api_url = YAML::load_file("config/keys.yml")["url"]
    @api_key = YAML::load_file("config/keys.yml")["api-key"]
    @username = YAML::load_file("config/keys.yml")["username"]
    @data = Rsift::Data.new(@api_url,@api_key,@username)
  end  

  context "with data" do
    setup do
      body = '{"success":true}'
      stub_request(:get, /api.datasift.net\/stream.json/).
        with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
        to_return(:status => 200, :body => body, :headers => {})
      
    end
    
    should "get a comment" do
      opts = {:stream_identifier => "1", :count => 10}
      response = @data.do(opts)
      assert_equal true, response["success"]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rsift-0.3.1 test/unit/data_test.rb