Created
June 25, 2018 18:22
-
-
Save stalniy/c9ccbebd4ac1a750e47c758653a1f598 to your computer and use it in GitHub Desktop.
Lazy vars variable shadowing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Article', function() { | |
subject(function() { | |
return Article.create({ title: 'BDD lazy vars' }); | |
}); | |
its('status', () => is.expected.to.equal('draft')); | |
describe('changes history', function() { | |
subject(function() { | |
return $subject.changes(); // $subject refers to parent subject, i.e. created article | |
}); | |
it('is empty by default', function() { | |
expect($subject).to.be.empty; // $subject refers to local subject, i.e. article changes | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment