Sha256: d168bcc9d03dc3f6dfc3c04acd83f4b09e8158acb1447f8c41497d00986d669e

Contents?: true

Size: 1.02 KB

Versions: 12

Compression:

Stored size: 1.02 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 :space, :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

12 entries across 12 versions & 3 rubygems

Version Path
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rr-1.0.2/spec/rr/double_injection/double_injection_verify_spec.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rr-1.0.2/spec/rr/double_injection/double_injection_verify_spec.rb
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/double_injection/double_injection_verify_spec.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/double_injection/double_injection_verify_spec.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/double_injection/double_injection_verify_spec.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/double_injection/double_injection_verify_spec.rb
vim-jar-0.0.3 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/double_injection/double_injection_verify_spec.rb
vim-jar-0.0.2 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/double_injection/double_injection_verify_spec.rb
vim-jar-0.0.1 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/double_injection/double_injection_verify_spec.rb
rr-1.0.2 spec/rr/double_injection/double_injection_verify_spec.rb
rr-1.0.1 spec/rr/double_injection/double_injection_verify_spec.rb
rr-1.0.0 spec/rr/double_injection/double_injection_verify_spec.rb