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
| VCR.use_cassette 'qbo/send/job/create_entities_multi_employee', record: :none do | |
| perform_enqueued_jobs do | |
| ProcessImportFileJob.perform_now(import_file.id) | |
| 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
| class Account < ApplicationRecord | |
| # ...... | |
| validates :name, presence: true, uniqueness: { case_sensitive: false } validates :name, presence: true, uniqueness: { case_sensitive: false } | |
| def create(user:) | |
| account_groups.create(user: user) |
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
| ENV['RAILS_ENV'] ||= 'test' | |
| require_relative '../config/environment' | |
| require 'rails/test_help' | |
| require 'capybara/rails' | |
| require 'capybara/minitest' | |
| require_relative 'helpers/session' | |
| require_relative 'helpers/screenshot' | |
| Capybara.asset_host = 'http://127.0.0.1:3000' |
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
| # sm- prefixed Heroicons are solid so use 'fill-current' to color | |
| inline_svg_tag 'icons/sm-user.svg', class: "fill-current h-5 w-5 text-red-400" | |
| # md- prefixed Heroicons are outlined so use 'stroke-current' to color | |
| inline_svg_tag 'icons/md-plus-circle.svg', class: "stroke-current h-4 w-5 text-green-400" |
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
| # Use this setup block to configure all options available in SimpleForm. | |
| require_relative '../../app/helpers/tailwind_helper' | |
| SimpleForm.setup do |config| | |
| config.error_notification_class = 'alert alert-danger' | |
| config.button_class = 'btn btn-default' | |
| config.boolean_label_class = nil | |
| include TailwindHelper | |
| config.wrappers :vertical_form, tag: 'div', class: "mt-6", error_class: 'has-error' do |b| |
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
| <%= render 'devise/shared/form_shell', captured: capture { %> | |
| <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> | |
| <div class="field"> | |
| <%= f.label :email, class: tw_label %> | |
| <%= tw_form_field_wrap f.email_field :email, autofocus: true, autocomplete: "email", class: tw_field %> | |
| </div> | |
| <div class="field"> | |
| <%= f.label :password, class: tw_label %> |
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
| <%= render 'devise/shared/form_shell', captured: capture { %> | |
| <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> | |
| <%= render "devise/shared/error_messages", resource: resource %> | |
| <div> | |
| <%= f.label :email, class: tw_label %> | |
| <%= tw_form_field_wrap f.email_field :email, autocomplete: "email", required: true, autofocus: true, class: tw_field %> | |
| </div> | |
| <%= f.fields_for :account, f.object.account || Account.new do |a| %> |
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
| function go-base { | |
| url=$1 | |
| echo $url | |
| shift | |
| args=$@ | |
| params="$(ruby -r cgi -e 'puts CGI.escape(ARGV[0])' "$args")" | |
| url=$(printf $url "$params") | |
| cmd="w3m \"$url\"" | |
| eval $cmd | |
| } |
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
| module Qbo | |
| module OAuth2 | |
| # gist id => a2c270ae5c5008326aae16c03a3b810b | |
| def self.renew!(q) | |
| cl = client | |
| cl.refresh_token = q.refresh_token | |
| if resp = cl.access_token! | |
| attrs = { access_token: resp.access_token, refresh_token: resp.refresh_token }.merge(expires_in) | |
| q.update!(attrs) |