Upcase symbols

This commit is contained in:
Hakan Ensari 2018-09-18 12:56:11 +01:00
parent 79f1972361
commit d107134548
2 changed files with 11 additions and 1 deletions

View File

@ -16,7 +16,7 @@ class Query
end
def symbols
@params.values_at(:to, :symbols).compact.first&.split(',')
@params.values_at(:to, :symbols).compact.first&.upcase&.split(',')
end
def date

View File

@ -19,6 +19,11 @@ describe Query do
query.base.must_equal 'USD'
end
it 'upcases given base' do
query = Query.new(base: 'usd')
query.base.must_equal 'USD'
end
it 'defaults base to nothing' do
query = Query.new
query.base.must_be_nil
@ -34,6 +39,11 @@ describe Query do
query.symbols.must_equal %w[USD GBP]
end
it 'upcases given symbols' do
query = Query.new(symbols: 'usd,gbp')
query.symbols.must_equal %w[USD GBP]
end
it 'aliases symbols with to' do
query = Query.new(to: 'USD')
query.symbols.must_equal ['USD']