Sha256: f087eda4f91815b3b00950e66735f920ca1f0053138c80099d31adb2f8584915
Contents?: true
Size: 992 Bytes
Versions: 24
Compression:
Stored size: 992 Bytes
Contents
require 'test_helper' module Billing class ChargeTest < ActiveSupport::TestCase setup do @charge = billing_charges(:one) end test "wild class method" do assert_equal Billing::Charge.new(Billing::Charge.wild(1)).price, '1 USD'.to_money assert_equal Billing::Charge.new(Billing::Charge.wild("1")).price, '1 USD'.to_money assert_equal Billing::Charge.new(Billing::Charge.wild("1EUR")).price, '1 EUR'.to_money assert_equal Billing::Charge.new(Billing::Charge.wild('1', price_currency: 'EUR')).price, '1 EUR'.to_money assert_equal Billing::Charge.new(Billing::Charge.wild(price: 10, price_currency: 'EUR')).price, '10 EUR'.to_money end test "string protocol" do charge = Billing::Charge.new Billing::Charge.wild("2.5*3.5##{billing_plus(:one).id}@#{billing_tax_groups(:one).id}+1.5%/Umbrella") assert_equal charge.price, '3.5 USD'.to_money assert_equal charge.name, 'Umbrella' #p charge end end end
Version data entries
24 entries across 24 versions & 1 rubygems