1
0
mirror of https://github.com/danog/gift.git synced 2024-11-30 04:19:37 +01:00
gift/test/config.test.coffee

37 lines
1.0 KiB
CoffeeScript
Raw Permalink Normal View History

should = require 'should'
Config = require '../src/config'
GIT_CONFIG = """
user.name=John Doe
user.email=john.doe@git-scm.com
core.editor=pico
"""
GIT_CONFIG_DUPLICATE_KEYS = """
user.name=John Doe
user.email=john.doe@git-scm.com
core.editor=pico
user.email=john.doe@github.com
core.editor=emacs
"""
describe "Config", ->
describe "()", ->
describe "when there are no overlapping keys", ->
config = new Config.Config 'mock repo'
config.parse GIT_CONFIG
it "read the keys and values", ->
2013-10-06 19:05:57 +02:00
config.items['user.name'].should.equal 'John Doe'
config.items['user.email'].should.equal 'john.doe@git-scm.com'
config.items['core.editor'].should.equal 'pico'
describe "with overlapping keys", ->
config = new Config.Config 'mock repo'
config.parse GIT_CONFIG_DUPLICATE_KEYS
it "read the keys and values", ->
2013-10-06 19:05:57 +02:00
config.items['user.name'].should.equal 'John Doe'
config.items['user.email'].should.equal 'john.doe@github.com'
config.items['core.editor'].should.equal 'emacs'