spec/actors/label_spec.rb in gamebox-0.4.1 vs spec/actors/label_spec.rb in gamebox-0.5.0
- old
+ new
@@ -10,14 +10,17 @@
end
describe "#behavior" do
subjectify_behavior(:label)
+ let(:stylish_font) { stub(calc_width: 22, height: 30) }
+
before do
- @actor.stubs(has_attributes: nil, font_name: "fonty.ttf",
- font_size: 22, color: :red)
+ @actor.stubs(has_attributes: nil, font_name: "fonty.ttf", text: "some text",
+ font_size: 22, color: :red, :width= => nil, :height= => nil)
@font_style_factory.stubs(:build)
+ @actor.stubs(:font_style).returns(stylish_font)
end
it 'sets up attributes on actor' do
@actor.expects(:has_attributes).with(
text: "",
@@ -25,11 +28,17 @@
font_name: "Asimov.ttf",
color: [250,250,250,255],
width: 0,
height: 0,
layer: 1)
- @font_style_factory.stubs(:build).with('fonty.ttf', 22, :red).returns(:stylish_font)
- @actor.expects(:has_attributes).with(font_style: :stylish_font)
+ @font_style_factory.stubs(:build).with('fonty.ttf', 22, :red).returns(stylish_font)
+ @actor.expects(:has_attributes).with(font_style: stylish_font)
+
+ stylish_font.stubs(:calc_width).with("some text").returns(:some_stylish_width)
+ stylish_font.stubs(:height).returns(:some_stylish_height)
+
+ @actor.expects(:width=).with(:some_stylish_width)
+ @actor.expects(:height=).with(:some_stylish_height)
subject
end
it 'listens for text changes' do