{"size": 1062, "ext": "js", "max_stars_repo_path": "test/StackSpec.js", "max_stars_repo_name": "imjacobclark/CraftingCodeCourse", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/StackSpec.js", "max_issues_repo_name": "imjacobclark/CraftingCodeCourse", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/StackSpec.js", "max_forks_repo_name": "imjacobclark/CraftingCodeCourse", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.3428571429, "max_line_length": 80, "alphanum_fraction": 0.5979284369}
var assert 	= 	require("assert"),
    Stack  	=	require('../src/Stack');

describe('Stack should', function(){
    before(function() {
        this.stack = new Stack();

        this.firstObject    = "first object";
        this.secondObject   = "second object";
    });

    it('pop the most recently pushed object', function(){
        this.stack.push(this.firstObject);

        assert.equal(this.stack.pop(), this.firstObject);	

        assert.throws(this.stack.pop, Error, "Array is empty");	
    });

    it('pop objects in the reverse order to which they were pushed', function(){
        this.stack.push(this.firstObject);
        this.stack.push(this.secondObject);

        assert.equal(this.stack.pop(), this.secondObject);
        assert.equal(this.stack.pop(), this.firstObject);
        
        assert.throws(this.stack.pop, Error, "Array is empty");					
    });

    it('throw an exception if popped when empty', function(){
        this.stack = new Stack();
        
        assert.throws(this.stack.pop, Error, "Array is empty");			
    })
})