Commit 6d0f2af3
Changed files (2)
app
assets
javascripts
utility
spec
javascripts
utility
app/assets/javascripts/utility/greeting.js
@@ -1,9 +1,11 @@
var Greeting = (function(){
var Greeting = function(){
this.greet = function(name) {
- return 'Hi ' + name;
+ return 'hi ' + name;
+ };
+ this.goodbye = function(name){
+ return 'goodbye ' + name;
};
-
};
return function(){
return new Greeting();
spec/javascripts/utility/greeting_spec.js
@@ -0,0 +1,16 @@
+describe ("Greeting", function() {
+ beforeEach (function() {
+ sut = new Greeting();
+ });
+ var sut;
+ describe ("when greeting someone", function() {
+ it ("should say their name", function() {
+ expect(sut.greet('mo')).toEqual('hi mo');
+ });
+ });
+ describe ("when saying goodbye", function() {
+ it ("should say their name", function() {
+ expect(sut.goodbye('joe')).toEqual('goodbye joe');
+ });
+ });
+});