Sha256: 873c88f86cd71b124ee50888b31e0a34f111fd9aa16741a0209b2a62bba03f3e

Contents?: true

Size: 774 Bytes

Versions: 18

Compression:

Stored size: 774 Bytes

Contents

require 'spec_helper'

class TestMiddleware < Acfs::Middleware::Base
end

describe Acfs::Service::Middleware do
  let(:srv_class) { Class.new(Acfs::Service) }
  let(:options) { {} }
  let(:middleware) { TestMiddleware }

  describe '.use' do
    let(:options) { {abc: 'cde'} }

    it 'should add middleware to list' do
      srv_class.use middleware

      expect(srv_class.middleware).to include(middleware)
    end

    it 'should add middleware to stack' do
      srv_class.use middleware

      expect(srv_class.middleware.build(1)).to be_a(middleware)
    end

    it 'should instantiate middleware object' do
      expect(middleware).to receive(:new).with(anything, options)

      srv_class.use middleware, options
      srv_class.middleware.build
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
acfs-1.3.2 spec/acfs/service/middleware_spec.rb
acfs-1.3.1 spec/acfs/service/middleware_spec.rb
acfs-1.3.0 spec/acfs/service/middleware_spec.rb
acfs-1.2.1 spec/acfs/service/middleware_spec.rb
acfs-0.50.0 spec/acfs/service/middleware_spec.rb
acfs-1.2.0 spec/acfs/service/middleware_spec.rb
acfs-0.49.1 spec/acfs/service/middleware_spec.rb
acfs-1.1.1 spec/acfs/service/middleware_spec.rb
acfs-0.49.0 spec/acfs/service/middleware_spec.rb
acfs-1.1.0 spec/acfs/service/middleware_spec.rb
acfs-0.48.2 spec/acfs/service/middleware_spec.rb
acfs-1.0.1 spec/acfs/service/middleware_spec.rb
acfs-0.48.1 spec/acfs/service/middleware_spec.rb
acfs-1.0.0 spec/acfs/service/middleware_spec.rb
acfs-0.48.0 spec/acfs/service/middleware_spec.rb
acfs-0.47.0 spec/acfs/service/middleware_spec.rb
acfs-0.46.0 spec/acfs/service/middleware_spec.rb
acfs-0.45.0 spec/acfs/service/middleware_spec.rb