PageRenderTime 41ms CodeModel.GetById 17ms app.highlight 20ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/bundle/jruby/2.1/gems/rspec-core-2.14.8/features/step_definitions/additional_cli_steps.rb

https://github.com/delowong/logstash
Ruby | 49 lines | 35 code | 9 blank | 5 comment | 0 complexity | 9630f544c0f0a381f6e5466c05c1defd MD5 | raw file
 1require 'rspec/core'  # to fix annoying "undefined method `configuration' for RSpec:Module (NoMethodError)"
 2
 3Then /^the output should contain all of these:$/ do |table|
 4  table.raw.flatten.each do |string|
 5    assert_partial_output(string, all_output)
 6  end
 7end
 8
 9Then /^the output should not contain any of these:$/ do |table|
10  table.raw.flatten.each do |string|
11    all_output.should_not =~ regexp(string)
12  end
13end
14
15Then /^the output should contain one of the following:$/ do |table|
16  matching_output = table.raw.flatten.select do |string|
17    all_output =~ regexp(string)
18  end
19
20  matching_output.should have(1).item
21end
22
23Then /^the example(?:s)? should(?: all)? pass$/ do
24  step %q{the output should contain "0 failures"}
25  step %q{the output should not contain "0 examples"}
26  step %q{the exit status should be 0}
27end
28
29Then /^the process should succeed even though no examples were run$/ do
30  step %q{the output should contain "0 examples, 0 failures"}
31  step %q{the exit status should be 0}
32end
33
34Then /^the backtrace\-normalized output should contain:$/ do |partial_output|
35  # ruby 1.9 includes additional stuff in the backtrace,
36  # so we need to normalize it to compare it with our expected output.
37  normalized_output = all_output.split("\n").map do |line|
38    line =~ /(^\s+# [^:]+:\d+)/ ? $1 : line # http://rubular.com/r/zDD7DdWyzF
39  end.join("\n")
40
41  normalized_output.should =~ regexp(partial_output)
42end
43
44# This step can be generalized if it's ever used to test other colors
45Then /^the failing example is printed in magenta$/ do
46  # \e[35m = enable magenta
47  # \e[0m  = reset colors
48  expect(all_output).to include("\e[35m" + "F" + "\e[0m")
49end