Guest User

Untitled

a guest
Aug 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. module Matchers
  2. class Pixel
  3.  
  4. def initialize(type, attrs)
  5. @type, @attrs = type, attrs
  6. end
  7.  
  8. def matches?(actual)
  9. tag = Nokogiri::XML(actual).children.first
  10. (tag.name == @type) and @attrs.all? do |element|
  11. k,v = *element
  12. tag.attributes[k.to_s].value == v.to_s
  13. end
  14. end
  15.  
  16. def failure_message
  17. "DOESN'T WORK"
  18. end
  19.  
  20. def negative_failure_message
  21. "DOESN'T WORK"
  22. end
  23. end
  24.  
  25. def match_pixel_tag(type, attrs)
  26. Pixel.new(type, attrs)
  27. end
  28. end
Add Comment
Please, Sign In to add comment