From 0f0ee4778fbbc46766bc7903fd029b5a62458977 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Mon, 18 Nov 2013 16:55:23 -0500 Subject: [PATCH] Fix up matcher to account for change in data structure Aggregate CC XML would have a different output --- spec/support/matchers.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 798c9709..2ab14d83 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -54,7 +54,7 @@ RSpec::Matchers.define :deliver_result_image_for do |name| end end -RSpec::Matchers.define :deliver_cc_xml_for do |repo| +RSpec::Matchers.define :deliver_cc_xml_for do |obj| match do |response| body = response.body @@ -62,6 +62,9 @@ RSpec::Matchers.define :deliver_cc_xml_for do |repo| "expected #{body} to be a valid cc.xml" end + # obj can be a collection of Repositories + repo = obj.is_a?(ActiveRecord::Relation) ? obj.first : obj + body.include?('') && body.include?(%(name="#{repo.slug}")) && body.include?("https://www.example.com/#{repo.slug}") end end