Sha256: 420b4d4c6b89788fc66c52242a9e4d9c4324a9dc84e29cf5a09e596eb8cf1413
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
shared_context 'config_helper' do RSpec::Matchers.define :be_parsed_as do |obj| match do |text| v = parse_text(text) if obj.is_a?(Float) v.is_a?(Float) && (v == obj || (v.nan? && obj.nan?) || (v - obj).abs < 0.000001) else v == obj end end failure_message_for_should do |text| msg = parse_text(text).inspect rescue 'failed' "expected that #{text.inspect} would be a parsed as #{obj.inspect} but got #{msg}" end end RSpec::Matchers.define :be_parsed_as_json do |obj| match do |text| v = JSON.parse(parse_text(text)) v == obj end failure_message_for_should do |text| msg = parse_text(text).inspect rescue 'failed' "expected that #{text.inspect} would be a parsed as #{obj.inspect} but got #{msg}" end end RSpec::Matchers.define :be_parse_error do |obj| match do |text| begin parse_text(text) false rescue Fluent::ConfigParseError true end end failure_message_for_should do |text| begin msg = parse_text(text).inspect rescue msg = $!.inspect end "expected that #{text.inspect} would cause a parse error but got #{msg}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fluentd-0.10.49 | spec/config/helper.rb |
fluentd-0.10.48 | spec/config/helper.rb |
fluentd-0.10.47 | spec/config/helper.rb |
fluentd-0.10.46 | spec/config/helper.rb |