diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..3361fb0 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +jruby-1.7.24 diff --git a/lib/agent_fix/cucumber.rb b/lib/agent_fix/cucumber.rb index 35a6cff..1319132 100644 --- a/lib/agent_fix/cucumber.rb +++ b/lib/agent_fix/cucumber.rb @@ -143,3 +143,26 @@ def anticipate_fix expect(found).to be(true), "Message not included in FIX messages\n #{error_accum}" end + +Then(/^the (?:fix|FIX) messages should include a message with(?: the tag)? "(.*)"$/) do |path| + expect(@message_scope).not_to be_nil, "No message scope defined" + + found = false + error_accum = "" + index = 1 + @message_scope.each do |m| + @message = m + begin + steps %Q{ +When I inspect the #{index}th FIX message +And the FIX message should have "#{path}" + } + found = true + rescue Exception => e + error_accum << "\n#{m.to_s.gsub!(/\001/, '|')}\n #{e}" + end + index += 1 + end + + expect(found).to be(true), "Tag not included in FIX messages\n #{error_accum}" +end