speccing props and players

3 views
Skip to first unread message

doug livesey

unread,
Nov 10, 2009, 8:00:56 AM11/10/09
to limelig...@googlegroups.com
Hi -- sorry to be spamming the list!
Could someone point me to any resources on how to spec more than just scenes? Like props & players?
Or if there's any examples people don't mind me browsing through in apps on github, or anything?
Cheers,
   Doug.

Micah Martin

unread,
Nov 10, 2009, 9:55:50 AM11/10/09
to limelig...@googlegroups.com
Doug,

Please look at the Limelight::Specs::SpecHelper Rdoc. It documents
the options for the uses_limelight spec mixin.

The key is that everything, props, players, styles, and scenes alike
are all tested in the context of a scene. The uses_limelight mixin
makes it trivial to create a scene as simple or as complicated as
needed to test whatever you want.

Micah

emeyer

unread,
Nov 10, 2009, 10:42:40 AM11/10/09
to limelight
To expand on what is said in the RDoc and provide additional examples:

There is also a uses_player option to be used with scene_path. For
example:
uses_limelight :scene_path => "my_scene", :with_player =>
"some_player"

This gives you a scene with one prop of id, player and name of
"some_player." It will also load up all the players in "my_scene."
The last thing it creates for you is a helper method to find the prop
on the scene.

describe "SomePlayer" do
uses_limelight :scene_path => "my_scene", :with_player =>
"some_player"

it "should exist" do
some_player.should_not be_nil
end
end

This is useful if I'm testing a player that doesn't interact with
other players on the scene. If I need to interact with other players
on the scene, I'd probably be likely to use scene_path passing it a
block of props (using the same syntax as in the props.rb files).

describe "SomePlayer" do
uses_limelight :scene_path => "my_scene" do
foo :id => "foo"
bar :id => "bar"
end

it "should exist" do
scene.children.size.should == 2
scene.find("foo").should_not be_nil
scene.find("bar").should_not be_nil
end
end

With both of these ways of testing the player, the contents of the
props.rb file will be ignored.

Eric
Reply all
Reply to author
Forward
0 new messages