Skip to content

Instantly share code, notes, and snippets.

@roykolak
Created June 26, 2011 19:38
Show Gist options
  • Save roykolak/1047902 to your computer and use it in GitHub Desktop.
Save roykolak/1047902 to your computer and use it in GitHub Desktop.
require('../lib/sender');
describe('Sender', function() {
var sender, client, number;
beforeEach(function() {
number = '805-769-8255';
client = {sendSms: jasmine.createSpy()};
sender = new Sender(client);
spyOn(sender, 'send').andCallThrough();
});
describe('#send', function() {
it('calls the client with the number and message', function() {
var message = 'hello';
sender.send(number, message);
expect(client.sendSms).toHaveBeenCalledWith(number, message, null, jasmine.any(Function));
});
});
describe('#emptyQueueSms', function() {
it('sends the "empty queue" SMS to the number passed', function() {
sender.emptyQueueSms(number);
expect(sender.send).toHaveBeenCalledWith(number, sender.messages.emptyQueue);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment