Sha256: 51bba29d4447b33b7cd53c346a4de1b9e40834a508403001fee5b958e473b679

Contents?: true

Size: 1.35 KB

Versions: 12

Compression:

Stored size: 1.35 KB

Contents

require "examples/example_helper"

module RR
module Adapters
  describe Rspec, "#setup_mocks_for_rspec" do
    before do
      @fixture = Object.new
      @fixture.extend Rspec

      @subject = Object.new
      @method_name = :foobar
    end

    it "resets the doubles" do
      RR::Space.double(@subject, @method_name)
      RR::Space.doubles.should_not be_empty

      @fixture.setup_mocks_for_rspec
      RR::Space.doubles.should be_empty
    end
  end

  describe Rspec, "#verify_mocks_for_rspec" do
    before do
      @fixture = Object.new
      @fixture.extend Rspec

      @subject = Object.new
      @method_name = :foobar
    end

    it "verifies the doubles" do
      double = RR::Space.double(@subject, @method_name)
      scenario = RR::Space.scenario(double)

      scenario.once

      proc do
        @fixture.verify_mocks_for_rspec
      end.should raise_error(::RR::Errors::TimesCalledError)
      RR::Space.doubles.should be_empty
    end
  end

  describe Rspec, "#teardown_mocks_for_rspec" do
    before do
      @fixture = Object.new
      @fixture.extend Rspec

      @subject = Object.new
      @method_name = :foobar
    end

    it "resets the doubles" do
      RR::Space.double(@subject, @method_name)
      RR::Space.doubles.should_not be_empty

      @fixture.teardown_mocks_for_rspec
      RR::Space.doubles.should be_empty
    end
  end
end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rr-0.3.4 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.1 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.3 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.10 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.0 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.2 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.11 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.8 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.9 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.7 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.5 examples/rr/rspec/rspec_adapter_example.rb
rr-0.3.6 examples/rr/rspec/rspec_adapter_example.rb