diff --git a/config/initializers/html_safe.rb b/config/initializers/html_safe.rb
new file mode 100644
index 0000000..35e8d96
--- /dev/null
+++ b/config/initializers/html_safe.rb
@@ -0,0 +1,26 @@
+##
+# Object based copy of http://apidock.com/rails/ActionView/Helpers/OutputSafetyHelper/safe_join
+# array.safe_join instead of safe_join(array)
+#
+class Array
+ def safe_join sep=nil
+ sep = ERB::Util.unwrapped_html_escape sep
+
+ self.flatten.map!{ |i| ERB::Util.unwrapped_html_escape i }.join(sep).html_safe
+ end
+end
+
+##
+# Just use .to_json instead of .to_json.html_safe
+# as escape_html_entities_in_json is default on rails.
+# http://stackoverflow.com/a/31774454/670229
+#
+ActiveSupport::JSON::Encoding.escape_html_entities_in_json = true
+ActiveSupport::JSON.class_eval do
+ module EncodeWithHtmlSafe
+ def encode *args
+ super.html_safe
+ end
+ end
+ singleton_class.prepend EncodeWithHtmlSafe
+end
diff --git a/plugins/delivery/lib/delivery_plugin/display_helper.rb b/plugins/delivery/lib/delivery_plugin/display_helper.rb
index 0af6c1e..85055e7 100644
--- a/plugins/delivery/lib/delivery_plugin/display_helper.rb
+++ b/plugins/delivery/lib/delivery_plugin/display_helper.rb
@@ -15,7 +15,7 @@ module DeliveryPlugin::DisplayHelper
content_tag :option, text, value: method.id,
data: {label: method.name, type: method.delivery_type, instructions: CGI::escapeHTML(method.description.to_s)},
selected: if method.id == selected then 'selected' else nil end
- end.join
+ end.safe_join
end
def consumer_delivery_field_value order, field
diff --git a/plugins/shopping_cart/features/delivery_client.feature b/plugins/shopping_cart/features/delivery_client.feature
index a512742..a8c8933 100644
--- a/plugins/shopping_cart/features/delivery_client.feature
+++ b/plugins/shopping_cart/features/delivery_client.feature
@@ -64,10 +64,15 @@ Feature: delivery client
Scenario: gets free delivery due to free over price
Given I follow "Add to basket"
And I follow "Add to basket"
+ And I wait 0.2 seconds to finish the request
And I follow "Add to basket"
+ And I wait 0.2 seconds to finish the request
And I follow "Add to basket"
+ And I wait 0.2 seconds to finish the request
And I follow "Add to basket"
+ And I wait 0.2 seconds to finish the request
And I follow "Add to basket"
+ And I wait 0.2 seconds to finish the request
And I should see "Show basket"
And I follow "Show basket"
And I wait 1 second for animations
--
libgit2 0.21.2