Sha256: 6cb30c2ce6c4f8c4d995dc025d32d228b7c2c15c77d5615b4b80b603b2ac23d6

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

require "spec/spec_helper"

module RR
  module Adapters
    describe Rspec do
      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_insertions" do
          RR::Space.double_insertion(@subject, @method_name)
          RR::Space.double_insertions.should_not be_empty

          @fixture.setup_mocks_for_rspec
          RR::Space.double_insertions.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_insertions" do
          double_insertion = RR::Space.double_insertion(@subject, @method_name)
          scenario = RR::Space.scenario(double_insertion)

          scenario.once

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rr-0.4.2 spec/rr/rspec/rspec_adapter_spec.rb
rr-0.4.0 spec/rr/rspec/rspec_adapter_spec.rb
rr-0.4.1 spec/rr/rspec/rspec_adapter_spec.rb