Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed v3.2.0 deprecations (references #31)

  • Loading branch information...
commit d579d110d987e50ac579fc9af7806b440378d3f9 2 parents 31214fe + 0c24d66
@weppos authored
View
9 CHANGELOG.md
@@ -5,13 +5,18 @@ Features
--------
- Added support for creating objects with the main monetary unit instead of cents.
([#issue/25](http://github.com/RubyMoney/money/issues/25))
+
+Changes
+-------
- Deprecated `Money#format` with separate params instead of Hash.
Deprecation target set to Money 3.5.0.
([#issue/31](http://github.com/RubyMoney/money/issues/31))
- Deprecated `Money#new(0, :currency => "EUR")` in favor of `Money#new(0, "EUR")`.
Deprecation target set to Money 3.5.0.
([#issue/31](http://github.com/RubyMoney/money/issues/31))
-
+ - Removed deprecated `Money::SYMBOLS`, `Money::SEPARATORS` and `Money::DELIMITERS`.
+ - Removed deprecated `Money::VariableExchangeBank`.
+ - Removed deprecated `Money::Bank::Base#exchange`.
Money 3.1.0
===========
@@ -23,7 +28,7 @@ Features
- Added `Money::Bank::Base#exchange_with`.
- Deprecated `Money::Bank::Base#exchange`. Deprecation target set to Money
3.2.0.
- - Implented `Money::Bank::VariableExchange`
+ - Implemented `Money::Bank::VariableExchange`
- Deprecated `Money::VariableExchangeBank`. Deprecation target set to Money
3.2.0.
- Deprecate `Money::SYMBOLS`, `Money::SEPARATORS` and `Money::DELIMITERS`.
View
1  lib/money.rb
@@ -22,6 +22,5 @@
require 'money/currency'
require 'money/money'
-require 'money/defaults'
require 'money/core_extensions'
require 'money/deprecations'
View
7 lib/money/bank/base.rb
@@ -84,13 +84,6 @@ def initialize(&block)
def setup
end
- # @deprecated +#exchange+ will be removed in v3.2.0, use +#exchange_with+
- # @see Money::Bank::Base#exchange_with
- def exchange(cents, from_currency, to_currency, &block)
- Money.deprecate "`Money::Bank::Base#exchange' will be removed in v3.2.0, use #exchange_with instead"
- exchange_with(Money.new(cents, from_currency), to_currency, &block).cents
- end
-
# Exchanges the given +Money+ object to a new +Money+ object in
# +to_currency+.
#
View
57 lib/money/defaults.rb
@@ -1,57 +0,0 @@
-# encoding: utf-8
-
-class Money
- # Used to notify users about the deprecated constants.
- # @see Money::SYMBOLS, Money::SEPARATOR and Money::DELIMITERS
- class DeprecatedHash < Hash
-
- # Creates a new +DeprecatedHash+ with message that will be displayed when
- # accessing +#[]+ and +#[]=+.
- def initialize(hash, message)
- @message = message
- replace(hash)
- end
-
- # Displays @message then calls +super+.
- def [](key)
- Money.deprecate(@message)
- super
- end
-
- # Displays @message then calls +super+.
- def []=(value)
- Money.deprecate(@message)
- super
- end
-
- end
-
- # @deprecated See Money::Currency#symbol
- SYMBOLS = DeprecatedHash.new({
- "GBP" => "£",
- "JPY" => "¥",
- "EUR" => "",
- "ZWD" => "Z$",
- "CNY" => "¥",
- "INR" => "",
- "NPR" => "",
- "SCR" => "",
- "LKR" => "",
- "SEK" => "kr",
- "GHC" => "¢",
- "BRL" => "R$ ",
- # Everything else defaults to '¤'
- }, "Money::SYMBOLS has no longer effect and will be removed in v3.2.0. See Money::Currency#symbol.")
-
- # @deprecated See Money::Currency#separator
- SEPARATORS = DeprecatedHash.new({
- "BRL" => ",",
- # Everything else defaults to '.'
- }, "Money::SEPARATORS is deprecated and will be removed in v3.2.0. See Money::Currency#separator.")
-
- # @deprecated See Money::Currency#delimiter
- DELIMITERS = DeprecatedHash.new({
- "BRL" => ".",
- # Everything else defaults to ","
- }, "Money::DELIMITERS is deprecated and will be removed in Money v3.2.0. See Money::Currency#delimiter.")
-end
View
14 lib/money/deprecations.rb
@@ -7,18 +7,4 @@ class Money
def self.deprecate(message)
warn "DEPRECATION WARNING: #{message}"
end
-
-
- # Money::VariableExchangeBank is the legacy default bank
- # shipped with Money. The class has been superseded by
- # Money::Bank::VariableExchange.
- #
- # @deprecated Use Money::Bank::VariableExchange instead.
- class VariableExchangeBank < Bank::VariableExchange # :nodoc:
- # Calls +Money#deprecate+ the super.
- def initialize(*args)
- Money.deprecate "Money::VariableExchangeBank is deprecated and will be removed in v3.2.0. Use Money::Bank::VariableExchange instead."
- super
- end
- end
end
View
6 spec/bank/base_spec.rb
@@ -28,12 +28,6 @@ def setup
end
end
- describe '#exchange' do
- it 'should raise NotImplementedError' do
- lambda { @bank.exchange(100, 'USD', 'EUR') }.should raise_exception(NotImplementedError)
- end
- end
-
describe '#exchange_with' do
it 'should raise NotImplementedError' do
lambda { @bank.exchange_with(Money.new(100, 'USD'), 'EUR') }.should raise_exception(NotImplementedError)
View
90 spec/bank/variable_exchange_spec.rb
@@ -9,85 +9,6 @@
@bank = Money::Bank::VariableExchange.new
end
- describe '#exchange' do
- before :each do
- @bank.send(:set_rate, 'USD', 'EUR', 1.33)
- end
-
- it 'should accept str/str' do
- lambda{@bank.exchange(100, 'USD', 'EUR')}.should_not raise_exception
- end
-
- it 'should accept currency/str' do
- lambda{@bank.exchange(100, Money::Currency.wrap('USD'), 'EUR')}.should_not raise_exception
- end
-
- it 'should accept str/currency' do
- lambda{@bank.exchange(100, 'USD', Money::Currency.wrap('EUR'))}.should_not raise_exception
- end
-
- it 'should accept currency/currency' do
- lambda{@bank.exchange(100, Money::Currency.wrap('USD'), Money::Currency.wrap('EUR'))}.should_not raise_exception
- end
-
- it 'should exchange one currency to another' do
- @bank.exchange(100, 'USD', 'EUR').should == 133
- end
-
- it 'should truncate extra digits' do
- @bank.exchange(10, 'USD', 'EUR').should == 13
- end
-
- it 'should raise an UnknownCurrency exception when an unknown currency is requested' do
- lambda{@bank.exchange(100, 'AAA', 'BBB')}.should raise_exception(Money::Currency::UnknownCurrency)
- end
-
- it 'should raise an UnknownRate exception when an unknown rate is requested' do
- lambda{@bank.exchange(100, 'USD', 'JPY')}.should raise_exception(Money::Bank::UnknownRate)
- end
-
- it 'should round the exchanged result down' do
- @bank.add_rate("USD", "EUR", 0.788332676)
- @bank.add_rate("EUR", "YEN", 122.631477)
- @bank.exchange(10_00, "USD", "EUR").should == 788
- @bank.exchange(500_00, "EUR", "YEN").should == 6131573
- end
-
- it 'should accept a custom truncation method' do
- proc = Proc.new { |n| n.ceil }
- @bank.exchange(10, 'USD', 'EUR', &proc).should == 14
- end
-
-
- context 'sterling to euros using a rate of 1.39' do
- it 'returns the correct amount' do
- @bank.add_rate('GBP', 'EUR', 1.38)
- @bank.exchange(10000, 'GBP', 'EUR').should == 13800
- end
- end
-
- context 'dollars to euros using a rate of 0.86' do
- it 'returns the correct amount' do
- @bank.add_rate('USD', 'EUR', 0.86)
- @bank.exchange(10000, 'USD', 'EUR').should == 8600
- end
- end
-
- context 'TND to USD using a rate of 0.67138' do
- it 'returns the correct amount' do
- @bank.add_rate('TND', 'USD', 0.67138)
- @bank.exchange(1000, 'TND', 'USD').should == 67
- end
- end
-
- context 'USD to TND using a rate of 1.32862' do
- it 'returns the correct amount' do
- @bank.add_rate('USD', 'TND', 1.32862)
- @bank.exchange(1000, 'USD', 'TND').should == 13286
- end
- end
- end
-
describe '#exchange_with' do
before :each do
@bank.send(:set_rate, 'USD', 'EUR', 1.33)
@@ -286,17 +207,6 @@
@bank.add_rate('USD', 'EUR', 1.33)
end
- describe '#exchange' do
- it 'should use a stored truncation method' do
- @bank.exchange(10, 'USD', 'EUR').should == 14
- end
-
- it 'should use a custom truncation method over a stored one' do
- proc = Proc.new { |n| n.ceil + 1 }
- @bank.exchange(10, 'USD', 'EUR', &proc).should == 15
- end
- end
-
describe '#exchange_with' do
it 'should use a stored truncation method' do
@bank.exchange_with(Money.new(10, 'USD'), 'EUR').should == Money.new(14, 'EUR')
View
12 spec/deprecations_spec.rb
@@ -1,16 +1,4 @@
require "spec_helper"
describe "Money deprecations" do
-
- describe Money::VariableExchangeBank do
- it "should be deprecated" do
- Money.should_receive(:deprecate)
- Money::VariableExchangeBank.new.should_not be_nil
- end
-
- it "should extend Money::Bank::VariableExchange" do
- Money::VariableExchangeBank.new.should be_kind_of Money::Bank::VariableExchange
- end
- end
-
end
Please sign in to comment.
Something went wrong with that request. Please try again.