Sha256: d90ebaa628dd139da331d935f63a8660d0829e43294e6968ec4d2146692ca6e0

Contents?: true

Size: 711 Bytes

Versions: 11

Compression:

Stored size: 711 Bytes

Contents

require 'helper'

describe Twitter::Error::ClientError do

  before do
    @client = Twitter::Client.new
  end

  Twitter::Error::ClientError.errors.each do |status, exception|
    [nil, "error", "errors"].each do |body|
      context "when HTTP status is #{status} and body is #{body.inspect}" do
        before do
          body_message = '{"' + body + '":"Client Error"}' unless body.nil?
          stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => 'sferik'}).to_return(:status => status, :body => body_message)
        end
        it "raises #{exception.name}" do
          expect{@client.user_timeline('sferik')}.to raise_error exception
        end
      end
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
twitter-4.8.1 spec/twitter/error/client_error_spec.rb
twitter-4.8.0 spec/twitter/error/client_error_spec.rb
twitter-4.7.0 spec/twitter/error/client_error_spec.rb
twitter-4.6.2 spec/twitter/error/client_error_spec.rb
twitter-4.6.1 spec/twitter/error/client_error_spec.rb
twitter-4.6.0 spec/twitter/error/client_error_spec.rb
twitter-4.5.0 spec/twitter/error/client_error_spec.rb
twitter-4.4.4 spec/twitter/error/client_error_spec.rb
twitter-4.4.3 spec/twitter/error/client_error_spec.rb
twitter-4.4.2 spec/twitter/error/client_error_spec.rb
twitter-4.4.1 spec/twitter/error/client_error_spec.rb