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 "set" | |
DEV_ENV = ".env.development" | |
ENC_ENV = "config/vars-staging.enc.env" | |
def vars_from_file(file) | |
File.readlines(file) | |
.map(&:strip) | |
.reject { |line| line.empty? || line.start_with?("#") } | |
.map { |line| line.split("=", 2).first } |
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
# sanity check in CI that enforces parity between your plain .env.* files and the encrypted config/vars-staging.enc.env (SOPS). | |
# If a new variable is introduced locally but missing in the encrypted file, the check should fail on PR. | |
#!/usr/bin/env bash | |
set -euo pipefail | |
# Files to compare | |
DEV_ENV=".env.development" | |
ENC_ENV="config/vars-staging.enc.env" |
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
def credentials_json | |
{ | |
type: "service_account", | |
project_id: "deployment-info", | |
private_key_id: ENV.fetch("GOOGLE_PRIVATE_KEY_ID", nil), | |
private_key: ENV.fetch("GOOGLE_PRIVATE_KEY", nil), | |
client_email: "sheets-api-service-worker@deployment-info.iam.gserviceaccount.com", | |
client_id: ENV.fetch("GOOGLE_CLIENT_ID", nil), | |
auth_uri: "https://accounts.google.com/o/oauth2/auth", | |
token_uri: "https://oauth2.googleapis.com/token", |
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
[ | |
{ | |
"Date": "2022-01-01 00:00:00", | |
"#Available Spaces Left": 10, | |
"Quarter Number": 1, | |
"#Month Number": 1, | |
"Month Name": "January", | |
"Month of Quarter": 1, | |
"#Week of Month": 1, | |
"Day of Month Number": 1, |
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
name: Test Pull Request | |
on: | |
pull_request: | |
jobs: | |
test: | |
services: | |
db: | |
image: postgres:13.8-alpine | |
ports: |
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' | |
RSpec.describe Mutations::CancelContract, type: :request do | |
describe '#resolve' do | |
let(:customer) { create(:customer) } | |
let(:mutation) { described_class.new(object: nil, context: { current_customer: customer }) } | |
let(:args) do | |
{ | |
some_argument: "some_value" | |
} |
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' | |
RSpec.describe Mutations::CancelContract, type: :request do | |
describe '#resolve' do | |
let(:customer) { create(:customer) } | |
let(:mutation) { described_class.new(object: nil, context: { current_customer: customer }) } | |
let(:args) do | |
{ | |
some_argument: "some_value" | |
} |
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
def create_missed_customers_production | |
require "csv" | |
inexistent_lead = [] | |
correct_lead_data = [] | |
incorrect_lead_data = [] | |
headers = ["email", "uuid", "result"] | |
csv_file_path = Rails.root.join("tmp", "customer_uuids.csv") | |
csv_file = File.open(csv_file_path) | |
uuids = CSV.read(csv_file, col_sep: ";", liberal_parsing: true) |