Sha256: be6cfb0190c9162068f9f848edc371c204023b77bf75494b9ab9eace13c2becb

Contents?: true

Size: 1.16 KB

Versions: 188

Compression:

Stored size: 1.16 KB

Contents

require "spec_helper"

describe RSpec::Mocks do
  describe "::setup" do
    context "with an existing Mock::Space" do
      before do
        @orig_space = RSpec::Mocks::space
      end

      after do
        RSpec::Mocks::space = @orig_space
      end

      it "memoizes the space" do
        RSpec::Mocks::setup(Object.new)
        space = RSpec::Mocks::space
        RSpec::Mocks::setup(Object.new)
        RSpec::Mocks::space.should equal(space)
      end
    end

    context "with no pre-existing Mock::Space" do
      it "initializes a Mock::Space" do
        RSpec::Mocks::space = nil
        RSpec::Mocks::setup(Object.new)
        RSpec::Mocks::space.should_not be_nil
      end
    end
  end

  describe "::verify" do
    it "delegates to the space" do
      foo = double
      foo.should_receive(:bar)
      expect do
        RSpec::Mocks::verify
      end.to raise_error(RSpec::Mocks::MockExpectationError)
    end
  end

  describe "::teardown" do
    it "delegates to the space" do
      foo = double
      foo.should_receive(:bar)
      RSpec::Mocks::teardown
      expect do
        foo.bar
      end.to raise_error(/received unexpected message/)
    end
  end
end

Version data entries

188 entries across 134 versions & 17 rubygems

Version Path
classiccms-0.3.4 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks_spec.rb
classiccms-0.3.4 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks_spec.rb
classiccms-0.3.3 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks_spec.rb
classiccms-0.3.3 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks_spec.rb
classiccms-0.3.2 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks_spec.rb
classiccms-0.3.2 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks_spec.rb
classiccms-0.3.1 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks_spec.rb
classiccms-0.3.1 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks_spec.rb
classiccms-0.3.0 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks_spec.rb
classiccms-0.3.0 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks_spec.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/spec/rspec/mocks_spec.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/spec/rspec/mocks_spec.rb
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/spec/rspec/mocks_spec.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/spec/rspec/mocks_spec.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.8.0/spec/rspec/mocks_spec.rb
ftl-0.2.0 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks_spec.rb
classiccms-0.2.4.pre vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks_spec.rb
classiccms-0.2.4.pre vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks_spec.rb
rspec-mocks-2.10.1 spec/rspec/mocks_spec.rb
rspec-mocks-2.10.0 spec/rspec/mocks_spec.rb