Created
November 19, 2011 15:28
-
-
Save searls/1378962 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
SecretTreasure = (config) -> | |
somethingWasTyped: -> | |
if $('.secret').val() == config.secret | |
$('.treasure').removeClass('hidden') |
This file contains hidden or 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 "Secret Treasure!", -> | |
SECRET = "whizbang" | |
beforeEach -> | |
@$secretInput = inject(el: 'input', cssClass: 'secret') | |
@$treasure = inject('treasure').addClass('hidden') | |
@subject = SecretTreasure(secret: SECRET) | |
describe "#somethingWasTyped", -> | |
context "when the user figured out the secret", -> | |
beforeEach -> | |
@$secretInput.val(SECRET) | |
@subject.somethingWasTyped() | |
it "shows the treasure to the user", -> | |
expect(@$treasure).not.toHaveClass('hidden') | |
context "when the user was incorrect", -> | |
beforeEach -> | |
@$secretInput.val("so wrong") | |
@subject.somethingWasTyped() | |
it "does not show the treasure", -> | |
expect(@$treasure).toHaveClass('hidden') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment