Sha256: d07f5e436481d650827ee10910bd29197452f89be2f6c61a317cd0ecc6c22acb
Contents?: true
Size: 1.4 KB
Versions: 134
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' require 'rspec/mocks' module RSpec module Mocks describe Space do before :each do @space = RSpec::Mocks::Space.new klazz = Class.new do def rspec_verify @verified = true end def verified? @verified end def rspec_reset @reset = true end def reset? @reset end end @m1 = klazz.new @m2 = klazz.new end it "verifies all mocks within" do @space.add(@m1) @space.add(@m2) @space.verify_all @m1.should be_verified @m2.should be_verified end it "resets all mocks within" do @space.add(m1 = double("mock1")) @space.add(m2 = double("mock2")) m1.should_receive(:rspec_reset) m2.should_receive(:rspec_reset) @space.reset_all end it "clears internal mocks on reset_all" do @space.add(double("mock")) @space.reset_all @space.instance_eval { receivers.empty? }.should be_true end it "resets the ordering" do @space.reset_all @space.expectation_ordering.should be_empty end it "only adds an instance once" do @space.add(m1 = double("mock1")) @space.add(m1) m1.should_receive(:rspec_verify) @space.verify_all end end end end
Version data entries
134 entries across 83 versions & 13 rubygems