small medium large xlarge

Generic-user-small
21 May 2016, 16:01
Ants (2 posts)

After quite a few years of BDD with Ruby/Rails, the community has, I believe, evolved away from using language like should in a test description.

Let’s take the positive test on page 28 for palindromes:

it('should return true for argument mom', function() {
  expect(isPalindrome('mom')).to.be.true;
});

I would write:

it('returns true for argument mom', function() {
  expect(isPalindrome('mom')).to.be.true;
});

I would remove should from my tests as it sends out a much more confident message and reads better in the report output.

What do you think?

Venkatsubramaniam_pragsmall
21 May 2016, 16:32
Venkat Subramaniam (99 posts)

Hi Ants,

Different communities have different practices. I generally use naming conventions as guidelines and evolve to what consistently works for the team I work with.

Thanks,

Venkat

You must be logged in to comment