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

Add a with_no_args option for mocks #56

Open
robkinyon opened this issue Nov 17, 2016 · 0 comments
Open

Add a with_no_args option for mocks #56

robkinyon opened this issue Nov 17, 2016 · 0 comments

Comments

@robkinyon
Copy link

Let's say I have a script that invokes a command twice as part of its execution, once with arguments and once without. Example:

#!/bin/bash

foo=$(my-script)
bar=$(my-script A)
echo "'$foo' '$bar'"

with a test of

let!(mocker) {
    stubbed_env.mock('my-script')
      .with_args('A').outputs('1')
      .with_no_args().outputs('2')
}
stdout,stderr,exitstatus = stubbed_env.execute(thing_under_test)
expect(stdout).to eql("'2' '1'")

Right now, there is no way to do this.

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