I hereby claim:
- I am ltello on github.
- I am ltello8a (https://keybase.io/ltello8a) on keybase.
- I have a public key ASCHe4CmnZ82oB6vl7rMn4dTfXBbRVCinILS9Ef-t5PDNAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# frozen_string_literal: true | |
require "test_helper" | |
class GasSafetyRecordTest < ActiveSupport::TestCase | |
describe GasSafetyRecord do | |
let(:gas_safety_record) { GasSafetyRecord.new } | |
subject { gas_safety_record } | |
describe "Columns" do |
# frozen_string_literal: true | |
class GasSafetyRecord < ApplicationRecord | |
# Associations | |
belongs_to :installation_job, inverse_of: :gas_safety_record | |
has_many :appliances, | |
class_name: "GasSafetyRecordAppliance", | |
dependent: :destroy, | |
inverse_of: :gas_safety_record |
# frozen_string_literal: true | |
module PasswordResetable | |
extend ActiveSupport::Concern | |
included do | |
attr_reader :reset_password_token | |
end | |
# Check if the given token is valid to reset the password |
# frozen_string_literal: true | |
# @tag Identities | |
class IdentitiesController < ApplicationController | |
attr_reader :identity, :installer, :password, :token | |
before_action :create_identity, only: %i[create] | |
before_action :set_token, only: %i[change_password validate_reset_password_token] | |
before_action :set_identity, only: %i[destroy show update] | |
before_action :set_installer_identity, only: %i[change_password validate_reset_password_token password_resetable] |
describe 'Category' do | |
context '#create' do | |
before(:all) do | |
@properties = {:code => 'TST', :description => 'Test Category'} | |
@category = Category.create(@properties) | |
@same_category = Category.create(@properties) | |
end | |
context 'When right properties given' do |
# Given a list of words, return a hash with the anagram counting | |
class String | |
# Returns the associated anagram (string with the same letters sorted) | |
# Ex: "accb".anagram # => "abcc" | |
def anagram | |
split('').sort.join | |
end | |
end |
class Fixnum | |
# Returns the corresponding roman notation for numbers < 1000. Nice message otherwise. | |
def to_roman | |
return "Who knows, my friend!!" unless (1...1000) === self | |
[].tap do |result| | |
reverse_figures.each_with_index do |figure, weight| | |
result << figure.send(:to_roman_by_weight, weight) | |
end | |
end.reverse.join |
module ActionView | |
module Helpers | |
module TextHelper | |
# Modify all html <a> tags in text to show them in a new browser's tab if they are externals to | |
# the domain of the url string opts[:except_site_host] | |
def external_links_to_tabs(text, opts = {}) | |
text.gsub(A_LINK_RE) do | |
link, html_attrs = $&, $1 | |
if href_to_this_site?(link, opts[:except_site_host].to_s) |