Sha256: c5aafa0439bd167f4ad6f42dc16ffc44f1f368618a59c7535747b06e633d3705
Contents?: true
Size: 1.26 KB
Versions: 13
Compression:
Stored size: 1.26 KB
Contents
require 'helper' describe ActorFactory do inject_mocks :input_manager, :wrapped_screen, :this_object_context, :resource_manager, :behavior_factory, :actor_view_factory before do @opts = {:foo => :bar} @merged_opts = @opts.merge(actor_type: :some_actor) end describe "#build" do # Actor.definitions.clear # ActorView.definitions.clear Actor.define :some_actor ActorView.define :some_actor_view let(:actor) { create_actor } let(:actor_view) { create_actor_view :actor_view, {}, false } before do @actor = actor @subcontext = stub('subcontext') @subcontext.stubs(:[]).with(:actor).returns(actor) @this_object_context.stubs(:in_subcontext).yields(@subcontext) @actor_view_factory.stubs(:build) end it 'configures the actor correctly' do subject.build(:some_actor, @opts).should == actor actor.foo.should == :bar actor.actor_type.should == :some_actor end it 'creates the associated view class' do @actor_view_factory.expects(:build).with(actor, @opts) subject.build(:some_actor, @opts).should == actor end it "raises on actor not found" do lambda{ subject.build :no_actor, @opts }.should raise_error(/no_actor not found/) end end end
Version data entries
13 entries across 13 versions & 1 rubygems