mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-25 04:22:28 +01:00
Rubocop fixes
This commit is contained in:
parent
cc539ebdd0
commit
40b4e39465
2
.pryrc
2
.pryrc
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Pry.config.editor = 'vim'
|
Pry.config.editor = 'vim'
|
||||||
require './config/environment'
|
require './config/environment'
|
||||||
puts "Loading #{App.env}"
|
puts "Loading #{App.env}"
|
||||||
|
1
Rakefile
1
Rakefile
@ -1,2 +1,3 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Dir.glob('lib/tasks/*.rake').each { |r| import r }
|
Dir.glob('lib/tasks/*.rake').each { |r| import r }
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
|
|
||||||
# Encapsulates app configuration
|
# Encapsulates app configuration
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative 'app'
|
require_relative 'app'
|
||||||
$LOAD_PATH << App.root.join('lib')
|
$LOAD_PATH << App.root.join('lib')
|
||||||
Dir[App.root.join('config/initializers/*.rb')].each { |f| require f }
|
Dir[App.root.join('config/initializers/*.rb')].each { |f| require f }
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'pg'
|
require 'pg'
|
||||||
require 'sequel'
|
require 'sequel'
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
job_type :rake, 'cd :path && foreman run bundle exec rake :task --silent :output'
|
job_type :rake, 'cd :path && foreman run bundle exec rake :task --silent :output'
|
||||||
|
|
||||||
every '*/15 13,14,15,16,17 * * 1-5' do
|
every '*/15 13,14,15,16,17 * * 1-5' do
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
worker_process_count = (ENV['WORKER_PROCESSES'] || 4).to_i
|
worker_process_count = (ENV['WORKER_PROCESSES'] || 4).to_i
|
||||||
|
|
||||||
preload_app true
|
preload_app true
|
||||||
|
@ -7,7 +7,7 @@ Sequel.migration do
|
|||||||
String :iso_code
|
String :iso_code
|
||||||
Float :rate
|
Float :rate
|
||||||
|
|
||||||
index [:date, :iso_code], unique: true
|
index %i[date iso_code], unique: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'oj'
|
require 'oj'
|
||||||
require 'sinatra'
|
require 'sinatra'
|
||||||
require 'rack/cors'
|
require 'rack/cors'
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Currency < Sequel::Model
|
class Currency < Sequel::Model
|
||||||
dataset_module do
|
dataset_module do
|
||||||
def recent
|
def recent
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'currency'
|
require 'currency'
|
||||||
|
|
||||||
class Quote
|
class Quote
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
namespace :db do
|
namespace :db do
|
||||||
desc 'Create db'
|
desc 'Create db'
|
||||||
task :create do
|
task :create do
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
task :environment do
|
task :environment do
|
||||||
require './config/environment'
|
require './config/environment'
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
namespace :rates do
|
namespace :rates do
|
||||||
task setup: :environment do
|
task setup: :environment do
|
||||||
require 'currency'
|
require 'currency'
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
return unless ENV['RACK_ENV'] == 'test'
|
return unless ENV['RACK_ENV'] == 'test'
|
||||||
|
|
||||||
require 'rake/testtask'
|
require 'rake/testtask'
|
||||||
@ -12,4 +13,4 @@ end
|
|||||||
|
|
||||||
RuboCop::RakeTask.new
|
RuboCop::RakeTask.new
|
||||||
|
|
||||||
task default: %w(db:migrate rates:load test rubocop)
|
task default: %w[db:migrate rates:load test rubocop]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'rack/test'
|
require 'rack/test'
|
||||||
require 'api'
|
require 'api'
|
||||||
@ -32,7 +33,7 @@ describe 'the API' do
|
|||||||
|
|
||||||
it 'filters symbols' do
|
it 'filters symbols' do
|
||||||
get '/latest?symbols=USD'
|
get '/latest?symbols=USD'
|
||||||
json['rates'].keys.must_equal %w(USD)
|
json['rates'].keys.must_equal %w[USD]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'aliases base as from' do
|
it 'aliases base as from' do
|
||||||
@ -42,7 +43,7 @@ describe 'the API' do
|
|||||||
|
|
||||||
it 'aliases symbols as to' do
|
it 'aliases symbols as to' do
|
||||||
get '/latest?to=USD'
|
get '/latest?to=USD'
|
||||||
json['rates'].keys.must_equal %w(USD)
|
json['rates'].keys.must_equal %w[USD]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns historical quotes' do
|
it 'returns historical quotes' do
|
||||||
@ -57,14 +58,14 @@ describe 'the API' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a cache control header' do
|
it 'returns a cache control header' do
|
||||||
%w(/ /latest /2012-11-20).each do |path|
|
%w[/ /latest /2012-11-20].each do |path|
|
||||||
get path
|
get path
|
||||||
headers['Cache-Control'].wont_be_nil
|
headers['Cache-Control'].wont_be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a last modified header' do
|
it 'returns a last modified header' do
|
||||||
%w(/latest /2012-11-20).each do |path|
|
%w[/latest /2012-11-20].each do |path|
|
||||||
get path
|
get path
|
||||||
headers['Last-Modified'].wont_be_nil
|
headers['Last-Modified'].wont_be_nil
|
||||||
end
|
end
|
||||||
@ -76,7 +77,7 @@ describe 'the API' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'allows cross-origin requests' do
|
it 'allows cross-origin requests' do
|
||||||
%w(/ /latest /2012-11-20).each do |path|
|
%w[/ /latest /2012-11-20].each do |path|
|
||||||
header 'Origin', '*'
|
header 'Origin', '*'
|
||||||
get path
|
get path
|
||||||
assert headers.key?('Access-Control-Allow-Methods')
|
assert headers.key?('Access-Control-Allow-Methods')
|
||||||
@ -84,7 +85,7 @@ describe 'the API' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'responds to preflight requests' do
|
it 'responds to preflight requests' do
|
||||||
%w(/ /latest /2012-11-20).each do |path|
|
%w[/ /latest /2012-11-20].each do |path|
|
||||||
header 'Origin', '*'
|
header 'Origin', '*'
|
||||||
header 'Access-Control-Request-Method', 'GET'
|
header 'Access-Control-Request-Method', 'GET'
|
||||||
header 'Access-Control-Request-Headers', 'Content-Type'
|
header 'Access-Control-Request-Headers', 'Content-Type'
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'currency'
|
require 'currency'
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'rack/test'
|
require 'rack/test'
|
||||||
require 'api'
|
require 'api'
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require './config/environment'
|
require './config/environment'
|
||||||
require 'minitest/autorun'
|
require 'minitest/autorun'
|
||||||
require 'minitest/pride'
|
require 'minitest/pride'
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
require 'quote'
|
require 'quote'
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ describe Quote do
|
|||||||
|
|
||||||
it 'casts to hash' do
|
it 'casts to hash' do
|
||||||
stub_rates do |quote|
|
stub_rates do |quote|
|
||||||
%i(base date rates).each do |key|
|
%i[base date rates].each do |key|
|
||||||
quote.to_h.keys.must_include key
|
quote.to_h.keys.must_include key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user