Skip to content

Instantly share code, notes, and snippets.

module FFaker
# :nocov:
module LoremJA
require 'ya_lorem_ja'
extend ::FFaker::ModuleUtils
module_function
Lorem = YaLoremJa::Lorem.new
FactoryBot.define do
# @example Build :user as
# class Foo::User < ActiveType::Record[User]; end
#
# FactoryBot.build(:user, :typed, as: Foo::User)
trait :typed do
transient do
as { nil }
end
@mitsuru
mitsuru / report_coverage
Created April 25, 2022 14:38
Attach simplecov coverage report to github status
#!/usr/bin/env bash
set -e
curl -s -H "Circle-Token: $CIRCLE_API_TOKEN" "https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/$CIRCLE_BUILD_NUM/artifacts" > tmp/.artifacts.json
COV_URL=`cat tmp/.artifacts.json | jq -r 'map(select(.["path"] == "coverage/index.html")) | .[].url'`
PERCENTAGE_LINE=`cat coverage/.last_run.json | jq '.result.line'`
PERCENTAGE_BRANCH=`cat coverage/.last_run.json | jq '.result.branch'`
COV_DESC="$PERCENTAGE_LINE% covered (branch: $PERCENTAGE_BRANCH%)"