Sha256: b126338688c0f441a49ed574aebb877c51ac663c538c18409799edb96e20b940
Contents?: true
Size: 1.09 KB
Versions: 7
Compression:
Stored size: 1.09 KB
Contents
require 'spec_helper' describe "AnyNumberOfTimes" do before(:each) do @mock = RSpec::Mocks::Double.new("test mock") allow(RSpec).to receive(:deprecate) end it "is deprecated" do expect(RSpec).to receive(:deprecate).with("any_number_of_times", :replacement => "stub") expect(@mock).to receive(:random_call).any_number_of_times end it "passes 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 "passes if any number of times method is called once" do @mock.should_receive(:random_call).any_number_of_times @mock.random_call end it "passes if any number of times method is not called" do @mock.should_receive(:random_call).any_number_of_times end it "returns 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) expect(@mock.message).to eq :mock_value expect(@mock.message).to eq :mock_value end end
Version data entries
7 entries across 7 versions & 1 rubygems