File: response_spec.rb

package info (click to toggle)
ruby-twitter 7.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,856 kB
  • sloc: ruby: 10,919; makefile: 6
file content (21 lines) | stat: -rw-r--r-- 596 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'helper'

describe Twitter::Streaming::Response do
  subject { Twitter::Streaming::Response.new }

  describe '#on_headers_complete' do
    it 'should not error if status code is 200' do
      expect do
        subject << "HTTP/1.1 200 OK\r\nSome-Header: Woo\r\n\r\n"
      end.to_not raise_error
    end

    Twitter::Error::ERRORS.each do |code, klass|
      it "should raise an exception of type #{klass} for status code #{code}" do
        expect do
          subject << "HTTP/1.1 #{code} NOK\r\nSome-Header: Woo\r\n\r\n"
        end.to raise_error(klass)
      end
    end
  end
end