diff --git a/spec/core_spec.moon b/spec/core_spec.moon index c6ba06d..85daeda 100644 --- a/spec/core_spec.moon +++ b/spec/core_spec.moon @@ -23,13 +23,9 @@ describe 'core module', -> assert.is.table lua_first.test assert.is.string txt_first.test + + it 'recursively binds to subdirectories', -> + assert.equal 'file in subdirectory', config.sub.test -describe 'raw loader', -> - before_each -> export loader = require 'glass.raw' - it 'loads files as plain text', -> - assert.same 'plain text\n', loader 'spec/fixtures/test' - -describe 'lua loader', -> - before_each -> export loader = require 'glass.lua' - it 'loads Lua files', -> - assert.same { foo: 'bar', tab: {} }, loader 'spec/fixtures/test' + it 'returns nil for missing configs', -> + assert.nil config.missing diff --git a/spec/fixtures/sub/test.lua b/spec/fixtures/sub/test.lua new file mode 100644 index 0000000..1301fa2 --- /dev/null +++ b/spec/fixtures/sub/test.lua @@ -0,0 +1 @@ +return 'file in subdirectory' diff --git a/spec/loaders_spec.moon b/spec/loaders_spec.moon new file mode 100644 index 0000000..656460d --- /dev/null +++ b/spec/loaders_spec.moon @@ -0,0 +1,9 @@ +describe 'raw loader', -> + before_each -> export loader = require 'glass.raw' + it 'loads files as plain text', -> + assert.same 'plain text\n', loader 'spec/fixtures/test' + +describe 'lua loader', -> + before_each -> export loader = require 'glass.lua' + it 'loads Lua files', -> + assert.same { foo: 'bar', tab: {} }, loader 'spec/fixtures/test'