Skip to content

Commit

Permalink
Revert "Add finance/stock generators (faker-ruby#2146)"
Browse files Browse the repository at this point in the history
This reverts commit 20c7afc.
  • Loading branch information
droznyk authored Oct 23, 2020
1 parent e811ffc commit f3342f4
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 94 deletions.
5 changes: 0 additions & 5 deletions doc/default/finance.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,4 @@ Faker::Finance.credit_card(:mastercard, :visa) #=> "4448-8934-1277-7195"
Faker::Finance.vat_number #=> "BR38.395.329/2471-83"
Faker::Finance.vat_number(country: 'DE') #=> "DE593306671"
Faker::Finance.vat_number(country: 'ZA') #=> "ZA79494416181"

# Random ticker
Faker::Finance.ticker #=> "AMZN"
## Supported: NASDAQ, NYSE
Faker::Finance.ticker('NASDAQ') #=> "GOOG"
```
21 changes: 0 additions & 21 deletions lib/faker/default/finance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ class Finance < Base
diners_club jcb switch solo dankort
maestro forbrugsforeningen laser].freeze

MARKET_LIST = %i[nyse nasdaq].freeze

class << self
##
# Produces a random credit card number.
Expand Down Expand Up @@ -65,25 +63,6 @@ def vat_number(legacy_country = NOT_GIVEN, country: 'BR')
def vat_number_keys
translate('faker.finance.vat_number').keys
end

##
# Returns a randomly-selected stock ticker from a specified market.
#
# @param markets [String] The name of the market to choose the ticker from (e.g. NYSE, NASDAQ)
# @return [String]
#
# @example
# Faker::Finance.ticker #=> 'AMZN'
# Faker::Finance.vat_number('NASDAQ') #=> 'GOOG'
#
# @faker.version next
def ticker(*markets)
markets = MARKET_LIST if markets.empty?
market = sample(markets)
fetch("finance.ticker.#{market}")
rescue I18n::MissingTranslationData
raise ArgumentError, "Could not find market named #{market}"
end
end
end
end
53 changes: 0 additions & 53 deletions lib/locales/en/finance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,56 +111,3 @@ en:
ZA:
- "ZA##########"
- "ZA###########"
ticker:
nasdaq:
- MSFT
- AAPL
- AMZN
- GOOG
- FB
- INTC
- CSCO
- CMCSA
- PEP
- ADBE
- NVDA
- NFLX
- PYPL
- COST
- AMGN
- AVGO
- TXN
- CHTR
- SBUX
- QCOM
- GILD
- MDLZ
- FISV
- BKNG
- INTU
nyse:
- XOM
- WFC
- JNJ
- GE
- NVX
- WMT
- JPM
- PG
- TM
- PFE
- CVX
- BABA
- VZ
- BUD
- ORCL
- DIS
- KO
- HSBC
- T
- BAC
- C
- MRK
- V
- BRK.B
- MA
15 changes: 0 additions & 15 deletions test/faker/default/test_faker_finance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,4 @@ def test_vat_number_with_valid_params
def test_south_african_vat_number
assert_match(/\AZA\d{10,11}\z/, Faker::Finance.vat_number(country: 'ZA'))
end

def test_ticker
assert Faker::Finance.ticker.match(/\w+/)
end

def test_ticker_with_invalid_params
assert_raise ArgumentError do
Faker::Finance.ticker(Faker::Lorem.word)
end
end

def test_ticker_with_valid_params
ticker_return = Faker::Finance.ticker('nyse')
assert Faker::Base.fetch_all('finance.ticker.nyse').join(', ').include?(ticker_return)
end
end

0 comments on commit f3342f4

Please sign in to comment.