Sha256: 223a0999db1dee6ecef14549199794bb4136dd0b2dbaa4e310caec108a91d34f

Contents?: true

Size: 1 KB

Versions: 21

Compression:

Stored size: 1 KB

Contents

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

module RR
  module Injections
    describe DoubleInjection, "#verify" do
      subject { Object.new }

      include_examples "Swapped Space"

      attr_reader :method_name, :double_injection

      before do
        @method_name = :foobar
        subject.methods.should_not include(method_name.to_s)
        @double_injection = ::RR::Injections::DoubleInjection.find_or_create_by_subject(subject, method_name)
      end

      it "verifies each double was met" do
        double = RR::Double.new(
          double_injection,
          RR::DoubleDefinitions::DoubleDefinition.new(RR::DoubleDefinitions::DoubleDefinitionCreate.new)
        )
        double_injection.register_double double

        double.definition.with(1).once.returns {nil}
        expect { double_injection.verify }.to raise_error(RR::Errors::TimesCalledError)
        subject.foobar(1)
        expect { double_injection.verify }.to_not raise_error
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rr-3.1.1 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.1.0 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.0.9 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.0.8 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.0.7 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.0.6 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.0.5 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.0.4 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.0.3 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.0.2 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.0.1 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-3.0.0 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-1.2.1 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-1.2.0 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-1.1.2 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-1.1.2.rc1 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-1.1.1.rc1 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-1.1.0 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-1.1.0.rc3 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb
rr-1.1.0.rc2 spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb