Sha256: 7ee88268990aece4c7038e216c5f290818da29247d79691a4201f186bc61dea1

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")

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

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

        it "resets the double_injections" do
          stub(subject).foobar
          Injections::DoubleInjection.instances.should_not be_empty

          fixture.setup_mocks_for_rspec
          Injections::DoubleInjection.instances.should be_empty
        end
      end

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

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

        it "verifies the double_injections" do
          mock(subject).foobar

          lambda do
            fixture.verify_mocks_for_rspec
          end.should raise_error(::RR::Errors::TimesCalledError)
          Injections::DoubleInjection.instances.should be_empty
        end
      end

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

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

        it "resets the double_injections" do
          stub(subject).foobar
          Injections::DoubleInjection.instances.should_not be_empty

          fixture.teardown_mocks_for_rspec
          Injections::DoubleInjection.instances.should be_empty
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rr-0.10.11 spec/rr/rspec/rspec_adapter_spec.rb