Sha256: 3ae02b4264ba3e08da9bc8e6fd11b0805c05a44b7e79be67968a5b7b87301824
Contents?: true
Size: 647 Bytes
Versions: 22
Compression:
Stored size: 647 Bytes
Contents
require 'spec_helper' RSpec.describe 'JS Spree.formatMoney', js: true do stub_authorization! # This is a slightly hacky spec to ensure that our JS will format money in # the same was as our ruby code. # This should probably replaced with a pure JS test in the future. it 'should behave identically to Spree::Money#to_s' do visit '/admin' Money::Currency.all.map(&:id).map(&:to_s).map(&:upcase).uniq.each do |currency| money = Spree::Money.new(1234, currency: currency) js_result = page.evaluate_script("Spree.formatMoney(#{money.to_d}, '#{currency}')") expect(js_result).to eq money.to_s end end end
Version data entries
22 entries across 22 versions & 1 rubygems