Sha256: 60199fb853308c05758b5e86b21c1bf32d4b767ad790ea49e33c599e1c8f1e11
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require "spec_helper" describe Warp::Instrument do let(:klass) { Class.new } let(:method) { :foo } let(:instrument) { Warp::Instrument.for(klass, method) } before do klass.send(:define_method, method) {|*_| return nil } end describe ".for" do subject { instrument } context "with no existing instrument" do specify { expect(subject).to be_a Warp::Instrument } specify { expect(subject).to_not be_enabled } end context "with an existing instrument" do let!(:existing) { subject } specify { expect(subject).to equal existing } end end describe "#run" do specify { expect{|blk| instrument.run(&blk) }.to yield_control } end describe "#calls" do subject { instrument.calls } context "when no calls have been logged" do specify { expect(subject).to eq [] } end context "when a call has been logged" do let(:args) { [{baz: :quz}] } before do instrument.run do klass.new.send(method, *args) end end specify { expect(subject).to eq [args] } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
warp-1.3.0 | spec/warp/instrument_spec.rb |