Sha256: 930982cc2feeeb9b75ac8cb61fe858e75305840bfcf90ef86320d9459b8f99c2
Contents?: true
Size: 1.02 KB
Versions: 11
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' module RSpec module Mocks describe "AnyNumberOfTimes" do before(:each) do @mock = RSpec::Mocks::Mock.new("test mock") end it "should pass if any number of times method is called many times" do @mock.should_receive(:random_call).any_number_of_times (1..10).each do @mock.random_call end end it "should pass if any number of times method is called once" do @mock.should_receive(:random_call).any_number_of_times @mock.random_call end it "should pass if any number of times method is not called" do @mock.should_receive(:random_call).any_number_of_times end it "should return the mocked value when called after a similar stub" do @mock.stub(:message).and_return :stub_value @mock.should_receive(:message).any_number_of_times.and_return(:mock_value) @mock.message.should == :mock_value @mock.message.should == :mock_value end end end end
Version data entries
11 entries across 11 versions & 1 rubygems