Sha256: 748be9763097f213ff73826432d85958c09da23de1edb71178090fc2adc951a5

Contents?: true

Size: 1.25 KB

Versions: 33

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'

module Billing
  class ModifierTest < ActiveSupport::TestCase
    setup do
      @modifier = billing_modifiers(:one)
    end
    
    # test "args_to_attributes class method" do
      # assert_equal Billing::Modifier.args_to_attributes("1%"), { percent: 1 }
      # assert_equal Billing::Modifier.args_to_attributes("22.1 %"), { percent: 22.1 }
      # assert_equal Billing::Modifier.args_to_attributes(1.456), { fixed_value: '1.46 USD'.to_money }
      # assert_equal Billing::Modifier.args_to_attributes("1.4"), { fixed_value: '1.4 USD'.to_money }
      # assert_equal Billing::Modifier.args_to_attributes("1.4EUR"), { fixed_value: '1.4 EUR'.to_money }
      # assert_equal Billing::Modifier.args_to_attributes(1, percent_ration: 0.01 ), { fixed_value: '1 USD'.to_money, percent: 0.01 }
      # assert_equal Billing::Modifier.args_to_attributes(percent_ration: 0.01), { percent_ratio: 0.01 }
    # end
    
    test "allow only one modifier per charge" do
      mod = billing_modifiers(:two).dup
      assert_equal false, mod.save
      assert mod.errors[:charge]
    end
    
    test "allow only one global bill modifier" do
      mod = billing_modifiers(:two).dup
      assert_equal false, mod.save
      assert mod.errors[:bill]
    end
    
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
billing-0.2.2 test/models/billing/modifier_test.rb
billing-0.2.1 test/models/billing/modifier_test.rb
billing-0.2.0 test/models/billing/modifier_test.rb
billing-0.1.9 test/models/billing/modifier_test.rb
billing-0.1.8 test/models/billing/modifier_test.rb
billing-0.1.7 test/models/billing/modifier_test.rb
billing-0.1.6 test/models/billing/modifier_test.rb
billing-0.1.5 test/models/billing/modifier_test.rb
billing-0.1.4 test/models/billing/modifier_test.rb
billing-0.1.3 test/models/billing/modifier_test.rb
billing-0.1.2a test/models/billing/modifier_test.rb
billing-0.1.2 test/models/billing/modifier_test.rb
billing-0.1.1 test/models/billing/modifier_test.rb
billing-0.1.0a test/models/billing/modifier_test.rb
billing-0.1.0 test/models/billing/modifier_test.rb
billing-0.0.9 test/models/billing/modifier_test.rb
billing-0.0.8a test/models/billing/modifier_test.rb
billing-0.0.8 test/models/billing/modifier_test.rb
billing-0.0.7i test/models/billing/modifier_test.rb
billing-0.0.7g test/models/billing/modifier_test.rb