source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | spec/rspec/tap/formatters/default_spec.rb | Ruby | mit | 19 | master | 12,361 | # frozen_string_literal: true
require 'securerandom'
RSpec.describe RSpec::TAP::Formatters::Default do
subject(:formatter) { described_class.new(report_output) }
let(:report_output) { StringIO.new }
let(:report_printer) { RSpec::TAP::Formatters::Printer.new(report_output) }
let(:report_test_stats) { RSpec::T... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | spec/rspec/tap/formatters/flat_compact_spec.rb | Ruby | mit | 19 | master | 7,338 | # frozen_string_literal: true
require 'securerandom'
RSpec.describe RSpec::TAP::Formatters::FlatCompact do
subject(:formatter) { described_class.new(report_output) }
let(:report_output) { StringIO.new }
let(:report_printer) { RSpec::TAP::Formatters::Printer.new(report_output) }
before do
formatter.insta... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | spec/rspec/tap/formatters/compact_spec.rb | Ruby | mit | 19 | master | 12,094 | # frozen_string_literal: true
require 'securerandom'
RSpec.describe RSpec::TAP::Formatters::Compact do
subject(:formatter) { described_class.new(report_output) }
let(:report_output) { StringIO.new }
let(:report_printer) { RSpec::TAP::Formatters::Printer.new(report_output) }
let(:report_test_stats) { RSpec::T... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | spec/rspec/tap/formatters/flat_spec.rb | Ruby | mit | 19 | master | 7,591 | # frozen_string_literal: true
require 'securerandom'
RSpec.describe RSpec::TAP::Formatters::Flat do
subject(:formatter) { described_class.new(report_output) }
let(:report_output) { StringIO.new }
let(:report_printer) { RSpec::TAP::Formatters::Printer.new(report_output) }
before do
formatter.instance_var... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | spec/rspec/tap/formatters/printer_spec.rb | Ruby | mit | 19 | master | 32,403 | # frozen_string_literal: true
require 'securerandom'
RSpec.shared_context 'when writing to file' do
before do
report_printer.instance_variable_set(:@write_to_file, true)
report_printer.instance_variable_set(:@display_colors, false)
end
end
RSpec.shared_context 'when not writing to file' do
before do
... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | spec/support/rspec/matchers/be_a_string_not_equal.rb | Ruby | mit | 19 | master | 523 | # frozen_string_literal: true
RSpec::Matchers.define :be_a_string_not_equal do |expected|
match do |actual|
actual.is_a?(String) && expected.is_a?(String) && actual != expected
end
description do
"a string not equal to '#{expected}'"
end
failure_message do |actual|
"expected '#{actual}' not to ... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | spec/support/rspec/matchers/be_a_string_equal.rb | Ruby | mit | 19 | master | 507 | # frozen_string_literal: true
RSpec::Matchers.define :be_a_string_equal do |expected|
match do |actual|
actual.is_a?(String) && expected.is_a?(String) && actual == expected
end
description do
"a string equal to '#{expected}'"
end
failure_message do |actual|
"expected '#{actual}' to be '#{expect... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | lib/rspec/tap/formatters.rb | Ruby | mit | 19 | master | 427 | # frozen_string_literal: true
require 'English'
require 'psych'
require_relative 'formatters/core_ext/hash'
require_relative 'formatters/core_ext/string'
require_relative 'formatters/version'
require_relative 'formatters/compact'
require_relative 'formatters/default'
require_relative 'formatters/flat'
require_relativ... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | lib/rspec/tap/formatters/compact.rb | Ruby | mit | 19 | master | 4,663 | # frozen_string_literal: true
require 'rspec/core/formatters/base_formatter'
require_relative 'printer'
require_relative 'test_stats'
module RSpec
module TAP
module Formatters
# Compact TAP formatter
class Compact < RSpec::Core::Formatters::BaseFormatter
# List of subscribed notifications
... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | lib/rspec/tap/formatters/default.rb | Ruby | mit | 19 | master | 4,730 | # frozen_string_literal: true
require 'rspec/core/formatters/base_formatter'
require_relative 'printer'
require_relative 'test_stats'
module RSpec
module TAP
module Formatters
# Default TAP formatter
class Default < RSpec::Core::Formatters::BaseFormatter
# List of subscribed notifications
... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | lib/rspec/tap/formatters/flat_compact.rb | Ruby | mit | 19 | master | 3,718 | # frozen_string_literal: true
require 'rspec/core/formatters/base_formatter'
require_relative 'printer'
require_relative 'test_stats'
module RSpec
module TAP
module Formatters
# Flat compact TAP formatter
class FlatCompact < RSpec::Core::Formatters::BaseFormatter
# List of subscribed notific... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | lib/rspec/tap/formatters/flat.rb | Ruby | mit | 19 | master | 3,761 | # frozen_string_literal: true
require 'rspec/core/formatters/base_formatter'
require_relative 'printer'
require_relative 'test_stats'
module RSpec
module TAP
module Formatters
# Flat TAP formatter
class Flat < RSpec::Core::Formatters::BaseFormatter
# List of subscribed notifications
... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | lib/rspec/tap/formatters/printer.rb | Ruby | mit | 19 | master | 14,925 | # frozen_string_literal: true
require 'rspec/core/formatters/console_codes'
require_relative 'core_ext/hash'
require_relative 'core_ext/string'
module RSpec
module TAP
module Formatters
# TAP report printer
class Printer
# Example status progress report characters
EXAMPLE_PROGRESS = ... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | lib/rspec/tap/formatters/test_stats.rb | Ruby | mit | 19 | master | 1,549 | # frozen_string_literal: true
module RSpec
module TAP
module Formatters
# Test stats calculator
class TestStats
# @!attribute
# @return [Hash<Integer, Array<Integer, 4>>] example stats
attr_reader :data
# Constructor
def initialize
@data = {}
... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | lib/rspec/tap/formatters/version.rb | Ruby | mit | 19 | master | 335 | # frozen_string_literal: true
# Namespace for the parent module.
module RSpec
# Namespace for the submodule TAP.
module TAP
# Namespace for all the formatters code.
module Formatters
# Namespace for the version.
module Version
# The current version
STRING = '0.1.0'
end
... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | lib/rspec/tap/formatters/core_ext/string.rb | Ruby | mit | 19 | master | 1,001 | # frozen_string_literal: true
# Extensions to the core String class
class String
unless method_defined?(:blank?)
# Checks whether a string is blank. A string is considered blank if it
# is either empty or contains only whitespaces.
#
# @return [Boolean] true is the string is blank, false otherwise
... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | lib/rspec/tap/formatters/core_ext/hash.rb | Ruby | mit | 19 | master | 1,293 | # frozen_string_literal: true
# Extensions to the core String class
class Hash
unless method_defined?(:compact)
# Removes nil and blank values.
# The value is either +NilClass+ or +String+.
#
# @return [Hash] compact hash
#
# @example
# { you: 0, me: nil, we: ' ' }.compact
# #=> ... |
github | avmnu-sng/rspec-tap-formatters | https://github.com/avmnu-sng/rspec-tap-formatters | resources/string_spec.rb | Ruby | mit | 19 | master | 1,177 | # frozen_string_literal: true
RSpec.describe String do
describe '#present?' do
context 'when nil' do
let(:string) { nil }
it 'returns false' do
expect(string.present?).to eq(false)
end
end
context 'when whitespaces only' do
let(:string) { ' ' }
it 'returns false... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | Gemfile | Ruby | mit | 19 | master | 1,100 | source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.2'
gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
gem 'pg', '>= 0.18', '< 2.0'
gem 'puma', '~> 4.1'
gem 'sass-rails', '>= 6'
gem 'webpacker', '~> 4.0'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.7'
gem 'bootsnap', '>= 1.... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/controllers/companies_controller.rb | Ruby | mit | 19 | master | 749 | class CompaniesController < ApplicationController
def new
@company = current_user.build_company
end
def edit
@company = current_user.company
end
def create
@company = current_user.build_company(company_params)
if @company.save
flash[:notice] = 'Empresa cadastrada com sucesso.'
re... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/controllers/applicants_controller.rb | Ruby | mit | 19 | master | 1,490 | # frozen_string_literal: true
class ApplicantsController < ApplicationController
before_action :set_position, only: [:index]
def index
@applicants = @position.applicants
respond_to do |format|
format.html
format.csv { send_data @position.applicants.as_csv }
format.zip do
UserMaile... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/controllers/positions_controller.rb | Ruby | mit | 19 | master | 1,553 | class PositionsController < ApplicationController
before_action :set_company, :set_i18n_careers, :set_i18n_contracts, except: [:public_position]
before_action :set_position, only: [:edit, :show, :update]
def index
@positions = @company.positions
end
def new
@position = @company.positions.new
end
... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/controllers/home_controller.rb | Ruby | mit | 19 | master | 230 | class HomeController < ApplicationController
def index
@q = Position.ransack(params[:q])
@positions = @q.result.page(params[:page]).per(params[:per])
@contracts = [['CLT', 0], ['PJ', 1], ['A combinar', 2]]
end
end |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/services/export_resume.rb | Ruby | mit | 19 | master | 1,284 | # frozen_string_literal: true
require 'zip'
class ExportResume
def initialize(user, position, zip_name)
@user = user
@position = position
@zip_name = zip_name
end
def generate
applicants = @position.applicants
files = []
applicants.each do |applicant|
files << save_files_on_server... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/models/brazil.rb | Ruby | mit | 19 | master | 828 | class Brazil
class << self
def states
{
'AC': 'Acre',
'AL': 'Alagoas',
'AP': 'Amapá',
'AM': 'Amazonas',
'BA': 'Bahia',
'CE': 'Ceará',
'DF': 'Distrito Federal',
'ES': 'Espírito Santo',
'GO': 'Goiás',
'MA': 'Maranhão',
'MT... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/models/applicant.rb | Ruby | mit | 19 | master | 726 | # frozen_string_literal: true
require 'csv'
class Applicant < ApplicationRecord
belongs_to :user
belongs_to :position
validates :name, :email, :phone, :resume, presence: true
has_one_attached :resume
validate :correct_resume_mime_type
def self.as_csv
attributes = %w[id name email phone]
CSV.gen... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/models/user.rb | Ruby | mit | 19 | master | 417 | class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_one :company
has_many :applicants
after_create... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/models/position.rb | Ruby | mit | 19 | master | 497 | class Position < ApplicationRecord
belongs_to :company
enum career: [:developer, :business_inteligence, :information_technology, :design,
:product, :technology, :other]
enum contract: [:clt, :pj, :match]
has_rich_text :description
validates :name, :career, :contract, :city, :state, :summary, ... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/helpers/flash_helper.rb | Ruby | mit | 19 | master | 419 | module FlashHelper
def show_message(flash)
if flash[:success].present?
icon = 'success'
title = 'Tudo certo!'
message = flash[:success]
elsif flash[:error].present?
icon = 'error'
title = 'Erro!'
message = flash[:error]
else
icon = 'success'
title = 'Alerta!... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/helpers/companies_helper.rb | Ruby | mit | 19 | master | 224 | module CompaniesHelper
def dynamic_url_company
if current_user.company.present? && current_user.company.try(:id).present?
edit_company_path(current_user.company)
else
new_company_path
end
end
end |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/helpers/positions_helper.rb | Ruby | mit | 19 | master | 590 | module PositionsHelper
def text_position(position)
"A empresa #{position.company.name} em #{position.city} está com a vaga de #{position.name}. Veja mais detalhes no nosso mural! #{url_position(position)}"
end
def url_position(position)
public_position_url(position.slug)
end
def career_name(career)
... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/queries/user_applicant_query.rb | Ruby | mit | 19 | master | 326 | class UserApplicantQuery
attr_reader :user_id, :position_id
def initialize(user_id, position_id)
@user_id = user_id
@position_id = position_id
end
def call
user_have_applicant?
end
private
def user_have_applicant?
Applicant.where(user_id: user_id, position_id: position_id).present?
en... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | app/mailers/user_mailer.rb | Ruby | mit | 19 | master | 627 | # frozen_string_literal: true
class UserMailer < ApplicationMailer
def welcome(user)
@user = user
mail to: @user.email, subject: 'Bem vindo ao Open Vagas'
end
def export_resume(user_id, position_id)
@user = User.find(user_id)
position = Position.find(position_id)
zip_name = "#{SecureRandom.a... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | spec/spec_helper.rb | Ruby | mit | 19 | master | 3,969 | ENV['RAILS_ENV'] = 'test'
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | spec/rails_helper.rb | Ruby | mit | 19 | master | 1,020 | require 'spec_helper'
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../config/environment', __dir__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
require 'database_cleaner/active_record'
... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | spec/factories/companies.rb | Ruby | mit | 19 | master | 499 | FactoryBot.define do
factory :company do
name { Faker::Company.name }
url { Faker::Internet.url }
user
trait :with_logo do
after :build do |company|
file = File.open(Rails.root.join('spec/fixtures/images/logo-tech.jpeg'))
company.logo.attach(
io: Rack::Test::UploadedFi... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | spec/factories/positions.rb | Ruby | mit | 19 | master | 239 | FactoryBot.define do
factory :position do
name { Faker::Name.name }
career { 2 }
contract { 2 }
city { Faker::Address.city }
state { Faker::Address.state }
summary { Faker::Lorem.paragraph }
company
end
end |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | spec/models/position_spec.rb | Ruby | mit | 19 | master | 406 | require 'rails_helper'
RSpec.describe Position, type: :model do
let(:user) { create(:user) }
let(:company) { create(:company, :with_logo, user: user) }
it 'is valid with valid attributes' do
position = build(:position, company: company)
expect(position).to be_valid
end
it 'is not valid without attr... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | spec/requests/home_request_spec.rb | Ruby | mit | 19 | master | 215 | require 'rails_helper'
RSpec.describe "Home", type: :request do
describe "GET /index" do
it "returns http success" do
get root_url
expect(response).to have_http_status(:success)
end
end
end |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | config/application.rb | Ruby | mit | 19 | master | 997 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
def set_locate_configs_and_timezone
config.time_zone = 'Brasilia'
config.i18n.load_path += Dir[Rails.root.join('config', 'lo... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | config/routes.rb | Ruby | mit | 19 | master | 543 | # frozen_string_literal: true
require 'sidekiq/web'
Rails.application.routes.draw do
mount Sidekiq::Web => '/sidekiq'
resources :companies, only: [:new, :edit, :update, :create]
resources :positions do
resources :applicants, only: [:index]
end
resources :applicants, only: [:new, :create]
devise_for :us... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | config/initializers/devise.rb | Ruby | mit | 19 | master | 15,190 | # frozen_string_literal: true
# Assuming you have not yet modified this file, each configuration option below
# is set to its default value. Note that some are commented out while others
# are not: uncommented lines are intended to protect your configuration from
# breaking changes in upgrades (i.e., in the event that... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | config/initializers/simple_form_bootstrap.rb | Ruby | mit | 19 | master | 20,134 | # frozen_string_literal: true
# Please do not make direct changes to this file!
# This generator is maintained by the community around simple_form-bootstrap:
# https://github.com/rafaelfranca/simple_form-bootstrap
# All future development, tests, and organization should happen there.
# Background history: https://gith... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | config/initializers/simple_form.rb | Ruby | mit | 19 | master | 6,904 | # frozen_string_literal: true
#
# Uncomment this and change the path if necessary to include your own
# components.
# See https://github.com/heartcombo/simple_form#custom-components to know
# more about custom components.
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
#
# Use this setup block t... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | config/environments/development.rb | Ruby | mit | 19 | master | 2,500 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | config/environments/production.rb | Ruby | mit | 19 | master | 5,011 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | db/schema.rb | Ruby | mit | 19 | master | 4,183 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `rails
#... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | db/seeds.rb | Ruby | mit | 19 | master | 1,526 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | db/migrate/20201220010504_create_applicants.rb | Ruby | mit | 19 | master | 324 | class CreateApplicants < ActiveRecord::Migration[6.0]
def change
create_table :applicants do |t|
t.string :name
t.string :email
t.string :phone
t.references :user, null: false, foreign_key: true
t.references :position, null: false, foreign_key: true
t.timestamps
end
end
... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | db/migrate/20210109022221_create_action_text_tables.action_text.rb | Ruby | mit | 19 | master | 490 | # This migration comes from action_text (originally 20180528164100)
class CreateActionTextTables < ActiveRecord::Migration[6.0]
def change
create_table :action_text_rich_texts do |t|
t.string :name, null: false
t.text :body, size: :long
t.references :record, null: false, polymorphic: t... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | db/migrate/20201220010325_create_positions.rb | Ruby | mit | 19 | master | 410 | class CreatePositions < ActiveRecord::Migration[6.0]
def change
create_table :positions do |t|
t.string :name
t.integer :career
t.integer :contract
t.boolean :remote
t.string :city
t.string :state
t.text :summary
t.text :description
t.boolean :publish
t.... |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | db/migrate/20201220010046_create_companies.rb | Ruby | mit | 19 | master | 237 | class CreateCompanies < ActiveRecord::Migration[6.0]
def change
create_table :companies do |t|
t.string :name
t.string :url
t.references :user, null: false, foreign_key: true
t.timestamps
end
end
end |
github | frankyston/openvagas | https://github.com/frankyston/openvagas | db/migrate/20201220005703_devise_create_users.rb | Ruby | mit | 19 | master | 1,400 | # frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[6.0]
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.stri... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | Gemfile | Ruby | mit | 19 | main | 263 | # frozen_string_literal: true
source "https://rubygems.org"
gemspec
gem "minitest", "~> 5.0", group: :test
gem "simplecov", require: false, group: :test
gem "rake", "~> 13.0"
gem "sorbet", group: :development
gem "sorbet-runtime"
gem "tapioca", require: false |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | Rakefile | Ruby | mit | 19 | main | 245 | # typed: ignore
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
task default: %i[test] |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | rubrik.gemspec | Ruby | mit | 19 | main | 1,435 | # frozen_string_literal: true
require_relative "lib/rubrik/version"
Gem::Specification.new do |spec|
spec.name = "rubrik"
spec.version = Rubrik::VERSION
spec.authors = ["Tomás Coêlho"]
spec.email = ["tomascoelho6@gmail.com"]
spec.summary = "Sign PDFs digitally in pure Ruby"
spec.description = "Sign PDFs ... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | test/test_helper.rb | Ruby | mit | 19 | main | 502 | # frozen_string_literal: true
# typed: true
require "simplecov"
SimpleCov.start do
add_filter "/test/"
enable_coverage :branch
end
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "rubrik"
require "minitest/autorun"
require "minitest/pride"
class Rubrik::Test < Minitest::Test
make_my_diffs_prett... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | test/rubrik/document_test.rb | Ruby | mit | 19 | main | 6,815 | # frozen_string_literal: true
# typed: true
require "test_helper"
module Rubrik
class DocumentTest < Rubrik::Test
def test_initialize_document_without_interactive_form
# Arrange
input = File.open(SupportPDF["without_interactive_form"], "rb")
# Act
document = Document.new(input)
#... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | test/rubrik/sign_test.rb | Ruby | mit | 19 | main | 6,849 | # frozen_string_literal: true
# typed: true
require "test_helper"
module Rubrik
class SignTest < Rubrik::Test
def test_document_with_interactive_form
# Arrange
input_pdf = File.open(SupportPDF["with_interactive_form"], "rb")
output_pdf = StringIO.new
certificate_file = File.open("test/su... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | test/rubrik/pkcs7_signature_test.rb | Ruby | mit | 19 | main | 739 | # frozen_string_literal: true
# typed: true
require "test_helper"
class Rubrik::PKCS7SignatureTest < Rubrik::Test
def test_signature_generation
# Arrange
certificate_file = File.open("test/support/demo_cert.pem", "rb")
private_key = OpenSSL::PKey::RSA.new(certificate_file, "")
certificate_file.rewi... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | test/rubrik/document/serialize_object_test.rb | Ruby | mit | 19 | main | 3,546 | # frozen_string_literal: true
# typed: true
require "test_helper"
class Rubrik::Document
class SerializeObjectTest < Rubrik::Test
def test_hash_serialization
# Arrange
hash = {Test: {Key: :Value, Array: []}}
# Act
result = SerializeObject[hash]
# Assert
assert_equal("<</Tes... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | lib/rubrik.rb | Ruby | mit | 19 | main | 392 | # typed: true
# frozen_string_literal: true
require "sorbet-runtime"
require "pdf-reader"
module Rubrik
class Error < StandardError; end
end
require_relative "rubrik/document"
require_relative "rubrik/document/increment"
require_relative "rubrik/document/serialize_object"
require_relative "rubrik/fill_signature"
r... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | lib/rubrik/sign.rb | Ruby | mit | 19 | main | 848 | # typed: true
# frozen_string_literal: true
module Rubrik
module Sign
extend T::Sig
sig {params(
input: T.any(File, Tempfile, StringIO),
output: T.any(File, Tempfile, StringIO),
private_key: OpenSSL::PKey::RSA,
certificate: OpenSSL::X509::Certificate,
c... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | lib/rubrik/document.rb | Ruby | mit | 19 | main | 4,955 | # typed: true
# frozen_string_literal: true
require "securerandom"
module Rubrik
class Document
extend T::Sig
CONTENTS_PLACEHOLDER = Object.new.freeze
BYTE_RANGE_PLACEHOLDER = Object.new.freeze
SIGNATURE_SIZE = 8_192
sig {returns(T.any(File, Tempfile, StringIO))}
attr_accessor :io
sig... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | lib/rubrik/fill_signature.rb | Ruby | mit | 19 | main | 1,944 | # typed: true
# frozen_string_literal: true
module Rubrik
module FillSignature
extend T::Sig
extend self
include Kernel
sig {params(
io: T.any(File, StringIO, Tempfile),
signature_value_ref: PDF::Reader::Reference,
private_key: OpenSSL::PKey::RSA,
certificate:... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | lib/rubrik/pkcs7_signature.rb | Ruby | mit | 19 | main | 620 | # typed: true
# frozen_string_literal: true
require "openssl"
module Rubrik
module PKCS7Signature
extend T::Sig
extend self
OPEN_SSL_FLAGS = OpenSSL::PKCS7::DETACHED | OpenSSL::PKCS7::BINARY
sig {params(
data: String,
private_key: OpenSSL::PKey::RSA,
certificate: OpenSSL::X... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | lib/rubrik/document/increment.rb | Ruby | mit | 19 | main | 1,981 | # typed: true
# frozen_string_literal: true
module Rubrik
class Document
module Increment
include Kernel
extend T::Sig
extend self
sig {params(document: Rubrik::Document, io: T.any(File, Tempfile, StringIO)).void}
def call(document, io:)
document.io.rewind
IO.copy_... |
github | tomascco/rubrik | https://github.com/tomascco/rubrik | lib/rubrik/document/serialize_object.rb | Ruby | mit | 19 | main | 2,507 | # typed: true
# frozen_string_literal: true
module Rubrik
class Document
module SerializeObject
include Kernel
extend T::Sig
extend self
sig {params(obj: T.untyped).returns(String)}
def [](obj)
case obj
when Hash
serialized_objs = obj.flatten.map { |e| Ser... |
github | dcadenas/gmail_sender | https://github.com/dcadenas/gmail_sender | gmail_sender.gemspec | Ruby | mit | 19 | master | 1,942 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{gmail_sender}
s.version = "1.1.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :requi... |
github | dcadenas/gmail_sender | https://github.com/dcadenas/gmail_sender | Rakefile | Ruby | mit | 19 | master | 214 | require 'rubygems'
require 'rake'
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
task :default => :test |
github | dcadenas/gmail_sender | https://github.com/dcadenas/gmail_sender | test/test_helper.rb | Ruby | mit | 19 | master | 227 | require 'rubygems'
require 'expectations'
require 'file_test_helper'
include FileTestHelper
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'gmail_sender' |
github | dcadenas/gmail_sender | https://github.com/dcadenas/gmail_sender | test/message_stream_writer_test.rb | Ruby | mit | 19 | master | 2,023 | require 'test_helper'
Expectations do
expect "From: sender@gmail.com\nTo: to@gmail.com\nSubject: subject\nMIME-Version: 1.0\nContent-Type: text/plain\n\nbody\n" do
string_io = StringIO.new
message_stream_writer = GmailSender::MessageStreamWriter.new("sender@gmail.com")
message_stream_writer.write(string_... |
github | dcadenas/gmail_sender | https://github.com/dcadenas/gmail_sender | test/gmail_sender_test.rb | Ruby | mit | 19 | master | 1,615 | require 'test_helper'
class FakedNetSMTP
def initialize(*args)
end
def start(*args)
yield self
end
def enable_starttls
end
def open_message_stream(*args)
stream = StringIO.new
yield stream
@@sent_email = stream.string
end
def self.sent_email
@@sent_email
end
end
Expectation... |
github | dcadenas/gmail_sender | https://github.com/dcadenas/gmail_sender | lib/tls_smtp_patch.rb | Ruby | mit | 19 | master | 206 | require "net/smtp"
unless Net::SMTP.instance_methods.include?(:enable_starttls)
require "tlsmail"
class Net::SMTP
def enable_starttls
enable_tls(OpenSSL::SSL::VERIFY_NONE)
end
end
end |
github | dcadenas/gmail_sender | https://github.com/dcadenas/gmail_sender | lib/gmail_sender.rb | Ruby | mit | 19 | master | 1,290 | require 'base64'
require 'tls_smtp_patch'
require 'gmail_sender/message_stream_writer'
require 'gmail_sender/utils'
require 'gmail_sender/error'
class GmailSender
def initialize(user_or_email, password, net_smtp_class = Net::SMTP, message_stream_writer_class = MessageStreamWriter)
user, domain = user_or_email.sp... |
github | dcadenas/gmail_sender | https://github.com/dcadenas/gmail_sender | lib/gmail_sender/utils.rb | Ruby | mit | 19 | master | 263 | class GmailSender
module Utils
def self.blank?(string_or_array)
string_or_array.nil? ||
string_or_array.respond_to?(:strip) && string_or_array.strip == "" ||
string_or_array.respond_to?(:empty?) && string_or_array.empty?
end
end
end |
github | dcadenas/gmail_sender | https://github.com/dcadenas/gmail_sender | lib/gmail_sender/message_stream_writer.rb | Ruby | mit | 19 | master | 1,819 | class GmailSender
class MessageStreamWriter
ATTACHMENT_READ_PORTION = 150360 # you may change this, but must be multiply to 3
attr_reader :attachments
def initialize(sender_email)
@sender_email = sender_email
@attachments = []
@boundary = rand(2**256).to_s(16)
end
def write(ms... |
github | amatsuda/activerecord-refinements | https://github.com/amatsuda/activerecord-refinements | activerecord-refinements.gemspec | Ruby | mit | 19 | master | 985 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'activerecord-refinements/version'
Gem::Specification.new do |gem|
gem.name = "activerecord-refinements"
gem.version = Activerecord::Refinements::VERSION
gem.authors... |
github | amatsuda/activerecord-refinements | https://github.com/amatsuda/activerecord-refinements | lib/activerecord-refinements.rb | Ruby | mit | 19 | master | 208 | require 'activerecord-refinements/version'
require 'active_record'
require 'active_record/refinements'
module ActiveRecord
module QueryMethods
prepend ActiveRecord::Refinements::QueryMethods
end
end |
github | amatsuda/activerecord-refinements | https://github.com/amatsuda/activerecord-refinements | lib/active_record/refinements.rb | Ruby | mit | 19 | master | 1,045 | module ActiveRecord
module Refinements
module WhereBlockSyntax
refine Symbol do
%i[== != =~ > >= < <=].each do |op|
define_method(op) {|val| [self, op, val] }
end
end
end
module QueryMethods
def where(opts = nil, *rest, &block)
if block
col, o... |
github | amatsuda/activerecord-refinements | https://github.com/amatsuda/activerecord-refinements | spec/spec_helper.rb | Ruby | mit | 19 | master | 704 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'rspec/autorun'
Bundler.require
require 'active_record'
ActiveRecord::Base.configurations = {'test' => {:adapter => 'sqlite3', :database => ':memory:'}}
ActiveRecord::Base.establish_c... |
github | amatsuda/activerecord-refinements | https://github.com/amatsuda/activerecord-refinements | spec/where_spec.rb | Ruby | mit | 19 | master | 1,335 | require 'spec_helper'
describe 'Symbol enhancements' do
describe '#==' do
subject { User.where { :name == 'matz' }.to_sql }
it { should =~ /WHERE "users"."name" = 'matz'/ }
end
describe '#!=' do
subject { User.where { :name != 'nobu' }.to_sql }
it { should =~ /WHERE \("users"."name" != 'nobu'\)/... |
github | fnando/rails-env | https://github.com/fnando/rails-env | rails-env.gemspec | Ruby | mit | 19 | main | 1,689 | # frozen_string_literal: true
require "./lib/rails-env/version"
Gem::Specification.new do |spec|
spec.name = "rails-env"
spec.version = RailsEnv::VERSION
spec.authors = ["Nando Vieira"]
spec.email = ["me@fnando.com"]
spec.metadata = {"rubygems_mfa_required" => "true"}
spec.summary = "Avoid envir... |
github | fnando/rails-env | https://github.com/fnando/rails-env | lib/rails-env.rb | Ruby | mit | 19 | main | 3,438 | # frozen_string_literal: true
require "rails-env/version"
module Rails
class << self
env_method = instance_method(:env=)
remove_method(:env=)
define_method :env= do |env|
env_method.bind_call(self, env)
Rails.env.extend(RailsEnv::Extension)
end
end
end
module RailsEnv
def self.depr... |
github | fnando/rails-env | https://github.com/fnando/rails-env | test/test_helper.rb | Ruby | mit | 19 | main | 627 | # frozen_string_literal: true
require "simplecov"
SimpleCov.start
ENV["RAILS_ENV"] = "test"
ENV["DATABASE_URL"] = "sqlite3::memory:"
require "bundler/setup"
require "rails"
require "active_record/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "action_controller/railtie"
require "activ... |
github | fnando/rails-env | https://github.com/fnando/rails-env | test/unit/rails_env_test.rb | Ruby | mit | 19 | main | 900 | # frozen_string_literal: true
require "test_helper"
class Callable
attr_accessor :configuration
def to_proc
callable = self
lambda do |_app|
callable.configuration = config
end
end
end
class RailsEnvTest < Minitest::Test
test "runs block when env matches" do
block = Callable.new
R... |
github | fnando/rails-env | https://github.com/fnando/rails-env | test/unit/rails_test.rb | Ruby | mit | 19 | main | 3,380 | # frozen_string_literal: true
require "test_helper"
class ConfigPropagationTest < Minitest::Test
setup do
Rails.env.on(:test) do
config.action_mailer.default_url_options = {host: "localhost", port: 3000}
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | ost-sdk-ruby.gemspec | Ruby | mit | 19 | develop | 928 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ost-sdk-ruby/version'
Gem::Specification.new do |spec|
spec.name = "ost-sdk-ruby"
spec.version = OSTSdk::VERSION
spec.authors = ['OST.com Inc.']
spec.email =... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/config.rb | Ruby | mit | 19 | develop | 993 | class Config
API_BASE_URL = ENV['OST_KIT_API_ENDPOINT']
API_KEY = ENV['OST_KIT_API_KEY']
API_SECRET = ENV['OST_KIT_API_SECRET']
OST_SDK = OSTSdk::Saas::Services.new({api_key: API_KEY, api_secret: API_SECRET,
api_base_url: API_BASE_URL, config: {timeout: 60}, api_spec: fa... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas.rb | Ruby | mit | 19 | develop | 655 | require_relative 'saas/services'
require_relative 'saas/base'
require_relative 'saas/balance'
require_relative 'saas/chains'
require_relative 'saas/device_managers'
require_relative 'saas/devices'
require_relative 'saas/manifest'
require_relative 'saas/price_points'
require_relative 'saas/recovery_owners'
require_relat... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/util.rb | Ruby | mit | 19 | develop | 245 | require_relative 'util/common_validator'
require_relative 'util/api_credentials'
require_relative 'util/custom_error_response'
require_relative 'util/http_helper'
require_relative 'util/services_helper'
module OSTSdk
module Util
end
end |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/util/custom_error_response.rb | Ruby | mit | 19 | develop | 1,292 | module OSTSdk
module Util
class CustomErrorResponse
def initialize(params)
@code = params[:code]
@internal_id = params[:internal_id]
@msg = params[:msg]
@error_data = params[:error_data]
end
def external_error_response
error_response({
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/util/api_credentials.rb | Ruby | mit | 19 | develop | 470 | module OSTSdk
module Util
class APICredentials
# Initialize
#
# Arguments:
# api_key: (String)
# api_secret: (String)
#
def initialize(api_key, api_secret)
@api_key = api_key
@api_secret = api_secret
end
# Returns:
# api_key: (S... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/util/common_validator.rb | Ruby | mit | 19 | develop | 1,072 | module OSTSdk
module Util
class CommonValidator
REGEX_FOR_UUID = /\A[0-9a-z\.\-]+\z/i
# Check for numeric-ness of an input
#
# Arguments:
# object: (Float)
#
# Returns:
# Boolean
#
def self.is_numeric?(object)
true if Float(object) rescue... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/util/http_helper.rb | Ruby | mit | 19 | develop | 8,755 | module OSTSdk
module Util
class HTTPHelper
require "uri"
require "open-uri"
require "openssl"
require "net/http"
require "json"
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/util/services_helper.rb | Ruby | mit | 19 | develop | 996 | module OSTSdk
module Util
module ServicesHelper
# Wrapper Method which could be used to execute business logic
# Error handling code wraps execution of business logic
#
# Arguments:
# err_code: (String)
# err_message: (String)
# block: (Proc)
#
# Retu... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/price_points.rb | Ruby | mit | 19 | develop | 649 | module OSTSdk
module Saas
class PricePoints < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
super
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/sessions.rb | Ruby | mit | 19 | develop | 907 | module OSTSdk
module Saas
class Sessions < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
super
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/rules.rb | Ruby | mit | 19 | develop | 608 | module OSTSdk
module Saas
class Rules < OSTSdk::Saas::Base
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
# config: (Hash)
#
def initialize(params)
... |
github | ostdotcom/ost-sdk-ruby | https://github.com/ostdotcom/ost-sdk-ruby | lib/ost-sdk-ruby/saas/services.rb | Ruby | mit | 19 | develop | 1,082 | module OSTSdk
module Saas
class Services
attr_reader :services
# Initialize
#
# Arguments:
# api_base_url: (String)
# api_key: (String)
# api_secret: (String)
# api_spec: (Boolean)
#
def initialize(params)
fail 'missing API Base URL'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.