Sha256: 7d50161e54573765ac1e2bdf9a591b4950e0ac5c7037ff0fcec53f05cc4a3716

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

require 'rest-core/test'

describe RestCore::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 = RestCore::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
    RestCore::Facebook.new.lighten(:timeout => 100    ).timeout.should.eq 100
    RestCore::Facebook.new.lighten(:lang    => 'zh-TW').lang.should.eq 'zh-TW'
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
rest-more-0.7.0 test/client/facebook/test_serialize.rb
rest-core-0.4.0 test/client/facebook/test_serialize.rb
rest-core-0.4.0.pre.2 test/client/facebook/test_serialize.rb
rest-core-0.4.0.pre.1 test/client/facebook/test_serialize.rb
rest-core-0.4.0.pre.0 test/client/facebook/test_serialize.rb
rest-core-0.3.0 test/client/facebook/test_serialize.rb