Sha256: 1b028a5da9c5eedb6a9aa3392384e76ccfc845fdce5497e43a59d41e246c203a
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
require "rails_helper" describe MagicLamp::Callbacks do class DummyObject include MagicLamp::Callbacks end subject { DummyObject.new(MagicLamp::Configuration.new) } context "attr_accessor" do it { is_expected.to respond_to(:configuration) } it { is_expected.to respond_to(:configuration=) } end describe "#initialize" do it "sets configuration to the given argument" do configuration = double subject = DummyObject.new(configuration) expect(subject.configuration).to eq(configuration) end end describe "#execute_before_each_callback" do it "calls the before each callback" do dummy = double expect(dummy).to receive(:call) subject.configuration.before_each_proc = dummy subject.execute_before_each_callback end context "no callback" do it "does not raise an error" do subject.configuration.before_each_proc = nil expect do subject.execute_before_each_callback end.to_not raise_error end end end describe "#execute_after_each_callback" do it "calls the after each callback" do dummy = double expect(dummy).to receive(:call) subject.configuration.after_each_proc = dummy subject.execute_after_each_callback end context "no callback" do it "does not raise an error" do subject.configuration.after_each_proc = nil expect do subject.execute_after_each_callback end.to_not raise_error end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
magic_lamp-1.0.0 | spec/lib/callbacks_spec.rb |