Sha256: ff0be84f0959b0857f773836056d46eed1a74ef858e6f46ae438d2cacc542bb9
Contents?: true
Size: 1.08 KB
Versions: 62
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' require 'singleton' module Startback module Support describe Hooks, "after_xxx" do class AfterHooked include Hooks.new(:xxx) def initialize super @after_called = false end attr_accessor :after_called after_xxx do self.after_called = true end end class SubAfterHooked < AfterHooked def initialize super @subafter_called = false end attr_accessor :subafter_called after_xxx do self.subafter_called = true end end it 'works as expected' do h = AfterHooked.new expect(h.after_called).to eql(false) h.after_xxx expect(h.after_called).to eql(true) end it 'works as expected on subclass' do h = SubAfterHooked.new expect(h.after_called).to eql(false) expect(h.subafter_called).to eql(false) h.after_xxx expect(h.after_called).to eql(true) expect(h.subafter_called).to eql(true) end end end end
Version data entries
62 entries across 62 versions & 3 rubygems