Created
December 17, 2011 20:00
-
-
Save eknuth/1491206 to your computer and use it in GitHub Desktop.
set up the environment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install node | |
brew install node | |
# install redis | |
brew install redis | |
# install npm | |
curl http://npmjs.org/install.sh | sh | |
# install mocha and should for testing | |
npm install mocha should -g | |
# install node-redis to talk with redis | |
npm install redis | |
# create the first test | |
mkdir test | |
touch test/test_redis.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var redis = require("redis"), | |
should = require('should'), | |
client = redis.createClient(); | |
describe('strings in redis', function() { | |
var keyToSet = 'bingo', | |
valueToSet = 'the dog'; | |
describe('#set()', function() { | |
it('should save without error', function(done) { | |
client.set(keyToSet, valueToSet, done); | |
}); | |
}); | |
describe('#get()', function() { | |
it('should be able to get the value we set', function(done) { | |
client.get(keyToSet, function(err, data) { | |
should.not.exist(err); | |
data.should.equal(valueToSet); | |
done(); | |
}); | |
}); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment