Sha256: 4f2933ba1b55eb0a57de6510acd384ca43020774ff06a2c5060915b50bf69124

Contents?: true

Size: 1.32 KB

Versions: 109

Compression:

Stored size: 1.32 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper.rb'
require 'spec/mocks'

module Spec
  module Mocks
    describe Space do
      before :each do
        @space = 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 "should verify all mocks within" do
        @space.add(@m1)
        @space.add(@m2)
        @space.verify_all
        @m1.should be_verified
        @m2.should be_verified
      end
      it "should reset all mocks within" do
        @space.add(m1 = mock("mock1"))
        @space.add(m2 = mock("mock2"))
        m1.should_receive(:rspec_reset)
        m2.should_receive(:rspec_reset)
        @space.reset_all
      end
      it "should clear internal mocks on reset_all" do
        @space.add(m = mock("mock"))
        @space.reset_all
        @space.instance_eval { mocks.empty? }.should be_true
      end
      it "should only add an instance once" do
        @space.add(m1 = mock("mock1"))
        @space.add(m1)
        m1.should_receive(:rspec_verify)
        @space.verify_all
      end
    end
  end
end
    

Version data entries

109 entries across 109 versions & 14 rubygems

Version Path
dchelimsky-rspec-1.1.10 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.11.1 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.11.2 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.11.3 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.11.4 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.11.5 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.11.6 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.11.7 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.11 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.12 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.99.1 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.99.13 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.99.2 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.99.3 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.99.4 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.99.5 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.99.6 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.99.7 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.99.8 spec/spec/mocks/mock_space_spec.rb
dchelimsky-rspec-1.1.99.9 spec/spec/mocks/mock_space_spec.rb