Sha256: ebc424a3947a60ca8b379d6e89458dd02860bc64e8b8b7ae8948fbdbbb216621

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

require 'rest-more/test'

describe RC::Facebook do
  after do
    WebMock.reset!
    RR.verify
  end

  should 'be serialized with lighten' do
    engines = begin
                require 'psych'
                YAML::ENGINE.yamler = 'psych' # TODO: probably a bug?
                [Psych, YAML, Marshal]
              rescue LoadError
                [YAML, Marshal]
              end

    # sorry, it is marshal in 1.8 is broken
    if defined?(RUBY_ENGINE)
      if RUBY_ENGINE  == 'ruby' && RUBY_VERSION == '1.8.7'
        engines.pop # REE 1.8.7
      end
    else
      engines.pop # MRI 1.8.7
    end

    engines.each{ |engine|
      test = lambda{ |obj| engine.load(engine.dump(obj)) }
        rg = RC::Facebook.new(:log_handler => lambda{})
      lambda{ test[rg] }.should.raise(TypeError)
      test[rg.lighten].should.eq rg.lighten
      lambda{ test[rg] }.should.raise(TypeError)
      rg.lighten!
      test[rg.lighten].should.eq rg
    }
  end

  should 'lighten takes options to change attributes' do
    RC::Facebook.new.lighten(:timeout => 100    ).timeout.should.eq 100
    RC::Facebook.new.lighten(:lang    => 'zh-TW').lang.should.eq 'zh-TW'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rest-more-1.0.2 test/facebook/test_serialize.rb
rest-more-1.0.1 test/facebook/test_serialize.rb
rest-more-1.0.0 test/facebook/test_serialize.rb
rest-more-0.8.0 test/client/facebook/test_serialize.rb
rest-more-0.7.2.1 test/client/facebook/test_serialize.rb
rest-more-0.7.2 test/client/facebook/test_serialize.rb