mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-10-29 23:32:35 +01:00
cfbb4ac4ac
I'm moving my company's server to a private location now that I have sold the domain. While prepping for this, I've done some cleanup and also threw in changes I had lingering on my hard drive. - Run a single database query instead of two - Fold the gem into the app and use Ox instead of REXML - Simplify error handling logic - Relax throttling
57 lines
1.1 KiB
Ruby
57 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative 'helper'
|
|
require 'query'
|
|
|
|
describe Query do
|
|
it 'returns given amount' do
|
|
query = Query.new(amount: '100')
|
|
query.amount.must_equal 100.0
|
|
end
|
|
|
|
it 'defaults amount to nothin' do
|
|
query = Query.new
|
|
query.amount.must_be_nil
|
|
end
|
|
|
|
it 'returns 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
|
|
end
|
|
|
|
it 'aliases base as from' do
|
|
query = Query.new(from: 'USD')
|
|
query.base.must_equal 'USD'
|
|
end
|
|
|
|
it 'returns given symbols' do
|
|
query = Query.new(symbols: 'USD,GBP')
|
|
query.symbols.must_equal %w[USD GBP]
|
|
end
|
|
|
|
it 'aliases symbols to to' do
|
|
query = Query.new(to: 'USD')
|
|
query.symbols.must_equal ['USD']
|
|
end
|
|
|
|
it 'defaults symbols to nothing' do
|
|
query = Query.new
|
|
query.symbols.must_be_nil
|
|
end
|
|
|
|
it 'returns given date' do
|
|
query = Query.new(date: '2014-01-01')
|
|
query.date.must_equal '2014-01-01'
|
|
end
|
|
|
|
it 'defaults date to nothing' do
|
|
query = Query.new
|
|
query.date.must_be_nil
|
|
end
|
|
end
|