This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec 5>&1 | |
androidTestResult=$(adb shell "am instrument -w \ | |
com.jordifierro.androidbase.presentation.test/\ | |
com.jordifierro.androidbase.presentation.TestMockerRunner ; printf \"$?\"" \ | |
| tee /dev/fd/5) | |
exitCode=$(printf "%s" "$androidTestResult" | tail -1) | |
if [ "$exitCode" != "0" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: android | |
env: | |
global: | |
- ADB_INSTALL_TIMEOUT=8 | |
android: | |
components: | |
- tools | |
- platform-tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
module Api::V1::Concerns | |
module VersionExpirationHandler | |
extend ActiveSupport::Concern | |
included do | |
before_action :check_expiration! | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Api::V1::Concerns | |
module Internationalizator | |
extend ActiveSupport::Concern | |
included do | |
before_action :set_locale | |
end | |
def set_locale | |
I18n.locale = extract_locale_from_accept_language_header || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Api::V1::Concerns | |
module ErrorHandler | |
extend ActiveSupport::Concern | |
included do | |
rescue_from ActiveRecord::RecordNotFound, with: :not_found | |
end | |
def render_error(message, status) | |
status_code = Rack::Utils::SYMBOL_TO_STATUS_CODE[status] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Api::V1::Concerns | |
module Authenticator | |
extend ActiveSupport::Concern | |
included do | |
before_action :auth_with_token! | |
end | |
def current_user | |
@current_user ||= User.find_by(auth_token: request.headers['Authorization']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
module Api::V1 | |
describe Concerns::Authenticator, type: :controller do | |
controller(ApiController) do | |
def fake_current_user | |
render json: current_user | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Api::V1 | |
class ApiController < ApplicationController | |
include Concerns::Authenticator | |
include Concerns::ErrorHandler | |
include Concerns::VersionExpirationHandler | |
include Concerns::Internationalizator | |
end | |
end |