Sha256: ec9017730ccc874c85d09ca85eea25bf33fcd92d786b2e978d1a8b9e3b118020

Contents?: true

Size: 1.24 KB

Versions: 47

Compression:

Stored size: 1.24 KB

Contents

module Spec
  module Mocks
    module Methods
      def should_receive(sym, opts={}, &block)
        __mock_proxy.add_message_expectation(opts[:expected_from] || caller(1)[0], sym.to_sym, opts, &block)
      end

      def should_not_receive(sym, &block)
        __mock_proxy.add_negative_message_expectation(caller(1)[0], sym.to_sym, &block)
      end
      
      def stub!(sym_or_hash, opts={})
        if Hash === sym_or_hash
          sym_or_hash.each {|method, value| stub!(method).and_return value }
        else
          __mock_proxy.add_stub(caller(1)[0], sym_or_hash.to_sym, opts)
        end
      end
      
      def received_message?(sym, *args, &block) #:nodoc:
        __mock_proxy.received_message?(sym.to_sym, *args, &block)
      end
      
      def rspec_verify #:nodoc:
        __mock_proxy.verify
      end

      def rspec_reset #:nodoc:
        __mock_proxy.reset
      end
      
      def as_null_object
        __mock_proxy.as_null_object
      end
      
      def null_object?
        __mock_proxy.null_object?
      end

    private

      def __mock_proxy
        if Mock === self
          @mock_proxy ||= Proxy.new(self, @name, @options)
        else
          @mock_proxy ||= Proxy.new(self)
        end
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 8 rubygems

Version Path
dchelimsky-rspec-1.1.10 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.11.1 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.11.2 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.11.3 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.11.4 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.11.5 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.11.6 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.11.7 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.11 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.12 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.99.1 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.99.13 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.99.2 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.99.3 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.99.4 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.99.5 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.99.6 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.99.7 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.99.8 lib/spec/mocks/methods.rb
dchelimsky-rspec-1.1.99.9 lib/spec/mocks/methods.rb