Sha256: 6928201ea9623c05afd7e7a6c7c56d5d4631e5b5954cf4d40bd9cfdf8320aaf5
Contents?: true
Size: 1.1 KB
Versions: 62
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' require 'singleton' module Startback module Support describe Hooks, "before_xxx" do class BeforeHooked include Hooks.new(:xxx) def initialize super @before_called = false end attr_accessor :before_called before_xxx do self.before_called = true end end class SubBeforeHooked < BeforeHooked def initialize super @subbefore_called = false end attr_accessor :subbefore_called before_xxx do self.subbefore_called = true end end it 'works as expected' do h = BeforeHooked.new expect(h.before_called).to eql(false) h.before_xxx expect(h.before_called).to eql(true) end it 'works as expected on subclass' do h = SubBeforeHooked.new expect(h.before_called).to eql(false) expect(h.subbefore_called).to eql(false) h.before_xxx expect(h.before_called).to eql(true) expect(h.subbefore_called).to eql(true) end end end end
Version data entries
62 entries across 62 versions & 3 rubygems