spec/spec_helper.rb in faml-0.6.3 vs spec/spec_helper.rb in faml-0.6.4
- old
+ new
@@ -28,9 +28,23 @@
else
def render_string(str, options = {})
eval(Faml::Engine.new(options).call(str))
end
end
+
+ def with_each_attribute_type(key, val, tag: 'span', text: '', klass: nil, id: nil)
+ if id
+ tag = "#{tag}##{id}"
+ end
+ if klass
+ tag = "#{tag}.#{klass}"
+ end
+ aggregate_failures do
+ yield("%#{tag}{#{key}: #{val}}#{text}")
+ yield("- v = #{val}\n%#{tag}{#{key}: v}#{text}")
+ yield("- h = {#{key}: #{val}}\n%#{tag}{h}#{text}")
+ end
+ end
end
module Faml
TestStruct = Struct.new(:id)
TestRefStruct = Struct.new(:id) do