Skip to content

Commit 91c6397

Browse files
committed
Merge branch 'development' of github.com:coldbox-modules/cbmailservices into development
2 parents 7d6d8db + 7956eac commit 91c6397

File tree

4 files changed

+30
-31
lines changed

4 files changed

+30
-31
lines changed

models/Mail.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ component accessors="true" {
199199
* Run email validation and throw an InvalidMailException if required params are missing.
200200
*/
201201
Mail function validateOrFail(){
202-
if ( NOT this.validate() ){
202+
if ( NOT this.validate() ) {
203203
throw(
204204
type : "InvalidMailException",
205205
message: "One or more required fields are missing.",

models/protocols/MailgunProtocol.cfc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ component
4545
// Check for Base URL property
4646
if ( !propertyExists( "baseURL" ) ) {
4747
// No baseURL key was found, so use the US default.
48-
variables.MAILGUN_APIURL = "https://api.mailgun.net/v3/";
48+
variables.MAILGUN_APIURL = "https://api.mailgun.net/v3/";
4949
} else {
5050
variables.MAILGUN_APIURL = getProperty( "baseURL" );
5151
}
@@ -67,9 +67,9 @@ component
6767
* @return struct of { "error" : boolean, "messages" : [], "messageID" : "" }
6868
*/
6969
struct function send( required cbmailservices.models.Mail payload ){
70-
var results = { "error" : true, "messages" : [], "messageID" : "" };
70+
var results = { "error" : true, "messages" : [], "messageID" : "" };
7171
// The mail config data
72-
var data = arguments.payload.getConfig();
72+
var data = arguments.payload.getConfig();
7373
var headerKeys = [ "v:", "o:", "h:" ];
7474

7575
// Special attribute for Reply To
@@ -195,10 +195,12 @@ component
195195
}
196196

197197
// Inflate HTTP Results
198-
if( isJSON( httpResults.fileContent.toString() ) ) {
198+
if ( isJSON( httpResults.fileContent.toString() ) ) {
199199
var mailgunResults = deserializeJSON( httpResults.fileContent.toString() );
200200
} else {
201-
results.messages = [ 'Error sending mail. Mailgun returned "#httpResults.fileContent.toString()#".' ];
201+
results.messages = [
202+
"Error sending mail. Mailgun returned ""#httpResults.fileContent.toString()#""."
203+
];
202204

203205
return results;
204206
}
@@ -213,10 +215,7 @@ component
213215
}
214216
// Exceptions
215217
else {
216-
results.messages = [
217-
mailgunResults[ "Message" ],
218-
mailgunResults
219-
];
218+
results.messages = [ mailgunResults[ "Message" ], mailgunResults ];
220219
}
221220
} catch ( any e ) {
222221
results.messages = [ "Error sending mail. #e.message# : #e.detail# : #e.stackTrace#" ];

test-harness/tests/specs/MailTest.cfc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,28 @@
6161
expect( mail.validate() ).toBeTrue();
6262
} );
6363

64-
it( "validateOrFail will throw for invalid mail", function() {
65-
66-
expect(function() {
64+
it( "validateOrFail will throw for invalid mail", function(){
65+
expect( function(){
6766
mail.configure(
68-
69-
70-
// OMIT subject... "Oops! DID I DO THAT???"
71-
)
72-
.validateOrFail()
73-
}).toThrow( "InvalidMailException" );
74-
});
67+
68+
69+
// OMIT subject... "Oops! DID I DO THAT???"
70+
)
71+
.validateOrFail()
72+
} ).toThrow( "InvalidMailException" );
73+
} );
7574

76-
it( "validateOrFail won't throw for valid emails", function() {
77-
expect( function() {
75+
it( "validateOrFail won't throw for valid emails", function(){
76+
expect( function(){
7877
mail.configure(
79-
subject = "Hello",
80-
81-
82-
body = "Hello"
83-
).validateOrFail();
84-
}).notToThrow( "InvalidMailException" );
85-
});
78+
subject = "Hello",
79+
80+
81+
body = "Hello"
82+
)
83+
.validateOrFail();
84+
} ).notToThrow( "InvalidMailException" );
85+
} );
8686

8787
it( "can set html types", function(){
8888
mail.configure(

test-harness/tests/specs/protocols/MailgunProtocolTest.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ component extends="coldbox.system.testing.BaseTestCase" {
3131
beforeEach( function( currentSpec ){
3232
// Create a mock instance of the protocol.
3333
variables.protocol = createMock( "cbmailservices.models.protocols.MailgunProtocol" ).init( {
34-
apiKey : variables.apikey,
35-
domain : variables.domain,
34+
apiKey : variables.apikey,
35+
domain : variables.domain,
3636
baseURL : variables.baseURL
3737
} );
3838
} );

0 commit comments

Comments
 (0)