Skip to content

Commit

Permalink
Add test cases for settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed Apr 22, 2013
1 parent e3acf64 commit 3cdd034
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ describe('Kerouac', function() {
describe('newly initialized site', function() {
var site = kerouac();

it('should have default settings', function() {
expect(site.get('layout engine')).to.equal('ejs');
expect(site.get('layouts')).to.equal(process.cwd() + '/layouts');
expect(site.get('output')).to.equal(process.cwd() + '/output');
});

it('should parse YAML front matter', function() {
var yaml = "layout: 'yaml'\n"
+ "title: 'Hello YAML'\n";
Expand Down Expand Up @@ -45,6 +51,37 @@ describe('Kerouac', function() {
});
});

describe('settings', function() {

var site = kerouac();

it('should get and set settings', function() {
site.set('foo', 'bar');
expect(site.get('foo')).to.equal('bar');
});

it('should translate "view engine" to "layout engine"', function() {
site.set('view engine', 'foo');
expect(site.get('view engine')).to.equal('foo');
expect(site.get('layout engine')).to.equal('foo');
});

it('should enable flags', function() {
site.enable('baz');
expect(site.get('baz')).to.be.true;
expect(site.enabled('baz')).to.be.true;
expect(site.disabled('baz')).to.be.false;
});

it('should disable flags', function() {
site.disable('baz');
expect(site.get('baz')).to.be.false;
expect(site.enabled('baz')).to.be.false;
expect(site.disabled('baz')).to.be.true;
});

});

describe('engine registration', function() {

describe('using a function', function() {
Expand Down

0 comments on commit 3cdd034

Please sign in to comment.