Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kamiboers/0691a4be6c5a0f2bacda9dcb5d027fa7 to your computer and use it in GitHub Desktop.
Save kamiboers/0691a4be6c5a0f2bacda9dcb5d027fa7 to your computer and use it in GitHub Desktop.
Testing Homework

Testing Homework - Rails/JS

  • Unit Testing

  • Your experience implementing

    Teaspoon was reasonably easy to implement, and seems to maintain similarities to testing frameworks that I'm already familiar with.

  • Were you successful?

    I was successful in creating unit tests, but I was not able to figure out how to test for a particular error being thrown.

  • Links to commits on Github or copy and pasted code snippits of a test

    //= require remove_space
    
    

describe('removeSpace', function () {

it ('removes spaces from a string', function () {
	var str = 'I have spaces';
	var result = 'Ihavespaces';
	expect(removeSpace(str)).to.eq(result);
})

it ('removes multiple consecutive spaces from a string', function () {
	var str = 'I   have                       spaces';
	var result = 'Ihavespaces';
	expect(removeSpace(str)).to.eq(result);
})

it ('removes spaces from a number string', function () {
	var str = '1234 6789';
	var result = '12346789';
	expect(removeSpace(str)).to.eq(result);
})

})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment