Sha256: afbf17f89be0a4eda4d45b992b4b45b7f5eb3af127fec857083f2ee1867c4a04
Contents?: true
Size: 1.05 KB
Versions: 2
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
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
casualjim-caricature-0.6.1 | spec/sword_spec.rb |
caricature-0.6.1 | spec/sword_spec.rb |