Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested stubbing doesn't work #117

Closed
searls opened this issue Jul 14, 2016 · 0 comments
Closed

Nested stubbing doesn't work #117

searls opened this issue Jul 14, 2016 · 0 comments

Comments

@searls
Copy link
Member

searls commented Jul 14, 2016

Right now, testdouble.js blows up if—in the same statement as a stubbing—the user attempts to stub a different test double.

Example failing test:

  describe 'nested whens', ->
    Given -> @knob = td.function()
    Given -> @door = td.function()
    Given -> td.when(@knob('twist')).thenReturn
      door: td.when(@door('push')).thenReturn('open')
    When -> @result = @knob('twist').door('push')
    Then -> @result == 'open'

This is because the call store has just a single lastCall that it tracks, when in reality it should probably resemble a stack instead.

searls added a commit that referenced this issue Jul 14, 2016
searls added a commit that referenced this issue Jul 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant