First foray into args class refactoring: rect

So far, I really like this approach. It allows us to push validation logic out of the Card class and into its own set of classes that can be more easily tested.

Fixes #75, but we've got a lot more work to do in getting this full scale
This commit is contained in:
Andy Meneely
2015-06-08 13:36:23 -04:00
parent 6c60f21bb0
commit c1e410fe72
8 changed files with 341 additions and 14 deletions
+4 -3
View File
@@ -32,9 +32,10 @@ describe Squib::Card do
expect(cxt).to receive(:restore).once
card = Squib::Card.new(deck, 100, 150)
# rect(x, y, width, height, x_radius, y_radius,
# fill_color, stroke_color, stroke_width)
card.rect(37, 38, 50, 100, 10, 15, '#fff', '#f00', 2.0)
# rect(Args::Box, x_radius, y_radius, Args::Draw)
box = OpenStruct.new(x: 37, y: 38, width: 50, height: 100, x_radius: 10, y_radius: 15)
draw = OpenStruct.new(fill_color: '#fff', stroke_color: '#f00', stroke_width: 2.0)
card.rect(box, draw)
end
end