Sha256: df483ff8bf13a1ff3c8442874f42ccee64f1278278a80f88a2f79e72958e7164
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
require File.dirname(__FILE__) + "/../bacon_helper.rb" class ClrModels::Sword def to_s "<ClrModels::Sword object_id: #{object_id} >" end alias_method :inspect, :to_s end describe "ClrModels::Sword" do before do @warrior = Caricature::Isolation.for ClrModels::IWarrior end it "should call survive_attack on the mock" do @warrior.when_receiving(:survive_attack_with).return(5) sword = ClrModels::Sword.new sword.attack(@warrior).should.equal 5 @warrior.did_receive?(:survive_attack_with).should.be.successful end it "should return different results when expectation is defined with arguments" do sword1 = ClrModels::Sword.new sword2 = ClrModels::Sword.new @warrior.when_receiving(:survive_attack_with).with(:any).return(5) @warrior.when_receiving(:survive_attack_with).with(sword2).return(15) sword1.attack(@warrior).should.equal 5 sword2.attack(@warrior).should.equal 15 @warrior.did_receive?(:survive_attack_with).with(sword2).should.be.successful end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
caricature-0.7.1 | spec/unit/sword_spec.rb |
caricature-0.7.0 | spec/unit/sword_spec.rb |
caricature-0.6.3 | spec/unit/sword_spec.rb |