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

Facilitate testing cog::command #33

Open
pcarranza opened this issue Feb 7, 2017 · 0 comments
Open

Facilitate testing cog::command #33

pcarranza opened this issue Feb 7, 2017 · 0 comments

Comments

@pcarranza
Copy link

Hey, I love cog and I would like to provide some feedback to improve it if that's possible.

Just yesterday I finished build a cog command and I wanted to add some form of testing for it, in the process of doing it I ended up hitting a couple of walls given how things are implemented.

I was trying to inject values using the environment, which worked great in my local environment, but then it failed silently in the CI environment. The reason why is because CI's env is not a tty: I had to add this before { allow(STDIN).to receive(:tty?) { true } } to my tests because of the request just returning an empty set of arguments and

A better solution would be to just be able of building a request and injecting it in the command when I'm building it, but I saw no simple way without stubbing or monkey patching, and I rather not do it in a dependency I don't own.

You can see the whole test implementation here and you can see how it fails in this GitLab-CI execution

In other words, it's kinda hard to implement tests for cog commands, and it would be great if there is a straightforward way of doing it without having to reverse engineer how cog works.

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