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

Version Path
classiccms-0.7.5 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.5 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.4 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.4 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.3 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.3 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks/mock_space_spec.rb
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/spec/rspec/mocks/mock_space_spec.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.2 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.2 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.1 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.1 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.0 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.7.0 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks/mock_space_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.6.9 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/mock_space_spec.rb
classiccms-0.6.9 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks/mock_space_spec.rb
rspec-mocks-2.12.1 spec/rspec/mocks/mock_space_spec.rb
rspec-mocks-2.12.0 spec/rspec/mocks/mock_space_spec.rb
classiccms-0.6.8 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks/mock_space_spec.rb