Sha256: dd8cf062a1010f3396416b7982f638daa884c1a3182fe5d11e50b59898ff0482

Contents?: true

Size: 1.8 KB

Versions: 14

Compression:

Stored size: 1.8 KB

Contents

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

module RR
  module Integrations
    describe RSpec2 do
      attr_reader :fixture, :method_name

      describe "#setup_mocks_for_rspec" do
        subject { Object.new }

        before do
          @fixture = Object.new
          fixture.extend RSpec2::Mixin
          @method_name = :foobar
        end

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

          fixture.setup_mocks_for_rspec
          expect(::RR::Injections::DoubleInjection.instances).to be_empty
        end
      end

      describe "#verify_mocks_for_rspec" do
        subject { Object.new }

        before do
          @fixture = Object.new
          fixture.extend RSpec2::Mixin
          @method_name = :foobar
        end

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

          expect {
            fixture.verify_mocks_for_rspec
          }.to raise_error(::RR::Errors::TimesCalledError)
          expect(::RR::Injections::DoubleInjection.instances).to be_empty
        end
      end

      describe "#teardown_mocks_for_rspec" do
        subject { Object.new }

        before do
          @fixture = Object.new
          fixture.extend RSpec2::Mixin
          @method_name = :foobar
        end

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

          fixture.teardown_mocks_for_rspec
          expect(::RR::Injections::DoubleInjection.instances).to be_empty
        end
      end

      describe "#trim_backtrace" do
        it "does not set trim_backtrace" do
          expect(RR.trim_backtrace).to eq false
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rr-3.1.1 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.1.0 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.0.9 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.0.8 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.0.7 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.0.6 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.0.5 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.0.4 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.0.3 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.0.2 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.0.1 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-3.0.0 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-1.2.1 spec/suites/rspec_2/unit/integrations/rspec_spec.rb
rr-1.2.0 spec/suites/rspec_2/unit/integrations/rspec_spec.rb