spec/rumble_spec.rb in keynote-0.3.1 vs spec/rumble_spec.rb in keynote-1.0.0
- old
+ new
@@ -22,10 +22,11 @@
assert_equal exp, res
assert_instance_of ActiveSupport::SafeBuffer, res
end
def setup
+ @rumble_context = nil
super
assert_nil @rumble_context
end
def teardown
@@ -53,9 +54,37 @@
div.input do
input type: 'text', name: 'value'
end
end
+ end
+ end
+
+ def test_string_data
+ assert_rumble '<div data="whatever"></div>' do
+ div data: "whatever"
+ end
+ end
+
+ def test_hash_data
+ str = <<-HTML
+ <div data-modal="true" data-safe=""""" data-unsafe=""&quot;"">
+ </div>
+ HTML
+
+ assert_rumble str do
+ div data: { modal: true, safe: '"""'.html_safe, unsafe: '"""' }
+ end
+ end
+
+ def test_array_attrs
+ str = <<-HTML
+ <div class="hello "uns&amp;fe" "w&rld"">
+ </div>
+ HTML
+
+ assert_rumble str do
+ div class: ["hello", '"uns&fe"', '"w&rld"'.html_safe]
end
end
def test_several
str = <<-HTML