var chai = require('chai'),
    spies = require('chai-spies'),
    expect = chai.expect,
    mockery = require('../mockery'),
    fs = require('fs'),
    rc = require('rc'),
    path = require('path'),
    sut = '../../lib/config',
    _ = require('lodash'),
    defaultConfig = JSON.parse(fs.readFileSync('.proxitrc'));

chai.use(spies);

describe('config', function() {
    var config,
        exists,
        result;

    beforeEach(function() {
        mockery.setup({
            allow: [sut, 'lodash', 'path', 'minimist'],
            mock: {
                'fs': {
                    existsSync: function() {
                        return exists;
                    }
                },
                'rc': chai.spy(rc)
            }
        });

        exists = false;
    });

    it('should return proxit.json present and nothing is passed', function() {
        givenProxitJson();
        whenConfigCalledWithNoParams();
        thenConfigShouldEqualProxitJson();
    });

    afterEach(function() {
        mockery.teardown();
    });

    function givenProxitJson() {
        mockery.registerMock(process.cwd() + path.sep + 'proxit.json', _.cloneDeep(defaultConfig));
        exists = true;
    }

    function whenConfigCalledWithNoParams() {
        config = require(sut);
        result = _.omit(config());
    }

    function thenConfigShouldEqualProxitJson() {
        expect(result).to.eql(defaultConfig);
        mockery.deregisterMock('../../proxit.json');
    }
});

@@ -256,29 +256,26 @@
 '),%0A    
-defaultConfig
+proxitJson
  = JSON.
@@ -408,16 +408,33 @@
   result
+,%0A        options
 ;%0A%0A    b
@@ -763,24 +763,57 @@
        %7D);%0A%0A
+        options = %7B%0A%0A        %7D;%0A%0A
         exis
@@ -969,21 +969,22 @@
 edWithNo
-Param
+Option
 s();%0A   
@@ -1028,24 +1028,204 @@
 );%0A    %7D);%0A%0A
+    it('should return options passed when present', function() %7B%0A        givenProxitJson();%0A        whenConfigCalledWithOptions();%0A        thenConfigShouldEqualOptions();%0A    %7D);%0A%0A
     afterEac
@@ -1392,29 +1392,26 @@
 oneDeep(
-defaultConfig
+proxitJson
 ));%0A    
@@ -1475,13 +1475,132 @@
 thNo
-Param
+Options() %7B%0A        config = require(sut);%0A        result = _.omit(config());%0A    %7D%0A%0A    function whenConfigCalledWithOption
 s() 
@@ -1655,32 +1655,39 @@
 = _.omit(config(
+options
 ));%0A    %7D%0A%0A    f
@@ -1764,74 +1764,111 @@
 eql(
-defaultConfig);%0A        mockery.deregisterMock('../../proxit.json'
+proxitJson);%0A    %7D%0A%0A    function thenConfigShouldEqualOptions() %7B%0A        expect(result).to.eql(options
 );%0A 

Add another config test scenario.