Skip to content

Commit

Permalink
Merge pull request #8 from gios-asu/idmontie-new-test
Browse files Browse the repository at this point in the history
Add a test to verify that the factory will build
  • Loading branch information
idmontie committed Nov 2, 2015
2 parents 73c7be0 + 709fb4d commit 334a234
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/factories/email-handlebars-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ public function build() {
$this->emogrifier_service->setHtml( $rendered_template );
$this->emogrifier_service->setCss( $this->css );

$html = $this->emogrifier_service->emogrify();
// Return an empty string if we are going to call $emogrify with
// an empty string.
if ( empty( $rendered_template ) ) {
$html = '';
} else {
$html = $this->emogrifier_service->emogrify();
}

return $html;
}
Expand Down
4 changes: 4 additions & 0 deletions test/spec/Waggle/Factories/EmailHandlebarsFactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ function it_will_use_injected_dependencies( Scss $scssc, Handlebars $handlebars,
$this->build()->shouldEqual( 'emorgified' );
}

function it_will_build() {
$this->build()->shouldEqual( '' );
}

function it_can_render_data() {
$template = '<p>{{name}}</p>';
$data = array( 'name' => 'Steve' );
Expand Down

0 comments on commit 334a234

Please sign in to comment.