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

Version Path
billing-0.1.3 test/models/billing/charge_test.rb
billing-0.1.2a test/models/billing/charge_test.rb
billing-0.1.2 test/models/billing/charge_test.rb
billing-0.1.1 test/models/billing/charge_test.rb
billing-0.1.0a test/models/billing/charge_test.rb
billing-0.1.0 test/models/billing/charge_test.rb
billing-0.0.9 test/models/billing/charge_test.rb
billing-0.0.8a test/models/billing/charge_test.rb
billing-0.0.8 test/models/billing/charge_test.rb
billing-0.0.7i test/models/billing/charge_test.rb
billing-0.0.7g test/models/billing/charge_test.rb
billing-0.0.7f test/models/billing/charge_test.rb
billing-0.0.7e test/models/billing/charge_test.rb
billing-0.0.7d test/models/billing/charge_test.rb
billing-0.0.7c test/models/billing/charge_test.rb
billing-0.0.7b test/models/billing/charge_test.rb
billing-0.0.7a test/models/billing/charge_test.rb
billing-0.0.7 test/models/billing/charge_test.rb
billing-0.0.6a test/models/billing/charge_test.rb
billing-0.0.5b test/models/billing/charge_test.rb