Sha256: ff1e5d7c99f6c573c73edb5470f51ff2ed1b1d72ce56ccf05960261b167c33b6

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe 'TweetStream MultiJson Support' do
  after do
    TweetStream.reset
  end

  it "should default to the MultiJson default's paser" do
    TweetStream::Client.new.json_parser.engine.to_s.should == MultiJson.engine.to_s
  end

  [:json_gem, :yajl, :json_pure].each do |engine|
    describe "#{engine} parsing" do
      before do
        TweetStream.configure do |config|
          config.username = 'test'
          config.password = 'fake'
          config.parser   = engine
        end
        @client = TweetStream::Client.new
        @class_name = "MultiJson::Engines::#{engine.to_s.split('_').map{|s| s.capitalize}.join('')}"
      end

      it 'should set the parser to the appropriate class' do
        @client.json_parser.engine.to_s == @class_name
      end

      it 'should be settable via client.parser=' do
        @client.parser = engine
        @client.json_parser.engine.to_s.should == @class_name
      end
    end
  end

  class FakeParser; end

  it 'should be settable to a class' do
    @client = TweetStream::Client.new
    @client.parser = FakeParser
    @client.json_parser.engine.should == FakeParser
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tweetstream-1.1.0.rc2 spec/tweetstream/parser_spec.rb
tweetstream-1.1.0.rc1 spec/tweetstream/parser_spec.rb