Sha256: 134f12e2794dab939b5882a86c87c2ffae5619f06c84294ace1de14b671fbffe

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require "webmock/test_unit"
require "test/unit"
require "shoulda"
require "./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 => {})
      #   
      stub_request(:get, /api.datasift.net\/stream.json/).
          with(:headers => {'Accept'=>'*/*'}).
          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

5 entries across 5 versions & 1 rubygems

Version Path
rsift-0.3.6 test/unit/data_test.rb
rsift-0.3.5 test/unit/data_test.rb
rsift-0.3.4 test/unit/data_test.rb
rsift-0.3.3 test/unit/data_test.rb
rsift-0.3.2 test/unit/data_test.rb