Sha256: ba363ef27fbf8e174ee618283fde4ee8645e731674113708520a26d36fecaf27
Contents?: true
Size: 1.49 KB
Versions: 30
Compression:
Stored size: 1.49 KB
Contents
require File.join(File.dirname(__FILE__), '/../../spec_helper') describe Shot do before(:each) do @shot = Class.new do include Shot end.new end it "should define an attr_reader :velocity" do lambda { @shot.velocity }.should_not raise_error end it "should define an attr_writer :velocity" do lambda { @shot.velocity = :some_value }.should_not raise_error end it "should define an attr_reader :originator" do lambda { @shot.originator }.should_not raise_error end it "should define an attr_writer :originator" do lambda { @shot.originator = :some_value }.should_not raise_error end describe "shoot_from" do before(:each) do @window = stub :window, :null_object => true @shot.stub :position= => nil @shot.stub :window => @window @shooter = stub :shooter, :muzzle_position => :some_muzzle_position end it "should return itself" do @shot.shoot_from(@shooter).should == @shot end it "should set its position to the muzzle position of the shooter" do @shot.should_receive(:position=).once.with :some_muzzle_position @shot.shoot_from @shooter end it "should set its originator to the shooter" do @shot.should_receive(:originator=).once.with @shooter @shot.shoot_from @shooter end it "should register itself with the window" do # TODO Or should it? @window.should_receive(:register).once.with @shot @shot.shoot_from @shooter end end end
Version data entries
30 entries across 30 versions & 1 rubygems