Sha256: 9ae93b9a300cc2ba3da322ac93e6647732510b1bb87aa54dfa609f98bdc1989e

Contents?: true

Size: 698 Bytes

Versions: 5

Compression:

Stored size: 698 Bytes

Contents

require 'streambot/base_test'

module StreamBot
  # test for http wrapper class
  class TestHttp < StreamBot::BaseTest
    # setup 
    def setup
      super
      WebMock.disable_net_connect!
      @http = StreamBot::HTTP.new(@params['http'])
      stub_request(:post, "http://#{@params['http']['username']}:#{@params['http']['password']}@api.twitter.com/path/to/data").to_return(:body => "response")
    end

    # test a post with basic authentication
    def test_post
      res = @http.post('/path/to/data',nil)
      assert_not_nil(res)
      assert_equal("response", res)
    end

    # nil all variables
    def teardown
      @http = nil
      WebMock.allow_net_connect!
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
streambot-0.5.1 test/streambot/test_http.rb
streambot-0.5.0.beta5 test/streambot/test_http.rb
streambot-0.5.0.beta4 test/streambot/test_http.rb
streambot-0.5.0.beta3 test/streambot/test_http.rb
streambot-0.4.0 test/streambot/test_http.rb