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
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/controllers/admin/applications_controller.rb
Ruby
mit
49
master
2,363
#This controller manages the selection process of applications for a specific event (if selection #process is being handled by this app), only accessable for admins. module Admin class ApplicationsController < ApplicationController before_action :require_admin before_action :set_locale_to_english before_a...
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/controllers/admin/tags_controller.rb
Ruby
mit
49
master
915
#Handles Tag management - Event organizers can choose from a pool of existing tags #and add them to their event. Only Admins can access the tags_index_view to add/delete/modify tags. module Admin class TagsController < ApplicationController before_action :require_admin before_action :set_locale_to_english ...
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/controllers/admin/events_controller.rb
Ruby
mit
49
master
4,883
require "report_exporter" module Admin class EventsController < ApplicationController before_action :require_admin before_action :set_locale_to_english before_action :get_event, only: [:show, :edit, :update, :approve, :destroy] before_action :set_s3_direct_post, only: [:edit, :update] before_acti...
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/models/event.rb
Ruby
mit
49
master
4,601
class Event < ApplicationRecord include ApplicationProcess::Validator belongs_to :organizer, class_name: 'User' has_many :applications, dependent: :destroy has_many :taggings has_many :tags, through: :taggings has_many :tweets has_many :tag_taggings, through: :tags, source: 'taggings' has_many :interes...
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/models/application.rb
Ruby
mit
49
master
856
class Application < ApplicationRecord belongs_to :event belongs_to :user validates :name, :attendee_info_1, :attendee_info_2, presence: true, unless: :skip_validation validates :email, presence: true, confirmation: true, format: { with: /.+@.+\..+/ }, unless: :skip_validation validates :email_confirmation, pr...
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/models/application_process.rb
Ruby
mit
49
master
2,442
module ApplicationProcess class Choice ALLOWED = %w{ selection_by_travis selection_by_organizer application_by_organizer } attr_reader :value def initialize(value) @value = value end def valid? ALLOWED.include?(value) end def selection_by_travis? value == 'selection_b...
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/models/user.rb
Ruby
mit
49
master
580
class User < ApplicationRecord include Clearance::User has_many :events, foreign_key: :organizer_id, dependent: :nullify has_many :applications, foreign_key: :applicant_id has_many :taggings has_many :tags, through: :taggings, foreign_key: :user_id attr_accessor :new_password attr_accessor :password_opt...
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/models/tag.rb
Ruby
mit
49
master
205
class Tag < ActiveRecord::Base has_many :taggings has_many :events, through: :taggings has_many :users, through: :taggings belongs_to :category validates :name, :category_id, presence: true end
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/mailers/applicant_mailer.rb
Ruby
mit
49
master
379
class ApplicantMailer < ApplicationMailer def application_received(application) @application = application mail(to: @application.email, subject: "Your application for #{@application.event.name}.") end def deadline_reminder(application) @application = application mail(to: @application.email, subject: "#{@a...
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/mailers/organizer_mailer.rb
Ruby
mit
49
master
483
class OrganizerMailer < ApplicationMailer def submitted_event(event) @event = event mail(to: @event.organizer_email, subject: 'You submitted a new event.') end def approved_event(event) @event = event mail(to: @event.organizer_email, subject: 'Your event has been approved.') end def ticket_c...
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/mailers/user_notifications_mailer.rb
Ruby
mit
49
master
353
class UserNotificationsMailer < ApplicationMailer def new_local_event(event, user) @event = event @user = user mail(to: @user.email, subject: 'A new event in your country!') end def new_field_specific_event(event, user) @event = event @user = user mail(to: @user.email, subject: 'A new eve...
github
rubymonsters/diversity_ticketing
https://github.com/rubymonsters/diversity_ticketing
app/mailers/admin_mailer.rb
Ruby
mit
49
master
444
class AdminMailer < ApplicationMailer def submitted_event(event, email) @event = event mail(to: email, subject: 'A new event has been submitted.') end def upcoming_event_deadline(event, email) @event = event mail(to: email, subject: "#{@event.name} deadline is approaching.") end def passed_e...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
arbolito.gemspec
Ruby
mit
49
master
1,058
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'arbolito/version' Gem::Specification.new do |s| s.name = "arbolito" s.version = Arbolito::VERSION s.authors = ["jvillarejo"] s.email = ["contact@jonvillage.co...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
lib/arbolito.rb
Ruby
mit
49
master
1,434
require 'bigdecimal' require 'time' require 'arbolito/currency/quote' require 'arbolito/currency/rate' require 'arbolito/currency/non_expirable_rate' require 'arbolito/store/memory' require 'arbolito/exchange/yahoo_finance' require 'arbolito/exchange/alpha_vantage' require "arbolito/version" module Arbolito class <...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
lib/arbolito/store/memory.rb
Ruby
mit
49
master
616
module Arbolito module Store class Memory class << self def mutex @@mutex ||= Mutex.new end def add(rate) synchronize do hash[rate.quote.to_hash] = rate end end def fetch(quote) synchronize do hash[qu...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
lib/arbolito/currency/rate.rb
Ruby
mit
49
master
758
module Arbolito module Currency class Rate attr_reader :quote, :price, :rated_at def initialize(price, from_to_hash, rated_at = Time.now) @quote = Quote.new(from_to_hash) @price = BigDecimal.new(price) @rated_at = rated_at end def convert(money) @price * B...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
lib/arbolito/currency/quote.rb
Ruby
mit
49
master
612
module Arbolito module Currency class Quote attr_reader :from, :to def initialize(hash) raise ArgumentError.new('You must specify 1 quote rate') if hash.size != 1 @from = hash.keys.first.to_sym @to = hash.values.first.to_sym end def to_hash { @from...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
lib/arbolito/exchange/alpha_vantage.rb
Ruby
mit
49
master
1,140
require 'net/http' require 'json' module Arbolito module Exchange class AlphaVantage BaseURL = 'https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=%s&to_currency=%s&apikey=%s'.freeze attr_reader :api_key def initialize(api_key) @api_key = api_key end...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
lib/arbolito/exchange/yahoo_finance.rb
Ruby
mit
49
master
1,049
require 'net/http' module Arbolito module Exchange class YahooFinance class << self # DEPRECATED Yahoo Finance is not supported anymore by Yahoo so use Alpha Vantage API def find_current_rate(quote) warn "[DEPRECATION] Yahoo Finance `find_current_rate` is deprecated. Please use A...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
spec/arbolito_spec.rb
Ruby
mit
49
master
2,855
require 'spec_helper' describe Arbolito do it 'has a version number' do expect(Arbolito::VERSION).not_to be nil end describe 'adding a currency rate manually' do before { Arbolito.add_currency_rate(BigDecimal.new(15), 'USD' => 'ARS') } it 'lets you add fixed currency quotes' do expect(Arbol...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
spec/spec_helper.rb
Ruby
mit
49
master
262
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'arbolito' require 'pry' Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f } RSpec.configure do |config| config.after(:each) do Arbolito::Store::Memory.clear end end
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
spec/exchange/yahoo_finance_spec.rb
Ruby
mit
49
master
600
require 'spec_helper' describe Arbolito::Exchange::YahooFinance do subject(:exchange) { Arbolito::Exchange::YahooFinance } let(:quote) { Arbolito::Currency::Quote.new('USD' => 'UYU') } # DEPRECATED Yahoo doesn't support anymore Yahoo Finance so use Alpha Vantage instead it 'gives you the current rate of the...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
spec/exchange/alpha_vantage_spec.rb
Ruby
mit
49
master
573
require 'spec_helper' describe Arbolito::Exchange::AlphaVantage do let(:api_key) { ENV['ALPHA_VANTAGE_API_KEY'] } subject(:exchange) { Arbolito::Exchange::AlphaVantage.new(api_key) } let(:quote) { Arbolito::Currency::Quote.new('USD' => 'UYU') } it 'gives you the current rate of the desired currency conversi...
github
jvillarejo/arbolito
https://github.com/jvillarejo/arbolito
spec/support/exchange_spy.rb
Ruby
mit
49
master
300
module Arbolito module Exchange class Spy attr_reader :times_called def initialize @times_called = 0 end def find_current_rate(quote) @times_called += 1 Arbolito::Currency::Rate.new(BigDecimal.new(15), quote.to_hash) end end end end
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
multi_tenant_support.gemspec
Ruby
mit
49
main
957
require_relative "lib/multi_tenant_support/version" Gem::Specification.new do |spec| spec.name = "multi-tenant-support" spec.version = MultiTenantSupport::VERSION spec.authors = ["Hopper Gee"] spec.email = ["hopper.gee@hey.com"] spec.homepage = "https://github.com/hoppergee/multi-tena...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
Rakefile
Ruby
mit
49
main
210
require "bundler/setup" require "bundler/gem_tasks" require "rake/testtask" Rake::TestTask.new(:test) do |t| t.libs << 'test' t.pattern = 'test/**/*_test.rb' t.verbose = false end task default: :test
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
Gemfile
Ruby
mit
49
main
735
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } if rails_version = ENV['RAILS_VERSION'] gem 'rails', rails_version end # Specify your gem's dependencies in multi_tenant_support.gemspec. gemspec group :development do gem 'sqlite3' gem 'pg' end # To use a debugger g...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support_test.rb
Ruby
mit
49
main
7,583
require "test_helper" class MultiTenantSupportTest < ActiveSupport::TestCase test "it has a version number" do assert MultiTenantSupport::VERSION end test ".configure" do MultiTenantSupport.configure do model do |config| config.tenant_account_class_name = 'Account' config.tenant_ac...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/test_helper.rb
Ruby
mit
49
main
1,440
# Configure Rails Environment ENV["RAILS_ENV"] = "test" ENV['MIGRATION_VESRION'] ||= '6.1' require "minitest/autorun" require "minitest/focus" require_relative "../test/dummy/config/environment" ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] require "rails/test_help" ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/spec_helper.rb
Ruby
mit
49
main
462
# Configure Rails Environment ENV["RAILS_ENV"] = "test" require_relative "../test/dummy/config/environment" ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] ActiveRecord::Migration.maintain_test_schema! require "rspec/rails" require 'multi_tenant_support/rspec' RSpec....
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/app/controllers/application_controller.rb
Ruby
mit
49
main
221
class ApplicationController < ActionController::Base before_action :super_admin_redirect private def super_admin_redirect return if current_tenant_account redirect_to super_admin_dashboard_path end end
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/app/controllers/users_controller.rb
Ruby
mit
49
main
244
class UsersController < ApplicationController def index end def new end def edit end def create redirect_to users_path end def update redirect_to users_path end def destroy redirect_to users_path end end
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/app/controllers/super_admin/application_controller.rb
Ruby
mit
49
main
329
module SuperAdmin class ApplicationController < ::ApplicationController before_action :allow_read_across_tenant skip_before_action :super_admin_redirect skip_before_action :set_current_tenant_account private def allow_read_across_tenant MultiTenantSupport.allow_read_across_tenant end ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/app/controllers/api/users_controller.rb
Ruby
mit
49
main
263
module Api class UsersController < ApplicationController def index render json: { tenant: current_tenant_account.name, domain: current_tenant_account.domain, subdomain: current_tenant_account.subdomain } end end end
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/app/controllers/api/application_controller.rb
Ruby
mit
49
main
443
module Api class ApplicationController < ActionController::API before_action :check_current_tenant rescue_from MultiTenantSupport::MissingTenantError, with: :handle_error private def check_current_tenant raise MultiTenantSupport::MissingTenantError.new("Wrong domain or subdomain") unless curre...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/config/routes.rb
Ruby
mit
49
main
313
Rails.application.routes.draw do # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html resources :users resources :user_tags namespace :super_admin do resource :dashboard, controller: :dashboard end namespace :api do resources :users end end
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/config/application.rb
Ruby
mit
49
main
677
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) require "multi-tenant-support" module Dummy class Application < Rails::Application config.load_defaults Rails::VERSION::ST...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/config/environments/development.rb
Ruby
mit
49
main
2,861
require "active_support/core_ext/integer/time" 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 any time # it changes. This slows down response time but is perfect for developme...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/config/environments/test.rb
Ruby
mit
49
main
2,338
require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data the...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/config/initializers/assets.rb
Ruby
mit
49
main
578
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. if Gem::Version.new(Rails.version) < Gem::Version.new("7.0.0.alpha2") Rails.application.config.assets.version = '1.0' end # Add additional assets to the asset load path. # Rails.a...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/config/initializers/sidekiq.rb
Ruby
mit
49
main
260
require 'sidekiq' Sidekiq.configure_server do |config| config.redis = { url: "redis://#{ENV['REDIS_HOST'] || '127.0.0.1'}:6379/0" } end Sidekiq.configure_client do |config| config.redis = { url: "redis://#{ENV['REDIS_HOST'] || '127.0.0.1'}:6379/0" } end
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/config/initializers/multi_tenant_support.rb
Ruby
mit
49
main
445
MultiTenantSupport.configure do |config| model do |config| config.tenant_account_class_name = 'Account' config.tenant_account_primary_key = :id end controller do |config| config.current_tenant_account_method = :current_tenant_account end app do |config| config.excluded_subdomains = ['www'] ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/db/migrate/20210924125633_create_users.rb
Ruby
mit
49
main
280
class CreateUsers < ActiveRecord::Migration[ENV['MIGRATION_VESRION']] def change create_table :users do |t| t.string :name t.string :email, null: false t.integer :account_id t.timestamps end add_index :users, :email, unique: true end end
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/db/migrate/20211003061731_create_user_tags.rb
Ruby
mit
49
main
249
class CreateUserTags < ActiveRecord::Migration[ENV['MIGRATION_VESRION']] def change create_table :user_tags do |t| t.belongs_to :account, null: false t.belongs_to :user t.belongs_to :tag t.timestamps end end end
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/db/migrate/20210924125351_create_accounts.rb
Ruby
mit
49
main
255
class CreateAccounts < ActiveRecord::Migration[ENV['MIGRATION_VESRION']] def change create_table :accounts do |t| t.column :name, :string t.column :subdomain, :string t.column :domain, :string t.timestamps end end end
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/dummy/db/migrate/20211003103228_create_countries.rb
Ruby
mit
49
main
202
class CreateCountries < ActiveRecord::Migration[ENV['MIGRATION_VESRION']] def change create_table :countries do |t| t.string :code t.string :name t.timestamps end end end
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/current_tenant_test.rb
Ruby
mit
49
main
1,024
require "test_helper" class CurrentTenantTest < ActionDispatch::IntegrationTest setup do @amazon = accounts(:amazon) end test "find correct tenant with subdomain" do host! "amazon.example.com" get users_path assert_response :success assert_select "#id", text: @amazon.id.to_s assert_sel...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/current_tenant_protect_during_integration_test.rb
Ruby
mit
49
main
1,412
require 'test_helper' class CurrentTenantProtectDuringIntegrationTeste < ActionDispatch::IntegrationTest setup do host! "amazon.example.com" MultiTenantSupport::Current.tenant_account = accounts(:amazon) end test "curren tenant won't reset by get" do assert_equal accounts(:amazon), MultiTenantSuppo...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/current_tenant_for_action_controller_api_test.rb
Ruby
mit
49
main
1,106
require 'test_helper' class CurrentTenantForActionControllerApiTest < ActionDispatch::IntegrationTest setup do @amazon = accounts(:amazon) end test "find correct tenant with subdomain" do host! "amazon.example.com" get api_users_path assert_response :success assert_json_response({ "t...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/customize_current_tenant_finder_test.rb
Ruby
mit
49
main
993
require "test_helper" class CustomizeCurrentTenantFinderTest < ActionDispatch::IntegrationTest setup do @amazon = accounts(:amazon) end test "find correct tenant with subdomain" do host! "amazon.example.com" get user_tags_path assert_redirected_to super_admin_dashboard_path follow_redirect...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/current_tenant_protect_during_integration_test_spec.rb
Ruby
mit
49
main
1,426
require_relative "../spec_helper" RSpec.describe "Current tenant protect during integration test", type: :request do before do host! "amazon.example.com" MultiTenantSupport::Current.tenant_account = accounts(:amazon) end it "get won't reset current tenant" do expect(MultiTenantSupport.current_tenan...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/sidekiq_test.rb
Ruby
mit
49
main
3,287
require 'test_helper' require 'sidekiq' require 'sidekiq/testing' require 'multi_tenant_support/sidekiq' class SidekiqIntegrationTest < ActiveSupport::TestCase class UserNameUpdateWorker include Sidekiq::Worker def perform(user_id) user = User.find(user_id) user.update(name: user.name + " UPDATE...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/sidekiq_adapter/perform_later_test.rb
Ruby
mit
49
main
2,751
require 'test_helper' require 'sidekiq' require 'sidekiq/testing' module TestActiveJob module SidekiqAdapter class PeroformLaterTest < ActiveSupport::TestCase setup do MultiTenantSupport.under_tenant(accounts(:amazon)) do @bezos = users(:bezos) end end teardown do ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/sidekiq_adapter/perform_now_test.rb
Ruby
mit
49
main
1,373
require 'test_helper' module TestActiveJob module SidekiqAdapter class PeroformNowTest < ActiveSupport::TestCase test 'update succes update user when tenant account match' do under_tenant(amazon) do assert_no_changes 'MultiTenantSupport.current_tenant' do UserNameUpdateJob.pe...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/sidekiq_adapter/preconfigured_perform_later_test.rb
Ruby
mit
49
main
2,558
require 'test_helper' require 'sidekiq' require 'sidekiq/testing' module TestActiveJob module SidekiqAdapter class PreconfiguredPeroformLaterTest < ActiveSupport::TestCase teardown do Sidekiq::RetrySet.new.clear end test 'update succes update user when tenant account match' do ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/sidekiq_adapter/preconfigured_perform_now_test.rb
Ruby
mit
49
main
1,479
require 'test_helper' module TestActiveJob module SidekiqAdapter class PreconfiguredPeroformNowTest < ActiveSupport::TestCase test 'update succes update user when tenant account match' do under_tenant(amazon) do assert_no_changes 'MultiTenantSupport.current_tenant' do UserNam...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/async_adapter/perform_now_test.rb
Ruby
mit
49
main
1,531
require 'test_helper' module TestActiveJob module AsycnAdapter class PerformNowTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :async end end test 'update succes update user ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/async_adapter/perform_later_test.rb
Ruby
mit
49
main
1,929
require 'test_helper' module TestActiveJob module AsycnAdapter class PerformLaterTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :async end end test 'update succes update use...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/async_adapter/preconfigured_perform_later_test.rb
Ruby
mit
49
main
2,035
require 'test_helper' module TestActiveJob module AsycnAdapter class PreconfiguredPerformLaterTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :async end end test 'update succ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/async_adapter/preconfigured_perform_now_test.rb
Ruby
mit
49
main
1,637
require 'test_helper' module TestActiveJob module AsycnAdapter class PreconfiguredPerformNowTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :async end end test 'update succes...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/inline_adapter/perform_now_test.rb
Ruby
mit
49
main
1,533
require 'test_helper' module TestActiveJob module InlineAdapter class PerformNowTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :inline end end test 'update succes update use...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/inline_adapter/preconfigured_perform_later_test.rb
Ruby
mit
49
main
2,037
require 'test_helper' module TestActiveJob module InlineAdapter class PreconfiguredPerformLaterTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :inline end end test 'update su...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/inline_adapter/preconfigured_perform_now_test.rb
Ruby
mit
49
main
1,639
require 'test_helper' module TestActiveJob module InlineAdapter class PreconfiguredPerformNowTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :inline end end test 'update succ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/inline_adapter/perform_later_test.rb
Ruby
mit
49
main
1,931
require 'test_helper' module TestActiveJob module InlineAdapter class PerformLaterTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :inline end end test 'update succes update u...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/test_adapter/preconfigured_perform_now_test.rb
Ruby
mit
49
main
1,635
require 'test_helper' module TestActiveJob module TestAdapter class PreconfiguredPerformNowTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :test end end test 'update succes u...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/test_adapter/perform_now_test.rb
Ruby
mit
49
main
1,529
require 'test_helper' module TestActiveJob module TestAdapter class PerformNowTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :test end end test 'update succes update user wh...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/test_adapter/perform_later_test.rb
Ruby
mit
49
main
1,927
require 'test_helper' module TestActiveJob module TestAdapter class PerformLaterTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :test end end test 'update succes update user ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/integration/active_job/test_adapter/preconfigured_perform_later_test.rb
Ruby
mit
49
main
2,033
require 'test_helper' module TestActiveJob module TestAdapter class PreconfiguredPerformLaterTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do Rails.application.configure do config.active_job.queue_adapter = :test end end test 'update succes...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/support/dsl.rb
Ruby
mit
49
main
1,654
module MultiTenantSupport module DSL def within_a_request_of(tenant_account, &block) if tenant_account.is_a?(Symbol) raise "Unkown tenant" unless tenant_account == super_admin as_super_admin do yield end else under_tenant tenant_account do yield ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/support/asserts.rb
Ruby
mit
49
main
595
module MultiTenantSupport module Asserts def multi_attempt_assert(failure_message) attempt = 0 success = false loop do sleep 0.5 success = yield attempt += 1 break if success break if attempt >= 4 end assert success, failure_message e...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/support/sidekiq_jobs_manager.rb
Ruby
mit
49
main
2,469
# frozen_string_literal: true require "sidekiq/api" require "sidekiq/testing" Sidekiq::Testing.disable! require "sidekiq/util" class SidekiqJobsManager include Sidekiq::Util include Singleton def setup ActiveJob::Base.queue_adapter = :sidekiq unless can_run? puts "Cannot run integration tests f...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/sidekiq_test.rb
Ruby
mit
49
main
1,152
require 'test_helper' require 'sidekiq' require 'multi_tenant_support/sidekiq' class MultiTenantSupport::SidekiqTest < ActiveSupport::TestCase test "Client success set current tenant id to msg" do msg = {} MultiTenantSupport::Sidekiq::Client.new.call(nil, msg, nil, nil) {} assert msg["multi_tenant_suppo...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/counter_test.rb
Ruby
mit
49
main
1,412
require 'test_helper' class MultiTenantSupport::ModelConcern::BelongsToTenant_CounterTest < ActiveSupport::TestCase test ".count - won't raise error on missing tenant when allow read across tenant" do MultiTenantSupport.allow_read_across_tenant do assert_equal 3, User.count end end test ".count -...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/unscoped_test.rb
Ruby
mit
49
main
1,317
require 'test_helper' class MultiTenantSupport::ModelConcern::BelongsToTenant_UnscopedTest < ActiveSupport::TestCase test ".unscoped - won't scope other tenants' records when disallow read across tenant (default) and current tenant exits" do MultiTenantSupport.under_tenant accounts(:amazon) do assert_equa...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/default_scope_setup_test.rb
Ruby
mit
49
main
1,448
require 'test_helper' class MultiTenantSupport::ModelConcern::BelongsToTenant_DefaultScopeSetupTest < ActiveSupport::TestCase setup do MultiTenantSupport.turn_on_full_protection end test 'set default scope to under current tenant' do MultiTenantSupport.under_tenant accounts(:amazon) do assert_equ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/load_test.rb
Ruby
mit
49
main
1,804
require 'test_helper' class MultiTenantSupport::ModelConcern::BelongsToTenant_LoadTest < ActiveSupport::TestCase test 'bezos can only initialize under amazon' do MultiTenantSupport.under_tenant accounts(:amazon) do users(:bezos).reload end MultiTenantSupport.under_tenant accounts(:facebook) do ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/finder_test.rb
Ruby
mit
49
main
1,154
require 'test_helper' class MultiTenantSupport::ModelConcern::BelongsToTenant_FinderTest < ActiveSupport::TestCase test "won't raise error on missing tenant when all read across tennat" do allow_read_across_tenant do refute User.first.nil? refute User.last.nil? refute User.where(name: 'Jeff Be...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/build_association_test.rb
Ruby
mit
49
main
636
require 'test_helper' class MultiTenantSupport::ModelConcern::BelongsToTenant_BuildAssociationTest < ActiveSupport::TestCase test 'bezos.account is amazon' do MultiTenantSupport.under_tenant accounts(:amazon) do assert_equal accounts(:amazon), users(:bezos).account end end test 'zuck.account is f...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/new_test.rb
Ruby
mit
49
main
1,480
require 'test_helper' class MultiTenantSupport::ModelConcern::BelongsToTenant_NewTest < ActiveSupport::TestCase test ".new - auto set tenant account on new" do MultiTenantSupport.under_tenant accounts(:amazon) do kate = User.new(name: 'kate') assert_equal accounts(:amazon), kate.account end en...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/tenant_account_cannot_be_nil_test.rb
Ruby
mit
49
main
2,064
require 'test_helper' class MultiTenantSupport::ModelConcern::BelongsToTenant_TenantAccountCannotBeNil < ActiveSupport::TestCase test "raise error when assign nil to account" do MultiTenantSupport.under_tenant(accounts(:amazon)) do assert_raise(MultiTenantSupport::NilTenantError) { users(:bezos).account =...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/readonly_tenant_account_test.rb
Ruby
mit
49
main
2,184
require 'test_helper' class MultiTenantSupport::ModelConcern::BelongsToTenant_ReadonlyTenantAccountTest < ActiveSupport::TestCase test "raise error when assign user.account" do MultiTenantSupport.under_tenant accounts(:amazon) do assert_raise(MultiTenantSupport::ImmutableTenantError) { users(:bezos).accou...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/update_column_test.rb
Ruby
mit
49
main
1,648
require 'test_helper' class ModelUpdateColumnProtectTest < ActiveSupport::TestCase #### # #update_column #### test "can update_column by tenant" do within_a_request_of amazon do assert_update_column bezos end end test "cannot update_column when tenant is missing" do turn_on_full_pr...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/save_without_validate_test.rb
Ruby
mit
49
main
1,535
require 'test_helper' class ModelUpdateBySaveWithoutValidateProtectTest < ActiveSupport::TestCase #### # #save(validate: false) #### test "can save by tenant" do within_a_request_of amazon do assert_save bezos end end test "cannot save when tenant is missing" do turn_on_full_protec...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/update_test.rb
Ruby
mit
49
main
3,086
require 'test_helper' class ModelUpdateProtectTest < ActiveSupport::TestCase #### # #update #### test "can update by tenant" do within_a_request_of amazon do assert_update bezos end end test "cannot update when tenant is missing" do turn_on_full_protection do missing_tenant d...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/save_test.rb
Ruby
mit
49
main
2,656
require 'test_helper' class ModelUpdateBySaveProtectTest < ActiveSupport::TestCase #### # #save #### test "can save by tenant" do within_a_request_of amazon do assert_save bezos end end test "cannot save when tenant is missing" do turn_on_full_protection do missing_tenant do ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/update_all_on_batch_test.rb
Ruby
mit
49
main
1,433
require 'test_helper' class ModelUpdateAllOnBatchProtectTest < ActiveSupport::TestCase #### # #update_all #### test "can update_all by tenant" do within_a_request_of amazon do assert_update_all affect: 1 end end test "cannot update_all when tenant is missing" do turn_on_full_protec...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/update_attribute_test.rb
Ruby
mit
49
main
1,702
require 'test_helper' class ModelUpdateAttributeProtectTest < ActiveSupport::TestCase #### # #update_attribute #### test "can update_attribute by tenant" do within_a_request_of amazon do assert_update_attribute bezos end end test "cannot update_attribute when tenant is missing" do ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/update_all_test.rb
Ruby
mit
49
main
1,494
require 'test_helper' class ModelUpdateAllProtectTest < ActiveSupport::TestCase #### # #update_all #### test "can update_all by tenant" do within_a_request_of amazon do assert_update_all affect: 1 end end test "cannot update_all when tenant is missing" do turn_on_full_protection do...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/upsert_all_test.rb
Ruby
mit
49
main
3,370
require 'test_helper' class ModelUpsertAllProtectTest < ActiveSupport::TestCase #### # .upsert_all #### test "will not protect upsert_all when call under the tenant" do within_a_request_of amazon do assert_not_protect_upsert_all with_warn: "[WARNING] You are using upsert_all(or upsert) which may upd...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/update_all_on_global_records_test.rb
Ruby
mit
49
main
1,394
require 'test_helper' class ModelUpdateAllOnGlobalRecordsProtectTest < ActiveSupport::TestCase #### # #update_all on global records #### test "can update_all global records by tenant" do within_a_request_of amazon do assert_update_all_on_global_records affect: 2 end end test "can updat...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/update_columns_test.rb
Ruby
mit
49
main
1,664
require 'test_helper' class ModelUpdateColumnsProtectTest < ActiveSupport::TestCase #### # #update_columns #### test "can update_columns by tenant" do within_a_request_of amazon do assert_update_columns bezos end end test "cannot update_columns when tenant is missing" do turn_on_fu...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/upsert_test.rb
Ruby
mit
49
main
3,389
require 'test_helper' class ModelUpsertProtectTest < ActiveSupport::TestCase #### # .upsert #### test "will not protect upsert when call under the tenant" do within_a_request_of amazon do assert_not_protect_upsert with_warn: "[WARNING] You are using upsert_all(or upsert) which may update records acr...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/update/save_after_write_attribute_test.rb
Ruby
mit
49
main
1,545
require 'test_helper' class ModelUpdateBySaveAfterWriteAttributeProtectTest < ActiveSupport::TestCase #### # #save after #write_attribute #### test "can save by tenant" do within_a_request_of amazon do assert_save bezos end end test "cannot save when tenant is missing" do turn_on_f...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/delete/delete_on_class_test.rb
Ruby
mit
49
main
1,549
require 'test_helper' class ModelDeleteOnClassProtectTest < ActiveSupport::TestCase #### # .delete #### test "can delete by tenant" do within_a_request_of amazon do assert_delete bezos end end test "cannot delete when tenant is missing" do turn_on_full_protection do missing_t...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/delete/delete_all_on_collection_test.rb
Ruby
mit
49
main
1,565
require 'test_helper' class ModelDeleteAllOnCollectionProtectTest < ActiveSupport::TestCase #### # .delete_all #### test "can only delete records under the tenant" do within_a_request_of amazon do assert_delete_all(-1) end end test "fail to delete when tenant is missing" do turn_on_ful...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/delete/delete_on_collection_test.rb
Ruby
mit
49
main
1,495
require 'test_helper' class ModelDeleteOnCollectionProtectTest < ActiveSupport::TestCase #### # #delete #### test "can delete by tenant" do within_a_request_of amazon do assert_delete bezos end end test "cannot delete when tenant is missing" do turn_on_full_protection do miss...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/delete/delete_all_on_global_records_test.rb
Ruby
mit
49
main
1,309
require 'test_helper' class ModelDeleteAllOnGlobalRecordsProtectTest < ActiveSupport::TestCase #### # .delete_all on global records like account, tag, country ... #### test "can delete_all global records by a tenant" do within_a_request_of amazon do assert_delete_all_on_global_records(-3) end ...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/delete/delete_all_test.rb
Ruby
mit
49
main
1,327
require 'test_helper' class ModelDeleteAllProtectTest < ActiveSupport::TestCase #### # .delete_all #### test "can only delete records under the tenant" do within_a_request_of amazon do assert_delete_all(-1) end end test "fail to delete when tenant is missing" do turn_on_full_protection...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/delete/destroy_test.rb
Ruby
mit
49
main
2,793
require 'test_helper' class ModelDestroyProtectTest < ActiveSupport::TestCase #### # #destroy #### test "can destroy by tenant" do within_a_request_of amazon do assert_destroy bezos end end test "cannot destroy when tenant is missing" do turn_on_full_protection do missing_ten...
github
hoppergee/multi-tenant-support
https://github.com/hoppergee/multi-tenant-support
test/multi_tenant_support/concern/model_concern/belongs_to_tenant/delete/delete_test.rb
Ruby
mit
49
main
1,439
require 'test_helper' class ModelDeleteProtectTest < ActiveSupport::TestCase #### # #delete #### test "can delete by tenant" do within_a_request_of amazon do assert_delete bezos end end test "cannot delete when tenant is missing" do turn_on_full_protection do missing_tenant d...