Sha256: 53d823b11ef2804d59ffefb2d5e4b56269f5cbddc4a035970caa4e774fd6a8f8

Contents?: true

Size: 923 Bytes

Versions: 12

Compression:

Stored size: 923 Bytes

Contents

require 'rest-core/test'

describe RC::Wrapper do
  should 'wrap around simple middleware' do
    wrapper = RC::Bypass.dup
    wrapper.send(:include, RC::Wrapper)
    client = RC::Builder.client do
      use wrapper do
        use RC::Bypass
      end
      run RC::Dry
    end

    client.new.app.call(1=>2){ |res| res.should.eq(1=>2) }
  end

  should 'default app is RestCore::Dry' do
    wrapper = Class.new
    wrapper.send(:include, RC::Wrapper)
    wrapper.new.wrapped.class.should.eq RC::Dry
  end

  should 'switch default_engine to RestCore::RestClient' do
    wrapper = Class.new
    wrapper.send(:include, RC::Wrapper)
    wrapper.default_engine = RC::RestClient
    wrapper.new.wrapped.class.should.eq RC::RestClient
  end

  should 'accept middlewares without a member' do
    Class.new.send(:include, RC::Wrapper).new{
      use Class.new.send(:include, RC::Middleware)
    }.members.should.eq []
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rest-core-3.2.0 test/test_wrapper.rb
rest-core-3.1.1 test/test_wrapper.rb
rest-core-3.1.0 test/test_wrapper.rb
rest-core-3.0.0 test/test_wrapper.rb
rest-core-2.1.2 test/test_wrapper.rb
rest-core-2.1.1 test/test_wrapper.rb
rest-core-2.1.0 test/test_wrapper.rb
rest-core-2.0.4 test/test_wrapper.rb
rest-core-2.0.3 test/test_wrapper.rb
rest-core-2.0.2 test/test_wrapper.rb
rest-core-2.0.1 test/test_wrapper.rb
rest-core-2.0.0 test/test_wrapper.rb