Skip to content

Commit

Permalink
Merge pull request #286 from petems/fix_multiple_stdout_expects
Browse files Browse the repository at this point in the history
Changes debug output to allow multiple regex
  • Loading branch information
petems authored Nov 20, 2017
2 parents 0d34686 + f2baecc commit ab41529
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions spec/cli/debug_cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
to_return(status: 200, body: fixture('show_droplets'), headers: {})

expect { cli.droplets }.to output(%r{DEBUG -- : Request Headers:}).to_stdout
expect { cli.droplets }.to output(%r{Bearer foo}).to_stdout
expect { cli.droplets }.to output(%r{Started GET request to}).to_stdout
debug_droplets_expectation = expect { cli.droplets }

debug_droplets_expectation.to output(%r{DEBUG -- : Request Headers:}).to_stdout
debug_droplets_expectation.to output(%r{Bearer foo}).to_stdout
debug_droplets_expectation.to output(%r{Started GET request to}).to_stdout
end
end

Expand All @@ -45,11 +47,11 @@
with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.9.2' }).
to_return(status: 200, body: fixture('show_droplets'), headers: {})

expect { cli.droplets }.to output(%r{Started GET request to}).to_stdout
expect { cli.droplets }.to output(%r{DEBUG -- : Request Headers:}).to_stdout
expect { cli.droplets }.to output(%r{Bearer \[TOKEN REDACTED\]}).to_stdout

expect { cli.droplets }.not_to output(%r{Bearer foo}).to_stdout
debug_droplets_expectation = expect { cli.droplets }
debug_droplets_expectation.to output(%r{Started GET request to}).to_stdout
debug_droplets_expectation.to output(%r{DEBUG -- : Request Headers:}).to_stdout
debug_droplets_expectation.to output(%r{Bearer \[TOKEN REDACTED\]}).to_stdout
debug_droplets_expectation.not_to output(%r{Bearer foo}).to_stdout
end
end
end

0 comments on commit ab41529

Please sign in to comment.