Sha256: 183bc187c9e5ecb7b3e6edb9a78d15fb51348df3bc9bd79a065764f8a008918f

Contents?: true

Size: 972 Bytes

Versions: 1

Compression:

Stored size: 972 Bytes

Contents

require File.dirname(__FILE__) + '/../../test_helper'

module Spec
  module Mocks

    class NullObjectMockTest < Test::Unit::TestCase

      def setup
        @mock = Mock.new("null_object", :null_object=>true)
      end
       
      def test_should_ignore_unexpected_methods
        @mock.random_call("a","d","c")
        @mock.__verify
      end 
    
      def test_should_allow_explicit_expectation
        @mock.should_receive(:something)
        @mock.something
        @mock.__verify
      end
      
      def test_should_fail_verification_when_explicit_exception_not_met
        assert_raises(MockExpectationError) do
          @mock.should_receive(:something)
          @mock.__verify
        end
      end

      def test_should_pass_when_receiving_message_specified_as_not_to_be_received_with_different_args
        @mock.should_not_receive(:message).with("unwanted text")
        @mock.message "other text"
        @mock.__verify
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-0.6.4 test/spec/mocks/null_object_test.rb