Sha256: 1fe24453c031c18e747820236edd8b7fdf18af261de34c752356a444b925bd61
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require 'setup' spec :Middleware do buff = [] ware = Class.new { def initialize(*); yield end def call(*); [200, {}, []] end } before { buff.clear } it 'inherits middleware from superclass' do a = mock_controller { use(ware) {buff << :x} use(ware) {buff << :y} } b = mock_controller(a) { def get; end } app mock_app(b) get assert(buff) == [:y, :x] end it 'complements middleware inherited from superclass' do a = mock_controller { use(ware) {buff << 1} use(ware) {buff << 2} } b = mock_controller { use(ware) { buff << 3 } import :middleware, from: a def get; end } app mock_app(b) get assert(buff) == [3, 2, 1] end it 'uses `inherit` to complement middleware inherited from superclass' do a = mock_controller { use(ware) {buff << :x} use(ware) {buff << :y} } b = mock_controller(a) { use(ware) {buff << :z} def get; end } c = mock_controller(a) { import :middleware, from: b def get; end } app mock_app(c) get assert(buff) == [:y, :x, :z] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rocketio-0.1.0 | test/middleware_test.rb |