Sha256: b03fc21adf46b755b56111767bb69f4092df446f10932315da4c89bb3ba6bd0d

Contents?: true

Size: 1.26 KB

Versions: 9

Compression:

Stored size: 1.26 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.act_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, self.class.name)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec/lib/spec/mocks/methods.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec/lib/spec/mocks/methods.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec/lib/spec/mocks/methods.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec/lib/spec/mocks/methods.rb
pictrails-0.5.0 vendor/plugins/rspec/lib/spec/mocks/methods.rb
rspec-1.1.5 lib/spec/mocks/methods.rb
rspec-1.1.7 lib/spec/mocks/methods.rb
rspec-1.1.6 lib/spec/mocks/methods.rb
rspec-1.1.8 lib/spec/mocks/methods.rb