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

Command type returns stdout, so you can use any matchers you like to the stdout #280

Merged
merged 3 commits into from Oct 16, 2013

Conversation

Projects
None yet
3 participants
@mizzy
Owner

mizzy commented Oct 16, 2013

This is a sample implementation to meet the demand of @rickhull in #276.

You can write spec like this.

describe command('ls -al /') do
  its(:stdout) { should match /bin/ }
end 

You can use any matchers that rspec has.And the command runs only once because its stdout is cached.

@rickhull

This comment has been minimized.

Show comment
Hide comment
@rickhull

rickhull commented Oct 16, 2013

+1

@smontanari

This comment has been minimized.

Show comment
Hide comment
@smontanari

smontanari Oct 16, 2013

Contributor

Looks good to me. Only thing I would probably have to change a little the code in the command type to accomodate the case of when we use winrm instead of ssh, to cater for windows commands. I've got already some work in progress in my windows-support branch to allow running commands from windows, but I'll wait until this change is all nicely merged into master before submitting a pull request

Contributor

smontanari commented Oct 16, 2013

Looks good to me. Only thing I would probably have to change a little the code in the command type to accomodate the case of when we use winrm instead of ssh, to cater for windows commands. I've got already some work in progress in my windows-support branch to allow running commands from windows, but I'll wait until this change is all nicely merged into master before submitting a pull request

mizzy added a commit that referenced this pull request Oct 16, 2013

Merge pull request #280 from serverspec/command-stdout
Command type returns stdout, so you can use any matchers you like to the stdout

@mizzy mizzy merged commit cb5452e into master Oct 16, 2013

1 check passed

default The Travis CI build passed
Details

@mizzy mizzy deleted the command-stdout branch Oct 16, 2013

@mizzy

This comment has been minimized.

Show comment
Hide comment
@mizzy

mizzy Oct 16, 2013

Owner

Thanks for your cheking, @rickhull and @smontanari .

I've just merged to master.I'm looking forward your pull request, @smontanari .

Owner

mizzy commented Oct 16, 2013

Thanks for your cheking, @rickhull and @smontanari .

I've just merged to master.I'm looking forward your pull request, @smontanari .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment