Sha256: b927aaf99dd407f7a94f25af1e88d53b96dc20d9e417ea980863f95c10933390
Contents?: true
Size: 1.78 KB
Versions: 3
Compression:
Stored size: 1.78 KB
Contents
require "examples/example_helper" module RR module Expectations describe TimesCalledExpectation, ' with AtLeastMatcher', :shared => true do it_should_behave_like "RR::Expectations::TimesCalledExpectation" before do @times = 3 @at_least = TimesCalledMatchers::AtLeastMatcher.new(@times) @expectation = TimesCalledExpectation.new(@at_least) end end describe TimesCalledExpectation, "#verify! with AtLeastMatcher" do it_should_behave_like "RR::Expectations::TimesCalledExpectation with AtLeastMatcher" it "passes when times called > times" do 4.times {@expectation.attempt!} @expectation.verify! end it "passes when times called == times" do 3.times {@expectation.attempt!} @expectation.verify! end it "raises error when times called < times" do @expectation.attempt! proc do @expectation.verify! end.should raise_error( RR::Errors::TimesCalledError, "Called 1 time.\nExpected at least 3 times." ) end end describe TimesCalledExpectation, "#attempt? with AtLeastMatcher" do it_should_behave_like "RR::Expectations::TimesCalledExpectation with AtLeastMatcher" it "always returns true" do @expectation.should be_attempt 10.times {@expectation.attempt!} @expectation.should be_attempt end end describe TimesCalledExpectation, "#attempt! with AtLeastMatcher" do it_should_behave_like "RR::Expectations::TimesCalledExpectation with AtLeastMatcher" it "passes when times called more than times" do 4.times {@expectation.attempt!} end it "passes when times called == times" do 3.times {@expectation.attempt!} end it "passes when times called < times" do @expectation.attempt! end end end end
Version data entries
3 entries across 3 versions & 1 rubygems