@@ 22-28 (lines=7) @@ | ||
19 | $this->shouldHaveType(\MeadSteve\DiceApi\Renderer\Html::class); |
|
20 | } |
|
21 | ||
22 | function it_returns_image_html_for_a_single_d6(Dice $dice) |
|
23 | { |
|
24 | $dice->roll()->willReturn(2); |
|
25 | $dice->name()->willReturn("d6"); |
|
26 | ||
27 | $this->renderDice([$dice])->shouldReturn('<img src="URL/images/poorly-drawn/d6/2.png" />'); |
|
28 | } |
|
29 | ||
30 | function it_returns_image_html_for_a_single_d20(Dice $dice) |
|
31 | { |
|
@@ 30-36 (lines=7) @@ | ||
27 | $this->renderDice([$dice])->shouldReturn('<img src="URL/images/poorly-drawn/d6/2.png" />'); |
|
28 | } |
|
29 | ||
30 | function it_returns_image_html_for_a_single_d20(Dice $dice) |
|
31 | { |
|
32 | $dice->roll()->willReturn(14); |
|
33 | $dice->name()->willReturn("d20"); |
|
34 | ||
35 | $this->renderDice([$dice])->shouldReturn('<img src="URL/images/poorly-drawn/d20/14.png" />'); |
|
36 | } |
|
37 | ||
38 | function it_returns_many_images_for_many_d6(Dice $diceOne, Dice $diceTwo) |
|
39 | { |
@@ 16-23 (lines=8) @@ | ||
13 | $this->shouldHaveType(\MeadSteve\DiceApi\Renderer\Json::class); |
|
14 | } |
|
15 | ||
16 | function it_uses_the_json_encode_function_of_the_dice(Dice $dice) |
|
17 | { |
|
18 | $dice->roll()->willReturn(5); |
|
19 | $dice->name()->willReturn("d6"); |
|
20 | ||
21 | $expectedJson = '{"success":true,"dice":[{"value":5,"type":"d6"}]}'; |
|
22 | $this->renderDice([$dice])->shouldReturn($expectedJson); |
|
23 | } |
|
24 | } |
|
25 |