repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/requirements.rb
spec/factories/requirements.rb
# frozen_string_literal: true # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :requirement do id { generate(:unique_id) } contact_name 'Adam Bray' description 'You must attend a training session with Adam before using '\ 'this equipment.' conta...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/_sequences.rb
spec/factories/_sequences.rb
# frozen_string_literal: true FactoryGirl.define do sequence :name do |n| "Name#{n}" end sequence :serial do |n| "FLKJDSF#{n}" end sequence :sort_order do |n| n end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/equipment_models_controller_spec.rb
spec/controllers/equipment_models_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' describe EquipmentModelsController, type: :controller do before(:each) { mock_app_config(requests_affect_availability: false) } it_behaves_like 'calendarable', EquipmentModel USER_ROLES = %i[admin user].freeze describe 'GET index' do shared_examples_fo...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/equipment_items_controller_spec.rb
spec/controllers/equipment_items_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' describe EquipmentItemsController, type: :controller do before(:each) { mock_app_config } it_behaves_like 'calendarable', EquipmentItem describe 'GET index' do context 'with admin user' do before { mock_user_sign_in(UserMock.new(:admin)) } d...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/import_users_controller_spec.rb
spec/controllers/import_users_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' shared_examples_for 'successful upload' do |filename| before do file = fixture_file_upload(filename, 'text/csv') post :import, params: { csv_upload: file } end it { is_expected.to respond_with(:success) } it { is_expected.not_to set_flash } end shar...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/announcements_controller_spec.rb
spec/controllers/announcements_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' shared_examples_for 'announcements page success' do it { is_expected.to respond_with(:success) } it { is_expected.not_to set_flash } end shared_examples_for 'announcements access denied' do it { is_expected.to redirect_to(root_url) } it { is_expected.to set...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/requirements_controller_spec.rb
spec/controllers/requirements_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' # note, these tests are complex in order to test the admin security features # -- namely, it was necessary to test two contexts for each method: the user # being an admin, and not. describe RequirementsController, type: :controller do before(:each) do mock_app...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/users_controller_spec.rb
spec/controllers/users_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' describe UsersController, type: :controller do before(:each) { mock_app_config } it_behaves_like 'calendarable', User describe 'GET index' do before { mock_user_sign_in(UserMock.new(:admin)) } context 'basic function' do before { get :index } ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/app_configs_controller_spec.rb
spec/controllers/app_configs_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' # Routes: # # match '/app_configs/' => 'app_configs#edit', :as => :edit_app_configs # resources :app_configs, :only => [:update] # # match '/new_app_configs' => 'application_setup#new_app_configs', :as => # :new_app_configs # match '/create_app_configs' => 'applicat...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' describe ApplicationController, type: :controller do before(:each) do @app_config = FactoryGirl.create(:app_config) # this is to ensure that all before_actions are run @first_user = FactoryGirl.create(:user) allow(controller).to receive(:app_setup_...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/contact_controller_spec.rb
spec/controllers/contact_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' describe ContactController, type: :controller do before(:each) do @category = FactoryGirl.create(:category) sign_in FactoryGirl.create(:user) # goes after the above to skip certain user validations @ac = mock_app_config(contact_email: 'contact@ema...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/blackouts_controller_spec.rb
spec/controllers/blackouts_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' shared_examples_for 'blackouts page success' do it { is_expected.to respond_with(:success) } it { is_expected.not_to set_flash } end shared_examples_for 'blackouts access denied' do it { is_expected.to redirect_to(root_url) } it { is_expected.to set_flash }...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/reservations_controller_spec.rb
spec/controllers/reservations_controller_spec.rb
# frozen_string_literal: true # rubocop:disable Rails/SkipsModelValidations require 'spec_helper' require 'helpers/email_helper_spec' describe ReservationsController, type: :controller do AC_DEFAULTS = { disable_user_emails: false, override_on_create: false, override_at_checkout...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
true
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/catalog_controller_spec.rb
spec/controllers/catalog_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' describe CatalogController, type: :controller do before(:each) do @app_config = FactoryGirl.create(:app_config) @user = FactoryGirl.create(:user) @cart = FactoryGirl.build(:cart, reserver_id: @user.id) sign_in @user # @controller.stub(:cart).an...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/reports_controller_spec.rb
spec/controllers/reports_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' describe ReportsController, type: :controller do before(:all) do @user = FactoryGirl.create(:user) @banned = FactoryGirl.create(:banned) @checkout_person = FactoryGirl.create(:checkout_person) @admin = FactoryGirl.create(:admin) end context 'a...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/controllers/categories_controller_spec.rb
spec/controllers/categories_controller_spec.rb
# frozen_string_literal: true require 'spec_helper' describe CategoriesController, type: :controller do before(:each) { mock_app_config } it_behaves_like 'calendarable', Category describe 'GET index' do context 'user is admin' do before do mock_user_sign_in(UserMock.new(:admin)) get ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/equipment_model_spec.rb
spec/models/equipment_model_spec.rb
# frozen_string_literal: true require 'spec_helper' describe EquipmentModel, type: :model do it_behaves_like 'linkable' it_behaves_like 'soft deletable' def mock_eq_model(**attrs) FactoryGirl.build_stubbed(:equipment_model, **attrs) end it 'has a working factory' do expect(FactoryGirl.create(:equi...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/reservation_spec.rb
spec/models/reservation_spec.rb
# frozen_string_literal: true # rubocop:disable Rails/SkipsModelValidations require 'spec_helper' describe Reservation, type: :model do include ActiveSupport::Testing::TimeHelpers it_behaves_like 'linkable' describe 'counter cache' do context 'newly overdue reservation' do it 'increments when a res...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
true
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/requirement_spec.rb
spec/models/requirement_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Requirement, type: :model do context 'Validations' do before(:each) do @requirement = FactoryGirl.build(:requirement) end it 'has a working factory' do expect(@requirement.save).to be_truthy end it { is_expected.to validat...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/category_spec.rb
spec/models/category_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Category, type: :model do it_behaves_like 'soft deletable' before(:each) do @category = FactoryGirl.build(:category) end it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_uniqueness_of(:name).case_insensitive } ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/announcement_spec.rb
spec/models/announcement_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Announcement, type: :model do # pending "add some examples to (or delete) #{__FILE__}" it 'has current scope' do _passed = Announcement.create! starts_at: Time.zone.today - 2.days, ends_at: Time.zone.today - 1.day, ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/cart_spec.rb
spec/models/cart_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Cart, type: :model do before(:each) do @cart = FactoryGirl.build(:cart) @cart.items = {} # Needed to avoid db flushing problems end it 'has a working factory' do expect(@cart).to be_valid end context 'General validations' do it {...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/checkout_procedure_spec.rb
spec/models/checkout_procedure_spec.rb
# frozen_string_literal: true require 'spec_helper' describe CheckoutProcedure, type: :model do it_behaves_like 'soft deletable' it { is_expected.to belong_to(:equipment_model) } end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/message_spec.rb
spec/models/message_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Message, type: :model do context 'validations' do it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_presence_of(:email) } it { is_expected.to validate_presence_of(:subject) } it { is_expected.to validate_presenc...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/report_spec.rb
spec/models/report_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Report, type: :model do before(:each) do @report = Report.new end describe Report::Column do it 'can be constructed from arrays' do column = Report::Column.arr_to_col ['Name', :scope, :type, :field] expect(column.name).to eq('Name'...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/blackout_spec.rb
spec/models/blackout_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Blackout, type: :model do context 'validations and associations' do it { is_expected.to validate_presence_of(:notice) } it { is_expected.to validate_presence_of(:start_date) } it { is_expected.to validate_presence_of(:end_date) } it { is_ex...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/checkin_procedure_spec.rb
spec/models/checkin_procedure_spec.rb
# frozen_string_literal: true require 'spec_helper' describe CheckinProcedure, type: :model do it_behaves_like 'soft deletable' it { is_expected.to belong_to(:equipment_model) } end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/app_config_spec.rb
spec/models/app_config_spec.rb
# frozen_string_literal: true require 'spec_helper' describe AppConfig, type: :model do before(:all) { AppConfig.delete_all } before(:each) { @ac = FactoryGirl.build(:app_config) } it 'has a working factory' do expect(@ac.save).to be_truthy end it 'does not accept empty site title' do @ac.site_titl...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/equipment_item_spec.rb
spec/models/equipment_item_spec.rb
# frozen_string_literal: true require 'spec_helper' describe EquipmentItem, type: :model do include ActiveSupport::Testing::TimeHelpers it_behaves_like 'linkable' it_behaves_like 'soft deletable' describe 'basic validations' do subject(:item) { FactoryGirl.build(:equipment_item) } it { is_expected.t...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/models/user_spec.rb
spec/models/user_spec.rb
# frozen_string_literal: true require 'spec_helper' include EnvHelpers describe User, type: :model do it 'has a working factory' do expect(FactoryGirl.create(:user)).to be_valid end context 'validations and associations' do before(:each) do @user = FactoryGirl.create(:user) end it { is_e...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/flash_spec.rb
spec/features/flash_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Flashes' do context 'when impersonating another user role' do before do FactoryGirl.build(:admin) sign_in_as_user(@admin) visit root_path end it 'has a link to the documentation' do click_on('Patron') expect(pag...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/eq_model_editing_spec.rb
spec/features/eq_model_editing_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Equipment Model editing', type: :feature do let(:eq_model) { FactoryGirl.create(:equipment_model) } before { sign_in_as_user(@admin) } after { sign_out } it 'works for checkout procedures', js: true do visit edit_equipment_model_path(eq_model...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/import_users_spec.rb
spec/features/import_users_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Import Users', type: :feature do before do sign_in_as_user(@admin) create(:user, username: 'BANME') create(:user, username: 'ME2') end it 'can bulk ban users given only usernames' do visit csv_import_page_url attach_users_to_ban_...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/task_buttons_spec.rb
spec/features/task_buttons_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Rake task buttons', type: :feature do before do sign_in_as_user FactoryGirl.create(:superuser) # The following is necessary to "undo" a stub / mock called for all feature # specs that was designed to avoid weird issues with persistent AppConf...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/receipt_spec.rb
spec/features/receipt_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Reservation receipts' do before do # Necessary to override our mocked AppConfig allow(AppConfig.first).to receive(:disable_user_emails).and_return(false) sign_in_as_user @admin end context 'when checked out' do let(:reservation) { Fa...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/eq_model_deactivation_spec.rb
spec/features/eq_model_deactivation_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Equipment Model deactivation', type: :feature do let(:eq_model) { FactoryGirl.create(:equipment_model) } before do FactoryGirl.create(:equipment_item, equipment_model: eq_model) end after { sign_out } shared_examples 'success' do it 'c...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/eq_model_spec.rb
spec/features/eq_model_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Equipment Model views', type: :feature do context 'show view' do # for pending reservations before(:each) do 4.times do FactoryGirl.create :equipment_item, equipment_model: @eq_model end FactoryGirl.build(:checked_in_res...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/reservations_handling_spec.rb
spec/features/reservations_handling_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Reservations handling', type: :feature do let(:eq_model) { FactoryGirl.create(:equipment_model_with_item) } before do sign_in_as_user(@admin) end after { sign_out } context 'with checkout procedure' do let!(:procedure) do FactoryG...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/reservations_archive_spec.rb
spec/features/reservations_archive_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Reservations archiving', type: :feature do before(:each) do @res = FactoryGirl.create(:valid_reservation) end shared_examples_for 'cannot see archive button' do it do visit reservation_path(@res) expect(page).not_to have_link('Ar...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/equipment_model_calendar_spec.rb
spec/features/equipment_model_calendar_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.feature 'Equipment model calendar view' do context 'as admin or superuser' do before(:each) { sign_in_as_user(@admin) } after(:each) { sign_out } it 'has useful links' do visit calendar_equipment_model_path(@eq_model) expect(page).to...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/blackout_spec.rb
spec/features/blackout_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Blackout creation' do before do sign_in_as_user @admin end describe 'regular blackout' do context 'with overlapping but unaffected reservations' do before do # This reservation will start before the blackout we try to create ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/catalog_requirements_spec.rb
spec/features/catalog_requirements_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Catalog view', type: :feature do context 'with requirement' do it 'renders equipment with a requirement' do @eq_model.requirements << FactoryGirl.create(:requirement) sign_in_as_user @user visit root_path expect(page).to have_...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/auth_spec.rb
spec/features/auth_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Authentication' do subject { page } shared_examples_for 'valid registration' do it { is_expected.to have_content 'Successfully created user.' } it { is_expected.to have_content 'John Smith' } it { is_expected.to have_link 'Log Out' } end...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/users_spec.rb
spec/features/users_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Users', type: :feature do context 'can be banned' do shared_examples 'can ban other users' do it do visit user_path(@user) expect(page).to have_link 'Ban', href: ban_user_path(@user) click_link 'Ban' expect { @use...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/profile_spec.rb
spec/features/profile_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'User profile' do subject { page } context 'with password authentication' do around(:example) do |example| env_wrapper('CAS_AUTH' => nil) { example.run } end context 'as normal user' do before { login_as(@user, scope: :user) } ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/rails_admin_spec.rb
spec/features/rails_admin_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Active Admin', type: :feature do VALID_MODELS = [:announcement, :app_config, :blackout, :category, :checkin_procedure, :checkout_procedure, :equipment_item, :equipment_model, :requirement, :reservation, :user].freeze ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/announcements_spec.rb
spec/features/announcements_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Announcements' do before :each do Announcement.create! message: 'Hello World', starts_at: Time.zone.today - 1.day, ends_at: Time.zone.today + 1.day Announcement.create! message: 'Upcoming', ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/reservations_spec.rb
spec/features/reservations_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Reservations', type: :feature do context 'can be created' do before(:each) { empty_cart } shared_examples 'can create valid reservation' do |reserver| let(:reserver) { reserver } str = reserver ? 'for other user successfully' : 'succ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/guest_spec.rb
spec/features/guest_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'guest users', type: :feature do # Shared Examples shared_examples 'unauthorized' do context 'visiting protected route' do describe '/reservations/new' do it_behaves_like('inaccessible to guests', :new_reservation_path) end ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/features/equipment_model_views_spec.rb
spec/features/equipment_model_views_spec.rb
# frozen_string_literal: true require 'spec_helper' describe 'Equipment model views' do subject { page } context 'index view' do shared_examples 'can view detailed table' do it { should have_selector 'th', text: 'Available' } end shared_examples 'can view full and detailed table' do it_b...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/queries/reservations/affected_by_recurring_blackout_query.rb
spec/queries/reservations/affected_by_recurring_blackout_query.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe Reservations::AffectedByRecurringBlackoutQuery do let!(:overdue) do create(:overdue_reservation, due_date: Time.zone.today - 1.day) end let!(:checked_out) do create(:checked_out_reservation, due_date: Time.zone.tomorrow) end let!(:no...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/lib/class_from_string_spec.rb
spec/lib/class_from_string_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe ClassFromString do shared_examples 'valid class' do |method, string, klass| it 'returns a model class' do expect(described_class.send(method, string)).to eq(klass) end end shared_examples 'invalid class' do |method, string| it...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/lib/ldap_helper_spec.rb
spec/lib/ldap_helper_spec.rb
# frozen_string_literal: true require 'spec_helper' describe LDAPHelper do def mock_ldap(user_hash) instance_spy(Net::LDAP, search: user_hash) end context 'LDAP enabled' do around(:example) do |example| env_wrapper('CAS_AUTH' => 1, 'USE_LDAP' => 1) { example.run } end describe '#search' d...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/lib/csv_export_spec.rb
spec/lib/csv_export_spec.rb
# frozen_string_literal: true require 'spec_helper' include CsvExport describe CsvExport do MODELS = [:user, :category, :equipment_model, :equipment_item].freeze PROTECTED_COLS = %w(id encrypted_password reset_password_token reset_password_sent_at).freeze shared_examples 'builds a csv' do ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/lib/csv_import_spec.rb
spec/lib/csv_import_spec.rb
# frozen_string_literal: true require 'spec_helper' include CsvImport describe CsvImport do let(:parsed_csv) do [{ username: 'abc123', first_name: '', last_name: '', nickname: '', phone: '', email: '', affiliation: '' }] end context 'when CAS login is used' do context 'when only username ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/lib/blackout_updater_spec.rb
spec/lib/blackout_updater_spec.rb
# frozen_string_literal: true require 'spec_helper' describe BlackoutUpdater do describe 'update!' do context 'without errors' do it 'successfully updates the blackout' do blackout = instance_spy(Blackout, save: true, validate: true) allow(Reservat...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/lib/generator_spec.rb
spec/lib/generator_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Generator do OBJECTS = %i[app_config category requirement user superuser].freeze shared_examples 'generates a valid' do |method| it method.to_s do expect(Generator.send(method)).to be_truthy end end OBJECTS.each { |o| it_behaves_like '...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/mailers/admin_mailer_spec.rb
spec/mailers/admin_mailer_spec.rb
# frozen_string_literal: true require 'spec_helper' shared_examples_for 'a valid admin email' do it 'sends to the admin' do expect(@mail.to.size).to eq(1) expect(@mail.to.first).to eq(AppConfig.check(:admin_email)) end it "is from no-reply@#{ActionMailer::Base.default_url_options[:host]}" do expect(...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/mailers/user_mailer_spec.rb
spec/mailers/user_mailer_spec.rb
# frozen_string_literal: true require 'spec_helper' include EnvHelpers shared_examples_for 'valid user email' do it 'sends to the reserver' do expect(@mail.to.size).to eq(1) expect(@mail.to.first).to eq(reserver.email) end it 'sends an email' do expect(ActionMailer::Base.deliveries.count).to eq(1) ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/csv_import.rb
lib/csv_import.rb
# frozen_string_literal: true module CsvImport # method used to convert a csv filepath to an array of objects specified by # the file def csv_import(filepath) # initialize imported_objects = [] string = File.read(filepath) require 'csv' # sanitize input string = string.encode('UTF-8', 'b...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/csv_export.rb
lib/csv_export.rb
# frozen_string_literal: true module CsvExport require 'csv' require 'zip' PROTECTED_COLS = %w(id encrypted_password reset_password_token reset_password_sent_at).freeze # generates a csv from the given model data # columns is optional; defaults to all columns except protected def gen...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/searchable.rb
lib/searchable.rb
# frozen_string_literal: true module Searchable def self.included(base) # rubocop:disable MethodLength def base.searchable_on(*args) @searchable_attrs = args end def base.catalog_search(query) if query.blank? # if the string is blank, return all active else # in all other cases...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/ldap_helper.rb
lib/ldap_helper.rb
# frozen_string_literal: true require 'net/ldap' class LDAPHelper def self.search(**params) new(**params).search end def initialize(login:) @ldap = Net::LDAP.new(conn_settings) @user_login = login end def search user_hash end private ATTRS = %i[login email first_name last_name nick...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/development_mail_interceptor.rb
lib/development_mail_interceptor.rb
# frozen_string_literal: true # class DevelopmentMailInterceptor # def self.delivering_email(message) # message.subject = "[#{message.to}] #{message.subject}" # message.to = "maria.altyeva@yale.edu" # end # end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/rails_extensions.rb
lib/rails_extensions.rb
# frozen_string_literal: true require 'date' class Range def intersection(other) return nil if max < other.begin || other.max < self.begin [self.begin, other.begin].max..[max, other.max].min end alias & intersection end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/people_api_helper.rb
lib/people_api_helper.rb
# frozen_string_literal: true require 'json' # Helper class to handle requests to a web-service-based user profile API and # return profile data class PeopleAPIHelper # Allows for the calling of .search on the base class def self.search(**params) new(**params).search end # Initialize a new PeopleAPIHelpe...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/activation_helper.rb
lib/activation_helper.rb
# frozen_string_literal: true module ActivationHelper def activate_parents(current_item) # Equipment Items have EMs and Categories that may need to be # reactivated if current_item.class == EquipmentItem # Reactivate the current item's category and/or Equipment Model if # deactivated cat...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/equipment_import.rb
lib/equipment_import.rb
# frozen_string_literal: true # rubocop:disable ModuleLength module EquipmentImport # IMPORT FUNCTIONS - these are all kinda similar, but we'll write them # separately for now and we can always refactor later. # import categories # rubocop:disable MethodLength def import_cats(processed_cats, cat_overwrite =...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/class_from_string.rb
lib/class_from_string.rb
# frozen_string_literal: true # Class for parsing strings into class names # Used in controllers to prevent SQL injection and other attacks class ClassFromString REPORTS = { 'equipment_model' => EquipmentModel, 'category' => Category, 'user' => User, 'equipment_item' => Equi...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/autocomplete.rb
lib/autocomplete.rb
# frozen_string_literal: true module Autocomplete def get_autocomplete_items(parameters) query = '%' + parameters[:term].downcase + '%' User.where( 'nickname LIKE ? OR first_name LIKE ? OR last_name LIKE ? OR username '\ "LIKE ? OR CONCAT_WS(' ',first_name,last_name) LIKE ? OR "\ "CONCAT_WS(...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/blackout_updater.rb
lib/blackout_updater.rb
# frozen_string_literal: true class BlackoutUpdater # Service Object to update blackouts in the blackouts controller def initialize(blackout:, params:) @blackout = blackout @blackout.assign_attributes(params) end def update return { result: nil, error: check_for_conflicts } if check_for_conflicts ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/equipment_model_generator.rb
lib/seed/equipment_model_generator.rb
# frozen_string_literal: true module EquipmentModelGenerator IMAGES = Rails.root.join('db', 'seed_images', '*') NO_PICS ||= true def self.generate EquipmentModel.create! do |em| em.name = FFaker::Product.product + ' ' + rand(1..9001).to_s em.description = FFaker::HipsterIpsum.paragraph(16) ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/user_generator.rb
lib/seed/user_generator.rb
# frozen_string_literal: true module UserGenerator def self.generate User.create do |u| u.first_name = FFaker::Name.first_name u.last_name = FFaker::Name.last_name u.nickname = FFaker::Name.first_name u.phone = FFaker::PhoneNumber.short_phone_number u.email = FFaker::Internet.email ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/prompted_seed.rb
lib/seed/prompted_seed.rb
# frozen_string_literal: true # rubocop:disable Rails/Output module PromptedSeed def prompted_seed prompt_app_config prompt_user generate('user') generate('category') generate('blackout') return if Category.count == 0 puts "\nThis is going to take awhile...\n" unless NO_PICS generate...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/blackout_generator.rb
lib/seed/blackout_generator.rb
# frozen_string_literal: true module BlackoutGenerator def self.generate Blackout.create! do |blk| blk.start_date = rand(Time.zone.now..Time.zone.now + 1.year) blk.end_date = rand(blk.start_date..blk.start_date.next_week) blk.notice = FFaker::HipsterIpsum.paragraph(2) blk.created_by = User...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/reservation_generator_helper.rb
lib/seed/reservation_generator_helper.rb
# frozen_string_literal: true module ReservationGeneratorHelper include ActiveSupport::Testing::TimeHelpers def gen_res(random = false) r = Reservation.new(status: 'reserved', reserver_id: User.all.sample.id, equipment_model: EquipmentModel.all.sample, notes: FF...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/requirement_generator.rb
lib/seed/requirement_generator.rb
# frozen_string_literal: true module RequirementGenerator def self.generate Requirement.create! do |req| req.equipment_models = EquipmentModel.all.sample(rand(1..3)) req.contact_name = FFaker::Name.name req.contact_info = FFaker::PhoneNumber.short_phone_number req.notes = FFaker::HipsterIp...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/equipment_item_generator.rb
lib/seed/equipment_item_generator.rb
# frozen_string_literal: true module EquipmentItemGenerator def self.generate EquipmentItem.create! do |ei| ei.name = "Number #{(0...3).map { 65.+(rand(25)).chr }.join}" + rand(1..9001).to_s ei.serial = (0...8).map { 65.+(rand(25)).chr }.join ei.active = true ei.equipment_m...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/category_generator.rb
lib/seed/category_generator.rb
# frozen_string_literal: true module CategoryGenerator def self.generate Category.create! do |c| category_name = FFaker::Product.brand category_names = Category.all.to_a.map!(&:name) # Verify uniqueness of category name while category_names.include?(category_name) category_name = ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/procedure_generator.rb
lib/seed/procedure_generator.rb
# frozen_string_literal: true module ProcedureGenerator def self.generate_checkin CheckinProcedure.create!(attributes) end def self.generate_checkout CheckoutProcedure.create!(attributes) end def self.attributes { step: FFaker::HipsterIpsum.sentence, equipment_model_id: EquipmentModel.all....
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/automatic_seed.rb
lib/seed/automatic_seed.rb
# frozen_string_literal: true # rubocop:disable Rails/Output module AutomaticSeed def automatic_seed start_time = Time.zone.now puts 'Seeding the database automatically, without images...' Generator.app_config create_superuser Generator.generate('user', 25) Generator.generate('category', 10) ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/app_config_generator.rb
lib/seed/app_config_generator.rb
# frozen_string_literal: true module AppConfigGenerator DEFAULT_MSGS = File.join(Rails.root, 'db', 'default_messages') TOS_TEXT = File.read(File.join(DEFAULT_MSGS, 'tos_text')) UPCOMING_CHECKIN_RES_EMAIL = File.read(File.join(DEFAULT_MSGS, 'upcoming_checkin_email...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/generator.rb
lib/seed/generator.rb
# frozen_string_literal: true # rubocop:disable Rails/Output module Generator require 'ffaker' require 'ruby-progressbar' PROGRESS_STR = '%t: [%B] %P%% | %c / %C | %E' def self.generate(obj, n) return if n == 0 puts "Generating #{n} #{obj.camelize}...\n" progress = ProgressBar.create(format: PROGR...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/seed/reservation_generator.rb
lib/seed/reservation_generator.rb
# frozen_string_literal: true module ReservationGenerator extend ReservationGeneratorHelper RES_TYPES = Reservation.statuses.keys + %w[future overdue returned_overdue] - %w[reserved] # Generate one of each reservation type with fixed time differences and # one with random time differences def...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/extras/simple_form_extensions.rb
lib/extras/simple_form_extensions.rb
# frozen_string_literal: true module ButtonComponents def submit_button(*args, &block) options = args.extract_options! options[:class] = ['btn-primary', options[:class]].compact args << options # rubocop:disable AssignmentInCondition if cancel = options.delete(:cancel) submit(*args, &block) ...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/lib/job_helpers/email_job_helper.rb
lib/job_helpers/email_job_helper.rb
# frozen_string_literal: true module EmailJobHelper private def send_email(res) UserMailer.reservation_status_update(res).deliver_now end def log_email(res) Rails.logger.info "Sending reminder for #{res.human_status} reservation:\n \ #{res.inspect}" end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/application.rb
config/application.rb
# frozen_string_literal: true require_relative 'boot' require 'active_storage/engine' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups(:default, Rails.env)) module Reservations class Application < R...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/environment.rb
config/environment.rb
# frozen_string_literal: true # Load the Rails application. require 'rails_extensions' require_relative 'application' # Version variable if Dir.exist?('.git/') && !defined? APP_VERSION APP_VERSION = `git describe --tags --abbrev=0`.strip end unless defined? APP_VERSION File.open('CHANGELOG.md', 'r') do |f| w...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/puma.rb
config/puma.rb
# frozen_string_literal: true # Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for mini...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/routes.rb
config/routes.rb
# frozen_string_literal: true Reservations::Application.routes.draw do root to: 'catalog#index' # routes for Devise devise_scope :user do devise_for :users end mount RailsAdmin::Engine => '/admin', as: 'rails_admin' ## Concerns concern :deactivatable do member do put :deactivate pu...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/deploy.rb
config/deploy.rb
# config valid only for Capistrano 3.1 lock '3.8.2' set :application, "reservations-#{ENV['IDENTIFIER']}" set :repo_url, 'https://github.com/YaleSTC/reservations.git' # Default branch is :master set :branch, "#{ENV['GIT_TAG']}" # Default deploy_to directory is /var/www/my_app set :deploy_to, "#{ENV['DEPLOY_DIR']}" s...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/spring.rb
config/spring.rb
# frozen_string_literal: true Spring.watch( '.ruby-version', '.rbenv-vars', 'tmp/restart.txt', 'tmp/caching-dev.txt' )
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/unicorn.rb
config/unicorn.rb
# frozen_string_literal: true # rubocop:disable Rails/Output worker_processes Integer(ENV['WEB_CONCURRENCY'] || 3) timeout 15 preload_app true before_fork do |_server, _worker| Signal.trap 'TERM' do puts 'Unicorn master intercepting TERM and sending myself QUIT instead' Process.kill 'QUIT', Process.pid end...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/boot.rb
config/boot.rb
# frozen_string_literal: true ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/schedule.rb
config/schedule.rb
# frozen_string_literal: true # Use this file to easily define all of your cron jobs. # # It's helpful, but not entirely necessary to understand cron before proceeding. # http://en.wikipedia.org/wiki/Cron # For Heroku deployments, this will be superseded by the Heroku scheduler (for # more info see: https://devcenter....
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/initializers/content_security_policy.rb
config/initializers/content_security_policy.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Define an application-wide content security policy # For further information see the following documentation # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy # Rails.application.config.conte...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/initializers/filter_parameter_logging.rb
config/initializers/filter_parameter_logging.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [:password]
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/initializers/authentication.rb
config/initializers/authentication.rb
# frozen_string_literal: true # Check for authentication method and copy data over if necessary (ENV variable # to skip if necessary, skip if migrating from a pre-v4.1.0 DB or no table) unless ENV['SKIP_AUTH_INIT'] || !User.table_exists? || !User.column_names.include?('username') user = User.first # if we...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/initializers/session_store.rb
config/initializers/session_store.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_reservations_session'
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/config/initializers/days_of_the_week.rb
config/initializers/days_of_the_week.rb
# frozen_string_literal: true # rubocop:disable UselessAssignment def days_of_the_week_long days_of_the_week_long = %w(Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) end def days_of_the_week_short days_of_the_week_short = %w(Sun, Mon, Tues, Wed, Thurs, Fri, Sat) end d...
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false