Sha256: a6db6b6b21050b79ca575c48248a079157dbe0b2bead6634a8b1bd822cb39767

Contents?: true

Size: 1.45 KB

Versions: 14

Compression:

Stored size: 1.45 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.instance.create_double(@subject, @method_name)
      RR::Space.instance.doubles.should_not be_empty

      @fixture.setup_mocks_for_rspec
      RR::Space.instance.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.instance.create_double(@subject, @method_name)
      scenario = RR::Space.instance.create_scenario(double)

      scenario.once

      proc do
        @fixture.verify_mocks_for_rspec
      end.should raise_error(::RR::Errors::TimesCalledError)
      RR::Space.instance.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.instance.create_double(@subject, @method_name)
      RR::Space.instance.doubles.should_not be_empty

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rr-0.1.10 examples/rr/rspec/rspec_adapter_example.rb
rr-0.1.15 examples/rr/rspec/rspec_adapter_example.rb
rr-0.1.14 examples/rr/rspec/rspec_adapter_example.rb
rr-0.1.7 examples/rr/rspec/rspec_adapter_example.rb
rr-0.1.8 examples/rr/rspec/rspec_adapter_example.rb
rr-0.1.12 examples/rr/rspec/rspec_adapter_example.rb
rr-0.1.11 examples/rr/rspec/rspec_adapter_example.rb
rr-0.1.13 examples/rr/rspec/rspec_adapter_example.rb
rr-0.1.9 examples/rr/rspec/rspec_adapter_example.rb
rr-0.2.2 examples/rr/rspec/rspec_adapter_example.rb
rr-0.2.3 examples/rr/rspec/rspec_adapter_example.rb
rr-0.2.1 examples/rr/rspec/rspec_adapter_example.rb
rr-0.2.4 examples/rr/rspec/rspec_adapter_example.rb
rr-0.2.5 examples/rr/rspec/rspec_adapter_example.rb