baf 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/baf/cli.rb +1 -1
- data/lib/baf/env.rb +1 -1
- data/lib/baf/testing/cucumber/steps/input.rb +3 -0
- data/lib/baf/testing/cucumber/steps/output.rb +10 -4
- data/lib/baf/testing/cucumber/steps/output_wait.rb +10 -3
- data/lib/baf/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c706eccaeb576703318da1f4b064a6ad6022b120
|
4
|
+
data.tar.gz: 8317a9cc42d852c2dcce64e3e31d10fecb33846b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd2ecfe25f573437c0d4d2611ddf9653418eb6bda3cb703d1901b4dedd1d5193bac918fa3fcd6d144145b25369af7ce64cf32f40a5f55a379cfb1cea1b27f156
|
7
|
+
data.tar.gz: c327237b3b0bd01196b080713c710efe8eea223a35b104d201d736dddfd8340ad4407c67a016b7021232f8f119c2bc5cccd3d86d5ffed14930d5673975afdd2d
|
data/lib/baf/cli.rb
CHANGED
data/lib/baf/env.rb
CHANGED
@@ -8,8 +8,9 @@ def build_regexp pattern, options
|
|
8
8
|
end)
|
9
9
|
end
|
10
10
|
|
11
|
-
def expect_output content
|
12
|
-
|
11
|
+
def expect_output content, stream: :output
|
12
|
+
stream = :stderr if stream == :error
|
13
|
+
expect(last_command_started.send stream).to eq unescape_text content
|
13
14
|
end
|
14
15
|
|
15
16
|
|
@@ -17,12 +18,17 @@ Then /^the output must contain "([^"]+)"$/ do |content|
|
|
17
18
|
expect(last_command_started.output).to include unescape_text content
|
18
19
|
end
|
19
20
|
|
21
|
+
Then /^the output must not contain "([^"]+)"$/ do |content|
|
22
|
+
expect(last_command_started.output).not_to include unescape_text content
|
23
|
+
end
|
24
|
+
|
20
25
|
Then /^the output must contain exactly:$/ do |content|
|
21
26
|
expect_output content + $/
|
22
27
|
end
|
23
28
|
|
24
|
-
Then /^the output must contain exactly "([^"]+)"$/ do |content|
|
25
|
-
|
29
|
+
Then /^the( error)? output must contain exactly "([^"]+)"$/ do |stream, content|
|
30
|
+
stream = stream ? :error : :output
|
31
|
+
expect_output content, stream: stream
|
26
32
|
end
|
27
33
|
|
28
34
|
Then /^the output must match \/([^\/]+)\/([a-z]*)$/ do |pattern, options|
|
@@ -13,14 +13,15 @@ module Baf
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def wait_output! pattern
|
16
|
+
def wait_output! pattern, times: 1, results: nil
|
17
17
|
output = -> { last_command_started.output }
|
18
18
|
wait_until do
|
19
19
|
case pattern
|
20
|
-
when Regexp then output.call
|
20
|
+
when Regexp then (results = output.call.scan(pattern)).size >= times
|
21
21
|
when String then output.call.include? pattern
|
22
22
|
end
|
23
23
|
end
|
24
|
+
results
|
24
25
|
rescue Baf::Testing::WaitError => e
|
25
26
|
fail <<-eoh
|
26
27
|
expected `#{pattern}' not seen after #{e.timeout} seconds in:
|
@@ -29,7 +30,9 @@ expected `#{pattern}' not seen after #{e.timeout} seconds in:
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def wait_until message: 'condition not met after %d seconds'
|
32
|
-
timeout =
|
33
|
+
timeout = ENV.key?('BAF_TEST_TIMEOUT') ?
|
34
|
+
ENV['BAF_TEST_TIMEOUT'].to_i :
|
35
|
+
2
|
33
36
|
Timeout.timeout(timeout) do
|
34
37
|
loop do
|
35
38
|
break if yield
|
@@ -45,6 +48,10 @@ Then /^the output will match \/([^\/]+)\/([a-z]*)$/ do |pattern, options|
|
|
45
48
|
wait_output! build_regexp(pattern, options)
|
46
49
|
end
|
47
50
|
|
51
|
+
Then /^the output will contain:$/ do |content|
|
52
|
+
wait_output! content + $/
|
53
|
+
end
|
54
|
+
|
48
55
|
Then /^the output will contain "([^"]+)"$/ do |content|
|
49
56
|
wait_output! content
|
50
57
|
end
|
data/lib/baf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault Jouan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: baf-testing
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- lib/baf/options_registrant.rb
|
53
53
|
- lib/baf/testing/cucumber.rb
|
54
54
|
- lib/baf/testing/cucumber/steps/execution.rb
|
55
|
+
- lib/baf/testing/cucumber/steps/input.rb
|
55
56
|
- lib/baf/testing/cucumber/steps/output.rb
|
56
57
|
- lib/baf/testing/cucumber/steps/output_wait.rb
|
57
58
|
- lib/baf/version.rb
|