This file contains hidden or 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
| it "does something" do | |
| log_sql do | |
| request | |
| expect(create_call).to_not raise_exception | |
| end | |
| end |
This file contains hidden or 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 "rails_helper" | |
| require "stringio" | |
| require "json" | |
| RSpec.describe API do | |
| include Rack::Test::Methods | |
| def app | |
| API | |
| end |
This file contains hidden or 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 "amazing_print" | |
| AmazingPrint.pry! | |
| app_id = | |
| ENV["APP_ID"].presence || | |
| Rails.application.class.name.deconstantize.parameterize | |
| app_env = ENV["ENVIRONMENT"].presence || Rails.env | |
| commit_sha = ENV["GIT_COMMIT_SHA"]&.slice(0, 7) | |
| commit_sha = `git rev-parse --short HEAD`.strip unless Rails.env.production? |
This file contains hidden or 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
| class SolidQueueAliveServer | |
| def initialize(host: nil, port: nil, engine: nil, logger: nil) | |
| @host = host || "0.0.0.0" | |
| @port = port || 7433 | |
| @engine = engine || "puma" | |
| @logger = logger || Rails.logger | |
| end | |
| def run! | |
| require "rackup" |
This file contains hidden or 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 "net/http" | |
| require "json" | |
| module AzureTokenAuthentication | |
| module Config | |
| # NOTE: https://learn.microsoft.com/en-us/azure/app-service/overview-managed-identity#rest-endpoint-reference | |
| class << self | |
| # endpoint example: "http://localhost:42356/msi/token" | |
| def endpoint = ENV.fetch("IDENTITY_ENDPOINT") |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| if [ $# -ne 1 ]; then | |
| echo "Usage: $0 YYYY-MM-DD" | |
| exit 1 | |
| fi | |
| TARGET_DATE=$1 | |
| if ! [[ $TARGET_DATE =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then |
This file contains hidden or 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/bash | |
| app_name="my-heroku-app" | |
| environment="production" | |
| db_migrate_container="migrate" | |
| app_containers="web worker" | |
| app_url="https://amkisko.github.io" | |
| github_org="amkisko" | |
| github_repo="my-app" |
This file contains hidden or 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
| class DiffCoverageReporter | |
| attr_reader :coverage_file, :default_branch | |
| def initialize(file_path: "coverage/.resultset.json", default_branch: "master") | |
| @coverage_file = Rails.root.join(file_path) | |
| @default_branch = default_branch | |
| end | |
| def coverage_report | |
| JSON.parse(coverage_file.read).dig("RSpec", "coverage") | |
| end |
This file contains hidden or 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
| class SuiteErrorsReporter | |
| def self.report_errors(link_url:, link_label:, slack_webhook_url:, errors: fetch_examples_with_errors) | |
| return if errors.empty? | |
| WebMock.allow_net_connect! if defined?(WebMock) | |
| message = "Test suite failed in <#{link_url}|#{link_label}>" | |
| locations = errors.map(&:location) | |
| Net::HTTP.post( | |
| URI(slack_webhook_url), | |
| { |
This file contains hidden or 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
| class SimpleCovMerger | |
| def self.report_coverage(base_dir:, ci_project_path:, project_path:) | |
| new(base_dir: base_dir, ci_project_path: ci_project_path, project_path: project_path).merge_results | |
| end | |
| attr_reader :base_dir, :ci_project_path, :project_path | |
| def initialize(base_dir:, ci_project_path:, project_path:) | |
| @base_dir = base_dir | |
| @ci_project_path = ci_project_path |