Sha256: 82ff41775e3c8233e5dff968af54c11241cfd32c328de0b20ce6a616196d852c

Contents?: true

Size: 1.01 KB

Versions: 10

Compression:

Stored size: 1.01 KB

Contents

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

module RR
  module Injections
    describe DoubleInjection, "#verify" do
      it_should_behave_like "Swapped Space"
      attr_reader :subject, :method_name, :double_injection
      before do
        @subject = Object.new
        @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}
        lambda {double_injection.verify}.should raise_error(RR::Errors::TimesCalledError)
        subject.foobar(1)
        lambda {double_injection.verify}.should_not raise_error
      end
    end
  end
end

Version data entries

10 entries across 6 versions & 3 rubygems

Version Path
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.3/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/double_injection/double_injection_verify_spec.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/double_injection/double_injection_verify_spec.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.3/vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/double_injection/double_injection_verify_spec.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/double_injection/double_injection_verify_spec.rb
bitclust-core-0.5.2 vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/double_injection/double_injection_verify_spec.rb
bitclust-core-0.5.2 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/double_injection/double_injection_verify_spec.rb
bitclust-core-0.5.1 vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/double_injection/double_injection_verify_spec.rb
mcmire-rr-1.0.5.rc1 spec/rr/double_injection/double_injection_verify_spec.rb
rr-1.0.4 spec/rr/double_injection/double_injection_verify_spec.rb
rr-1.0.3 spec/rr/double_injection/double_injection_verify_spec.rb