~singpolyma/sgx-jmp

6ead87605043d167e477aa8d7959d6e4b7af7d03 — Christopher Vollick 8 months ago d319846
Remove BigDecimal.new

It turns out in newer versions of Ruby this isn't cool anymore.
The new way is BigDecimal(value), which is dumb, but whatever...
M lib/btc_sell_prices.rb => lib/btc_sell_prices.rb +1 -1
@@ 24,7 24,7 @@ class BTCSellPrices
			bitcoin_row = canadianbitcoins.at("#ticker > table > tbody > tr")
			raise "Bitcoin row has moved" unless bitcoin_row.at("td").text == "Bitcoin"

			BigDecimal.new(
			BigDecimal(
				bitcoin_row.at("td:nth-of-type(3)").text.match(/^\$(\d+\.\d+)/)[1]
			)
		end

M lib/customer.rb => lib/customer.rb +1 -1
@@ 24,7 24,7 @@ class Customer
		customer_id,
		jid,
		plan: CustomerPlan.new(customer_id),
		balance: BigDecimal.new(0),
		balance: BigDecimal(0),
		sgx: BackendSgx.new(customer_id)
	)
		@plan = plan

M lib/electrum.rb => lib/electrum.rb +1 -1
@@ 50,7 50,7 @@ class Electrum
		end

		def amount_for(*addresses)
			BigDecimal.new(
			BigDecimal(
				@tx["outputs"]
					.select { |o| addresses.include?(o["address"]) }
					.map { |o| o["value_sats"] }

M lib/plan.rb => lib/plan.rb +1 -1
@@ 21,7 21,7 @@ class Plan
	end

	def monthly_price
		BigDecimal.new(@plan[:monthly_price]) / 10000
		BigDecimal(@plan[:monthly_price]) / 10000
	end

	def merchant_account

M lib/transaction.rb => lib/transaction.rb +2 -2
@@ 45,7 45,7 @@ class Transaction
		@customer_id = braintree_transaction.customer_details.id
		@transaction_id = braintree_transaction.id
		@created_at = braintree_transaction.created_at
		@amount = BigDecimal.new(braintree_transaction.amount, 4)
		@amount = BigDecimal(braintree_transaction.amount, 4)
	end

	def insert


@@ 58,7 58,7 @@ class Transaction
	end

	def bonus
		return BigDecimal.new(0) if amount <= 15
		return BigDecimal(0) if amount <= 15
		amount *
			case amount
			when (15..29.99)

M test/test_btc_sell_prices.rb => test/test_btc_sell_prices.rb +2 -2
@@ 15,7 15,7 @@ class BTCSellPricesTest < Minitest::Test
			body: "<div id='ticker'><table><tbody><tr>" \
			      "<td>Bitcoin</td><td></td><td>$123.00</td>"
		)
		assert_equal BigDecimal.new(123), @subject.cad.sync
		assert_equal BigDecimal(123), @subject.cad.sync
	end
	em :test_cad



@@ 25,7 25,7 @@ class BTCSellPricesTest < Minitest::Test
			      "<td>Bitcoin<td></td><td>$123.00</td>"
		)
		@redis.expect(:get, EMPromise.resolve("0.5"), ["cad_to_usd"])
		assert_equal BigDecimal.new(123) / 2, @subject.usd.sync
		assert_equal BigDecimal(123) / 2, @subject.usd.sync
	end
	em :test_usd
end

M test/test_buy_account_credit_form.rb => test/test_buy_account_credit_form.rb +1 -1
@@ 10,7 10,7 @@ class BuyAccountCreditFormTest < Minitest::Test
	def setup
		@payment_method = OpenStruct.new(card_type: "Test", last_4: "1234")
		@form = BuyAccountCreditForm.new(
			BigDecimal.new("15.1234"),
			BigDecimal("15.1234"),
			PaymentMethods.new([@payment_method])
		)
	end

M test/test_customer.rb => test/test_customer.rb +2 -2
@@ 34,7 34,7 @@ class CustomerTest < Minitest::Test
				Matching.new do |params|
					params[0] == "test" &&
					params[1].is_a?(String) &&
					BigDecimal.new(-1) == params[2]
					BigDecimal(-1) == params[2]
				end
			]
		)


@@ 61,7 61,7 @@ class CustomerTest < Minitest::Test
				Matching.new do |params|
					params[0] == "test" &&
					params[1].is_a?(String) &&
					BigDecimal.new(-1) == params[2]
					BigDecimal(-1) == params[2]
				end
			]
		)

M test/test_customer_repo.rb => test/test_customer_repo.rb +1 -1
@@ 65,7 65,7 @@ class CustomerRepoTest < Minitest::Test
			[String, [7357]]
		)
		customer = repo.find(7357).sync
		assert_equal BigDecimal.new(0), customer.balance
		assert_equal BigDecimal(0), customer.balance
		assert_mock db
	end
	em :test_find_db_empty

M test/test_registration.rb => test/test_registration.rb +1 -1
@@ 215,7 215,7 @@ class RegistrationTest < Minitest::Test
				)
				Registration::Payment::Bitcoin::BTC_SELL_PRICES.expect(
					:usd,
					EMPromise.resolve(BigDecimal.new(1))
					EMPromise.resolve(BigDecimal(1))
				)
				@bitcoin.stub(:save, EMPromise.resolve(nil)) do
					execute_command(blather: blather) do