Sha256: ac582bb402f01b3f4bd7bbd6ddbcf3c2498915969c13bd4ca532f04a445ae776

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

require 'rest-core/test'

describe RC::Builder do
  would 'default client app is a kind of RestCore::Engine' do
    RC::Builder.client.new.app.should.kind_of? RC::Engine
  end

  would 'default        app is a kind of RestCore::Engine' do
    RC::Builder.new.to_app.should.kind_of? RC::Engine
  end

  would 'switch default_engine to RestCore::Dry a' do
    builder = Class.new(RC::Builder)
    builder.default_engine = RC::Dry
    builder.new.to_app.class.should.eq RC::Dry
  end

  would 'switch default_engine to RestCore::Dry b' do
    builder = RC::Builder.dup
    builder.default_engine = RC::Dry
    builder.client.new.app.class.should.eq RC::Dry
  end

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

  would 'not have duplicated fields' do
    middleware = Class.new do
      def self.members; [:value]; end
      include RC::Middleware
    end
    client = RC::Builder.client(:value){ use middleware }.new
    client.value = 10
    client.value.should.eq 10
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rest-core-3.5.4 test/test_builder.rb
rest-core-3.5.3 test/test_builder.rb
rest-core-3.5.2 test/test_builder.rb
rest-core-3.5.1 test/test_builder.rb
rest-core-3.5.0 test/test_builder.rb
rest-core-3.4.1 test/test_builder.rb
rest-core-3.4.0 test/test_builder.rb