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/db/migrate/20130717084037_add_checkout_person_can_override_to_app_configs.rb
db/migrate/20130717084037_add_checkout_person_can_override_to_app_configs.rb
class AddCheckoutPersonCanOverrideToAppConfigs < ActiveRecord::Migration def change end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20130310101908_remove_overdue_checkout_attriutes_from_app_configs.rb
db/migrate/20130310101908_remove_overdue_checkout_attriutes_from_app_configs.rb
class RemoveOverdueCheckoutAttriutesFromAppConfigs < ActiveRecord::Migration def up remove_column :app_configs, :overdue_checkout_email_active remove_column :app_configs, :overdue_checkout_email_body end def down add_column :app_configs, :overdue_checkout_email_active, :default => true add_column :app_configs, :overdue_checkout_email_body, :text end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20120612164714_equipment_models_associated_equipment_models.rb
db/migrate/20120612164714_equipment_models_associated_equipment_models.rb
class EquipmentModelsAssociatedEquipmentModels < ActiveRecord::Migration def self.up create_table :equipment_models_associated_equipment_models, :id => false do |t| t.references :equipment_model t.references :associated_equipment_model end end def self.down drop_table :equipment_models_associated_equipment_models end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20120724184424_add_description_to_requirements.rb
db/migrate/20120724184424_add_description_to_requirements.rb
class AddDescriptionToRequirements < ActiveRecord::Migration def change add_column :requirements, :description, :string end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20120626155902_add_app_config_table.rb
db/migrate/20120626155902_add_app_config_table.rb
class AddAppConfigTable < ActiveRecord::Migration def up create_table :app_configs do |t| t.boolean :upcoming_checkin_email_active, :default => true t.boolean :overdue_checkout_email_active, :default => true t.boolean :overdue_checkout_email_active, :default => true t.boolean :reservation_confirmation_email_active, :default => true end end def down drop_table :app_configs end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20150206002111_add_upcoming_checkout_email_active_to_app_config.rb
db/migrate/20150206002111_add_upcoming_checkout_email_active_to_app_config.rb
class AddUpcomingCheckoutEmailActiveToAppConfig < ActiveRecord::Migration def change add_column :app_configs, :upcoming_checkout_email_active, :boolean end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20091001234857_create_documents.rb
db/migrate/20091001234857_create_documents.rb
class CreateDocuments < ActiveRecord::Migration def self.up create_table :documents do |t| t.string :name t.string :data_file_name t.string :data_content_type t.integer :data_file_size t.references :equipment_model t.timestamps end end def self.down drop_table :documents end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20120528214306_create_settings.rb
db/migrate/20120528214306_create_settings.rb
class CreateSettings < ActiveRecord::Migration def self.up create_table :settings do |t| t.string :var, :null => false t.text :value, :null => true t.integer :thing_id, :null => true t.string :thing_type, :limit => 30, :null => true t.timestamps end add_index :settings, [ :thing_type, :thing_id, :var ], :unique => true end def self.down drop_table :settings end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20140403011914_add_csv_import_to_equipment_stuff.rb
db/migrate/20140403011914_add_csv_import_to_equipment_stuff.rb
class AddCsvImportToEquipmentStuff < ActiveRecord::Migration def change add_column :categories, :csv_import, :boolean, :default => false, :null => false add_column :equipment_models, :csv_import, :boolean, :default => false, :null => false add_column :equipment_objects, :csv_import, :boolean, :default => false, :null => false end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20141126061515_remove_delete_missed_reservations_from_app_configs.rb
db/migrate/20141126061515_remove_delete_missed_reservations_from_app_configs.rb
class RemoveDeleteMissedReservationsFromAppConfigs < ActiveRecord::Migration def change remove_column :app_configs, :delete_missed_reservations end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20090930234012_create_users.rb
db/migrate/20090930234012_create_users.rb
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :login t.string :first_name t.string :last_name t.string :nickname t.string :phone t.string :email t.string :affiliation t.boolean :is_banned, :default => false t.boolean :is_admin, :default => false t.boolean :is_checkout_person, :default => false t.timestamps end end def self.down drop_table :users end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20120705210315_add_email_active_for_app_configs.rb
db/migrate/20120705210315_add_email_active_for_app_configs.rb
class AddEmailActiveForAppConfigs < ActiveRecord::Migration def up add_column :app_configs, :overdue_checkin_email_active, :boolean, :default => true end def down remove_column :app_configs, :overdue_checkin_email_active end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20140618173229_add_deactivation_reason_to_equipment_objects.rb
db/migrate/20140618173229_add_deactivation_reason_to_equipment_objects.rb
class AddDeactivationReasonToEquipmentObjects < ActiveRecord::Migration def change add_column :equipment_objects, :deactivation_reason, :string, default: nil end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20091002184322_create_sessions.rb
db/migrate/20091002184322_create_sessions.rb
class CreateSessions < ActiveRecord::Migration def self.up create_table :sessions do |t| t.string :session_id, :null => false t.text :data t.timestamps end add_index :sessions, :session_id add_index :sessions, :updated_at end def self.down drop_table :sessions end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20130327193420_change_deleted_at_to_date_time.rb
db/migrate/20130327193420_change_deleted_at_to_date_time.rb
class ChangeDeletedAtToDateTime < ActiveRecord::Migration def change change_column :users, :deleted_at, :datetime change_column :equipment_objects, :deleted_at, :datetime change_column :equipment_models, :deleted_at, :datetime change_column :categories, :deleted_at, :datetime end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20120718004311_add_favicon_to_app_configs.rb
db/migrate/20120718004311_add_favicon_to_app_configs.rb
class AddFaviconToAppConfigs < ActiveRecord::Migration def up add_attachment :app_configs, :favicon end def down remove_attachment :app_configs, :favicon end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20130617030854_create_announcements.rb
db/migrate/20130617030854_create_announcements.rb
class CreateAnnouncements < ActiveRecord::Migration def change create_table :announcements do |t| t.text :message t.datetime :starts_at t.datetime :ends_at t.timestamps end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20130310095143_add_delete_missed_reservations_to_app_configs.rb
db/migrate/20130310095143_add_delete_missed_reservations_to_app_configs.rb
class AddDeleteMissedReservationsToAppConfigs < ActiveRecord::Migration def change add_column :app_configs, :delete_missed_reservations, :boolean, default: true end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20141014041026_add_encrypted_password_to_users.rb
db/migrate/20141014041026_add_encrypted_password_to_users.rb
class AddEncryptedPasswordToUsers < ActiveRecord::Migration def change add_column :users, :encrypted_password, :string, :null => false, :default => '', :limit => 128 end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20150304042433_rename_equipment_objects.rb
db/migrate/20150304042433_rename_equipment_objects.rb
class RenameEquipmentObjects < ActiveRecord::Migration def change rename_table :equipment_objects, :equipment_items rename_column :reservations, :equipment_object_id, :equipment_item_id rename_column :equipment_models, :equipment_objects_count, :equipment_items_count end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20140605230158_create_versions.rb
db/migrate/20140605230158_create_versions.rb
class CreateVersions < ActiveRecord::Migration def self.up create_table :versions do |t| t.string :item_type, :null => false t.integer :item_id, :null => false t.string :event, :null => false t.string :whodunnit t.text :object t.datetime :created_at end add_index :versions, [:item_type, :item_id] end def self.down remove_index :versions, [:item_type, :item_id] drop_table :versions end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20150323000707_add_overdue_to_reservation.rb
db/migrate/20150323000707_add_overdue_to_reservation.rb
class AddOverdueToReservation < ActiveRecord::Migration def change add_column :reservations, :overdue, :boolean, default: false end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20140610134345_add_approval_status_column_to_reservations.rb
db/migrate/20140610134345_add_approval_status_column_to_reservations.rb
class AddApprovalStatusColumnToReservations < ActiveRecord::Migration def change add_column :reservations, :approval_status, :string, :default => 'auto' end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20141125025619_add_enable_new_users_to_app_configs.rb
db/migrate/20141125025619_add_enable_new_users_to_app_configs.rb
class AddEnableNewUsersToAppConfigs < ActiveRecord::Migration def change add_column :app_configs, :enable_new_users, :boolean, default: true end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20120627185735_add_settings_to_app_config.rb
db/migrate/20120627185735_add_settings_to_app_config.rb
class AddSettingsToAppConfig < ActiveRecord::Migration def up add_column :app_configs, :site_title, :string add_column :app_configs, :admin_email, :string add_column :app_configs, :department_name, :string add_column :app_configs, :contact_link_text, :string add_column :app_configs, :contact_link_location, :string add_column :app_configs, :home_link_text, :string add_column :app_configs, :home_link_location, :string add_column :app_configs, :default_per_cat_page, :integer add_column :app_configs, :upcoming_checkin_email_body, :text add_column :app_configs, :overdue_checkout_email_body, :text add_column :app_configs, :overdue_checkin_email_body, :text end def down remove_column :app_configs, :site_title remove_column :app_configs, :admin_email remove_column :app_configs, :department_name remove_column :app_configs, :contact_link_text remove_column :app_configs, :contact_link_location remove_column :app_configs, :home_link_text remove_column :app_configs, :home_link_location remove_column :app_configs, :default_per_cat_page remove_column :app_configs, :upcoming_checkin_email_body remove_column :app_configs, :overdue_checkout_email_body remove_column :app_configs, :overdue_checkin_email_body end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20091023172207_add_checkin_and_checkout_procedures_to_equipment_model.rb
db/migrate/20091023172207_add_checkin_and_checkout_procedures_to_equipment_model.rb
class AddCheckinAndCheckoutProceduresToEquipmentModel < ActiveRecord::Migration def self.up add_column :equipment_models, :checkout_procedures, :string add_column :equipment_models, :checkin_procedures, :string end def self.down remove_column :equipment_models, :checkin_procedures remove_column :equipment_models, :checkout_procedures end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20120619213311_clean_up_check_in_out_procedures.rb
db/migrate/20120619213311_clean_up_check_in_out_procedures.rb
class CleanUpCheckInOutProcedures < ActiveRecord::Migration def change remove_column :equipment_models, :checkout_procedures remove_column :equipment_models, :checkin_procedures end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20141001000934_add_notes_to_equipment_objects.rb
db/migrate/20141001000934_add_notes_to_equipment_objects.rb
class AddNotesToEquipmentObjects < ActiveRecord::Migration def change ActiveRecord::Base.transaction do add_column :equipment_objects, :notes, :text, limit: 16_777_215, null: false # store ActiveRecord connection to run queries conn = ActiveRecord::Base.connection # go through all equipment items conn.exec_query('select * from equipment_objects').each do |ei| # set up initial note string new_notes = "#### Created at #{ei['created_at'].to_s(:long)}" # go through all reservations and prepend to note string as needed conn.exec_query('SELECT reservations.* FROM reservations WHERE '\ "(equipment_object_id = #{ei['id']}) ORDER BY start_date, "\ 'due_date, reserver_id, checked_out DESC').each do |res| # get reserver reserver = get_user(res['reserver_id']) if res['checked_out'] # get checkout handler checkout_handler = get_user(res['checkout_handler_id']) new_notes.prepend("#### Checked out (##{res['id']}) by "\ "#{checkout_handler['first_name']} "\ "#{checkout_handler['last_name']} for "\ "#{reserver['first_name']} #{reserver['last_name']} on "\ "#{res['checked_out'].to_s(:long)}.\n\n") end if res["checked_in"] # get checkin handler checkin_handler = get_user(res['checkin_handler_id']) new_notes.prepend("#### Checked in (##{res['id']}) by "\ "#{checkin_handler['first_name']} "\ "#{checkin_handler['last_name']} for "\ "#{reserver['first_name']} #{reserver['last_name']} on "\ "#{res['checked_in'].to_s(:long)}.\n\n") end # update equipment item with new notes conn.execute('UPDATE equipment_objects SET notes = '\ "'#{new_notes.gsub("'", %q(\\\'))}', "\ "updated_at = '#{Time.now.utc.strftime('%F %T')}' WHERE "\ "equipment_objects.id = #{ei['id']}") end end end end def get_user(id=nil, conn=ActiveRecord::Base.connection) conn.exec_query("SELECT users.* FROM users WHERE (id = #{id})").first || { 'first_name' => 'Deleted', 'last_name' => 'User' } end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20191112210445_convert_to_active_storage.rb
db/migrate/20191112210445_convert_to_active_storage.rb
# Migration courtesy of Thoughtbot Migration Guide # https://github.com/thoughtbot/paperclip/blob/master/MIGRATING.md class ConvertToActiveStorage < ActiveRecord::Migration[5.2] require 'open-uri' def up # mariadb get_blob_id = 'LAST_INSERT_ID()' active_storage_blob_statement = ActiveRecord::Base.connection.raw_connection.prepare(" INSERT INTO active_storage_blobs ( `key`, filename, content_type, metadata, byte_size, checksum, created_at ) VALUES (?, ?, ?, '{}', ?, ?, ?) ") active_storage_attachment_statement = ActiveRecord::Base.connection.raw_connection.prepare(" INSERT INTO active_storage_attachments ( name, record_type, record_id, blob_id, created_at ) VALUES (?, ?, ?, #{get_blob_id}, ?) ") Rails.application.eager_load! models = ActiveRecord::Base .descendants .select{ |name| name.to_s.match('EquipmentModel') || name.to_s.match('AppConfig') } transaction do models.each do |model| attachments = model.column_names.map do |c| if c =~ /(.+)_file_name$/ $1 end end.compact if attachments.blank? next end model.find_each.each do |instance| attachments.each do |attachment| if instance.send(attachment).path.blank? next end active_storage_blob_statement.execute( key(instance, attachment), instance.send("#{attachment}_file_name"), instance.send("#{attachment}_content_type"), instance.send("#{attachment}_file_size"), checksum(instance.send(attachment)), instance.updated_at.strftime('%Y-%m-%d %H:%M:%S') ) active_storage_attachment_statement.execute( attachment, model.name, instance.id, instance.updated_at.strftime('%Y-%m-%d %H:%M:%S') ) end end end end end def down raise ActiveRecord::IrreversibleMigration end private def key(instance, attachment) SecureRandom.uuid end def checksum(attachment) # local files stored on disk: url = attachment.path Digest::MD5.base64digest(File.read(url)) # remote files stored on S3: # url = "http:#{attachment.url}" # Digest::MD5.base64digest(Net::HTTP.get(URI(url))) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20111206171041_add_sort_to_categories.rb
db/migrate/20111206171041_add_sort_to_categories.rb
class AddSortToCategories < ActiveRecord::Migration def self.up add_column :categories, :sort_order, :integer end def self.down remove_column :categories, :sort_order end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20150719052612_add_late_fee_max_to_equipment_models.rb
db/migrate/20150719052612_add_late_fee_max_to_equipment_models.rb
class AddLateFeeMaxToEquipmentModels < ActiveRecord::Migration def change add_column :equipment_models, :late_fee_max, :decimal, precision: 10, scale: 2, default: 0 end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20150223001537_add_default_to_upcoming_checkout_email.rb
db/migrate/20150223001537_add_default_to_upcoming_checkout_email.rb
class AddDefaultToUpcomingCheckoutEmail < ActiveRecord::Migration def change change_column_default :app_configs, :upcoming_checkout_email_active, true end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20150206003233_add_upcoming_checkout_email_body_to_app_config.rb
db/migrate/20150206003233_add_upcoming_checkout_email_body_to_app_config.rb
class AddUpcomingCheckoutEmailBodyToAppConfig < ActiveRecord::Migration def change add_column :app_configs, :upcoming_checkout_email_body, :text end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20140714135920_add_blackout_expire_time_to_app_configs.rb
db/migrate/20140714135920_add_blackout_expire_time_to_app_configs.rb
class AddBlackoutExpireTimeToAppConfigs < ActiveRecord::Migration def change add_column :app_configs, :blackout_exp_time, :integer end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20150213001312_change_fields_to_dates.rb
db/migrate/20150213001312_change_fields_to_dates.rb
class ChangeFieldsToDates < ActiveRecord::Migration def up # changing all of these columns to :date types change_column :announcements, :starts_at, :date change_column :announcements, :ends_at, :date change_column :reservations, :start_date, :date change_column :reservations, :due_date, :date end def down # changing all of these columns to :datetime types as they were before # since the up method is "lossy", the resulting database won't be identical # but that's acceptable since we only care about dates anyway change_column :announcements, :starts_at, :datetime change_column :announcements, :ends_at, :datetime change_column :reservations, :start_date, :datetime change_column :reservations, :due_date, :datetime end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20160311070200_add_autodeactivate_on_archive_to_app_config.rb
db/migrate/20160311070200_add_autodeactivate_on_archive_to_app_config.rb
class AddAutodeactivateOnArchiveToAppConfig < ActiveRecord::Migration[4.2] def change add_column :app_configs, :autodeactivate_on_archive, :boolean, default: false end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20140916025809_set_default_view_mode_to_normal.rb
db/migrate/20140916025809_set_default_view_mode_to_normal.rb
class SetDefaultViewModeToNormal < ActiveRecord::Migration def change change_column :users, :view_mode, :string, :default => 'normal' end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20150323003850_add_flags_to_reservation.rb
db/migrate/20150323003850_add_flags_to_reservation.rb
class AddFlagsToReservation < ActiveRecord::Migration def change add_column :reservations, :flags, :integer, default: 1 end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20120711225430_add_tos_accepted_to_user.rb
db/migrate/20120711225430_add_tos_accepted_to_user.rb
class AddTosAcceptedToUser < ActiveRecord::Migration def self.up add_column :users, :terms_of_service_accepted, :boolean end def self.down remove_column :users, :terms_of_service_accepted end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20120604201512_add_view_as_attribute.rb
db/migrate/20120604201512_add_view_as_attribute.rb
class AddViewAsAttribute < ActiveRecord::Migration def self.up add_column :users, :adminmode, :boolean, :default => true add_column :users, :checkoutpersonmode, :boolean, :default => false add_column :users, :normalusermode, :boolean, :default => false add_column :users, :bannedmode, :boolean, :default => false end def self.down remove_column :users, :adminmode remove_column :users, :checkoutpersonmode remove_column :users, :normalusermode remove_column :users, :bannedmode end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20141012145135_rename_login_to_username_for_users.rb
db/migrate/20141012145135_rename_login_to_username_for_users.rb
class RenameLoginToUsernameForUsers < ActiveRecord::Migration def change rename_column :users, :login, :username end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20150405012126_remove_approval_status_from_reservation.rb
db/migrate/20150405012126_remove_approval_status_from_reservation.rb
class RemoveApprovalStatusFromReservation < ActiveRecord::Migration # for use in the flag_res method, based off of Reservation model in v5.5.0 FLAGS = { request: (1 << 1), missed_email_sent: (1 << 5) } # similarly, based off the Reservation model enums in v5.5.0 STATUSES = %w(requested reserved denied checked_out missed returned archived) .each_with_index.to_h def change # store ActiveRecord connection to run queries conn = ActiveRecord::Base.connection # go through all reservations conn.exec_query('select * from reservations').each do |res| new_flags = res['flags'] if res['approval_status'] == 'approved' new_flags = flag_res(new_flags, :request) elsif res['approval_status'] == 'missed_and_emailed' new_flags = flag_res(new_flags, :missed_email_sent) end if res['checked_in'] new_status = STATUSES['returned'] if Time.zone.at(res['checked_in']) > (res['due_date'] + 1.day).beginning_of_day new_overdue = true end if res['notes'].try(:include?, 'Archived') new_status = STATUSES['archived'] end elsif res['checked_out'] new_status = STATUSES['checked_out'] if (res['due_date'] + 1.day).beginning_of_day < Time.zone.today new_overdue = true end elsif res['start_date'].beginning_of_day < Time.zone.today new_status = STATUSES['missed'] elsif res['approval_status'] == 'requested' new_flags = flag_res(new_flags, :request) new_status = STATUSES['requested'] elsif res['approval_status'] == 'denied' new_flags = flag_res(new_flags, :request) new_status = STATUSES['denied'] elsif 'approved auto'.include? res['approval_status'] new_status = STATUSES['reserved'] else # catch any unusual reservations new_flags = flag_res(new_flags, :request) new_status = STATUSES['requested'] end # see if the flags actually changed new_flags = (new_flags == res['flags']) ? nil : new_flags # make sure we have something to update if new_status || new_flags || new_overdue update_str = 'UPDATE reservations SET' update_str << " status = '#{new_status}'" if new_status if new_flags update_str << "#{new_status ? ',' : ''} flags = #{new_flags}" end if new_overdue update_str << "#{(new_status || new_flags) ? ',' : ''} overdue = 1" end update_str << " WHERE reservations.id = #{res['id']}" # actually run update conn.execute(update_str) end end remove_column :reservations, :approval_status, :string end # based on the Reservation#flag instance method in v5.5.0 - this allows us to # decouple the migration from the actual model def flag_res(old_flags, new_flag) old_flags | FLAGS[new_flag] end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20110401155438_change_checkin_checkout_procedures_to_text.rb
db/migrate/20110401155438_change_checkin_checkout_procedures_to_text.rb
class ChangeCheckinCheckoutProceduresToText < ActiveRecord::Migration def self.up change_column :equipment_models, :checkin_procedures, :text change_column :equipment_models, :checkout_procedures, :text end def self.down end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20130628154151_remove_view_as_attributes_from_user.rb
db/migrate/20130628154151_remove_view_as_attributes_from_user.rb
class RemoveViewAsAttributesFromUser < ActiveRecord::Migration def up User.all.each do |user| if user.bannedmode user.view_mode = 'banned' elsif user.checkoutpersonmode user.view_mode = 'checkout' elsif user.normalusermode user.view_mode = 'normal' else user.view_mode = 'admin' end user.save! end remove_column :users, :adminmode remove_column :users, :checkoutpersonmode remove_column :users, :normalusermode remove_column :users, :bannedmode end def down add_column :users, :adminmode, :boolean, :default => true add_column :users, :checkoutpersonmode, :boolean, :default => false add_column :users, :normalusermode, :boolean, :default => false add_column :users, :bannedmode, :boolean, :default => false User.all.each do |user| if user.view_mode == 'admin' user.adminmode = true elsif user.view_mode == 'checkout' user.adminmode = false user.checkoutpersonmode = true elsif user.view_mode == 'banned' user.adminmode = false user.bannedmode = true elsif user.view_mode == 'normal' user.adminmode = false user.normalusermode = true end user.save! end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/db/migrate/20150719050013_add_disable_user_emails_to_app_configs.rb
db/migrate/20150719050013_add_disable_user_emails_to_app_configs.rb
class AddDisableUserEmailsToAppConfigs < ActiveRecord::Migration def change add_column :app_configs, :disable_user_emails, :boolean, default: false end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true require 'simplecov' SimpleCov.start # Rspec should submit the result to CodeClimate automatically with each Travis # CI build (repo token is encrypted in .travis.yml) require 'rubygems' # This file is copied to spec/ when you run 'rails generate rspec:install' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rspec/rails' require 'capybara/rspec' require 'capybara/rails' # require 'rspec/autorun' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f } ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config| # ## Mock Framework # # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: # # config.mock_with :mocha # config.mock_with :flexmock # config.mock_with :rr config.filter_run focus: true config.run_all_when_everything_filtered = true config.infer_spec_type_from_file_location! # Needed in order to do integration tests with capybara config.include Capybara::DSL config.include RSpec::Rails::ViewRendering Capybara.asset_host = 'http://0.0.0.0:3000' # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. config.use_transactional_fixtures = false # If true, the base class of anonymous controllers will be inferred # automatically. This will be the default behavior in future versions of # rspec-rails. config.infer_base_class_for_anonymous_controllers = true # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 config.order = 'random' # DatabaseCleaner setup (2016-01-04 based on Rails Testing book) config.before(:suite) do DatabaseCleaner.clean_with(:deletion) ENV.delete('USE_LDAP') end config.before(:each) do DatabaseCleaner.strategy = :transaction end config.before(:each, js: true) do DatabaseCleaner.strategy = :deletion end config.before(:each) do DatabaseCleaner.start end config.after(:each) do DatabaseCleaner.clean end # Remove when the last of the before(:all) blocks are removed config.after(:all) do DatabaseCleaner.clean_with(:truncation) end # set up app before all integration specs, wish we didn't have to use :each config.before(:each, type: :feature) { app_setup } # Devise helpers config.include Devise::Test::ControllerHelpers, type: :controller config.include ControllerHelpers, type: :controller config.include EnvHelpers, type: :controller config.include Warden::Test::Helpers, type: :feature config.include InjectSession, type: :feature config.include FeatureHelpers, type: :feature config.include EnvHelpers, type: :feature config.include AppConfigHelpers end Shoulda::Matchers.configure do |config| config.integrate do |with| with.test_framework :rspec with.library :rails end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/delete_old_blackouts_job_spec.rb
spec/jobs/delete_old_blackouts_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe DeleteOldBlackoutsJob, type: :job do it "doesn't run when the res_exp_time parameter isn't set" do mock_app_config(blackout_exp_time: nil) allow(described_class).to receive(:run) described_class.perform_now expect(described_class).not_to have_received(:run) end describe '#run' do it 'deletes blackouts' do mock_app_config(blackout_exp_time: 5) blackout = instance_spy('blackout') allow(Blackout).to receive(:where).and_return([blackout]) described_class.perform_now expect(blackout).to have_received(:destroy) end it 'logs deletions' do mock_app_config(blackout_exp_time: 5) blackout = instance_spy('blackout') allow(Blackout).to receive(:where).and_return([blackout]) allow(Rails.logger).to receive(:info) described_class.perform_now expect(Rails.logger).to have_received(:info) .with("Deleting old blackout:\n #{blackout.inspect}").once end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/email_overdue_reminder_job_spec.rb
spec/jobs/email_overdue_reminder_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe EmailOverdueReminderJob, type: :job do it_behaves_like 'email job', { overdue_checkin_email_active?: true }, :overdue end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/daily_tasks_job_spec.rb
spec/jobs/daily_tasks_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe DailyTasksJob, type: :job do shared_examples 'enqueues' do |job| it "the #{job}" do expect(job).to receive(:perform_now) described_class.perform_now end end JOBS = [FlagOverdueJob, FlagMissedJob, DenyMissedRequestsJob, EmailCheckinReminderJob, EmailCheckoutReminderJob, EmailMissedReservationsJob, EmailOverdueReminderJob, DeleteOldBlackoutsJob, DeleteMissedReservationsJob].freeze JOBS.each { |job| it_behaves_like 'enqueues', job } end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/flag_overdue_job_spec.rb
spec/jobs/flag_overdue_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe FlagOverdueJob, type: :job do it_behaves_like 'flag job', { overdue: true }, :newly_overdue end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/hourly_tasks_job_spec.rb
spec/jobs/hourly_tasks_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe HourlyTasksJob, type: :job do it 'enqueues the email notes to admins job' do expect(EmailNotesToAdminsJob).to receive(:perform_now) described_class.perform_now end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/email_notes_to_admins_job_spec.rb
spec/jobs/email_notes_to_admins_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe EmailNotesToAdminsJob, type: :job do def stub_scope_chain(res, *chain) final = chain.pop chain.each do |scope| allow(Reservation).to receive(scope).and_return(Reservation) end allow(Reservation).to receive(final).and_return(res) end shared_examples 'admin email' do |scope| it 'sends emails' do res = spy('Array', empty?: false) allow(Reservation).to receive(scope).and_return(res) allow(res).to receive(:notes_unsent).and_return(res) allow(res).to receive(:update_all) expect(AdminMailer).to \ receive_message_chain(:notes_reservation_notification, :deliver_now) described_class.perform_now end it 'gets the appropriate reservations' do res = spy('Array', empty?: true) allow(Reservation).to receive(scope).and_return(res) allow(res).to receive(:notes_unsent).and_return(res) described_class.perform_now expect(Reservation).to have_received(scope) expect(res).to have_received(:notes_unsent) end it 'unsets the notes_unsent flag' do res = spy('Array', empty?: false) allow(Reservation).to receive(scope).and_return(res) allow(res).to receive(:notes_unsent).and_return(res) allow(AdminMailer).to \ receive_message_chain(:notes_reservation_notification, :deliver_now) described_class.perform_now expect(res).to have_received(:update_all).with(notes_unsent: false) end end it_behaves_like 'admin email', :checked_out it_behaves_like 'admin email', :returned end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/delete_missed_reservations_job_spec.rb
spec/jobs/delete_missed_reservations_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe DeleteMissedReservationsJob, type: :job do it "doesn't run when the res_exp_time parameter isn't set" do mock_app_config(res_exp_time: nil) allow(described_class).to receive(:run) described_class.perform_now expect(described_class).not_to have_received(:run) end it 'collects the appropriate reservations' do mock_app_config(res_exp_time: 5) allow(Reservation).to receive(:deletable_missed).and_return([]) described_class.perform_now expect(Reservation).to have_received(:deletable_missed) end describe '#run' do it 'deletes reservations' do mock_app_config(res_exp_time: 5) res = ReservationMock.new allow(Reservation).to receive(:deletable_missed).and_return([res]) described_class.perform_now expect(res).to have_received(:destroy) end it 'logs deletions' do mock_app_config(res_exp_time: 5) res = ReservationMock.new allow(Reservation).to receive(:deletable_missed).and_return([res]) allow(Rails.logger).to receive(:info) described_class.perform_now expect(Rails.logger).to have_received(:info) .with("Deleting reservation:\n #{res.inspect}").once end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/email_checkout_reminder_job_spec.rb
spec/jobs/email_checkout_reminder_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe EmailCheckoutReminderJob, type: :job do it_behaves_like 'email job', { upcoming_checkout_email_active: true }, :upcoming end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/email_missed_reservations_job_spec.rb
spec/jobs/email_missed_reservations_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe EmailMissedReservationsJob, type: :job do it_behaves_like 'email job', { send_notifications_for_deleted_missed_reservations: true }, :missed_not_emailed it 'sets the missed_email_sent flag' do mock_app_config(send_notifications_for_deleted_missed_reservations: true) res = ReservationMock.new allow(Reservation).to receive(:missed_not_emailed).and_return([res]) allow(UserMailer).to \ receive_message_chain(:reservation_status_update, :deliver_now) described_class.perform_now expect(res).to have_received(:flag).with(:missed_email_sent) expect(res).to have_received(:save!) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/deny_missed_requests_job_spec.rb
spec/jobs/deny_missed_requests_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe DenyMissedRequestsJob, type: :job do it_behaves_like 'email job', {}, :missed_requests it 'flags missed requests as denied and expired' do res = ReservationMock.new allow(Reservation).to receive(:missed_requests).and_return([res]) allow(UserMailer).to \ receive_message_chain(:reservation_status_update, :deliver_now) described_class.perform_now expect(res).to have_received(:expire!) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/email_checkin_reminder_job_spec.rb
spec/jobs/email_checkin_reminder_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe EmailCheckinReminderJob, type: :job do it_behaves_like 'email job', { upcoming_checkin_email_active: true }, :due_today end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/jobs/flag_missed_job_spec.rb
spec/jobs/flag_missed_job_spec.rb
# frozen_string_literal: true require 'spec_helper' describe FlagMissedJob, type: :job do it_behaves_like 'flag job', { status: 'missed' }, :newly_missed end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/app_config_helpers.rb
spec/support/app_config_helpers.rb
# frozen_string_literal: true module AppConfigHelpers def mock_app_config(**attrs) ac = spy('AppConfig', require_phone: false, **attrs) allow(AppConfig).to receive(:first).and_return(ac) ac end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/chromedriver.rb
spec/support/chromedriver.rb
# frozen_string_literal: true require 'selenium/webdriver' Capybara.register_driver :selenium_chrome_headless_docker_friendly do |app| Capybara::Selenium::Driver.load_selenium browser_options = ::Selenium::WebDriver::Chrome::Options.new browser_options.args << '--headless' browser_options.args << '--disable-gpu' # Sandbox cannot be used inside unprivileged Docker container browser_options.args << '--no-sandbox' Capybara::Selenium::Driver .new(app, browser: :chrome, options: browser_options) end Capybara.javascript_driver = :selenium_chrome_headless_docker_friendly
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/capybara_form_helper.rb
spec/support/capybara_form_helper.rb
# frozen_string_literal: true ## Load code after Capybara # see http://minimul.com/submitting-a-form-without-a-button-using-capybara.html module Capybara module Driver class Node def submit_form! raise NotImplementedError end end end module RackTest class Node def submit_form! Capybara::RackTest::Form.new(driver, native).submit({}) end end end module Node class Element delegate :submit_form!, to: :base end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/controller_helpers.rb
spec/support/controller_helpers.rb
# frozen_string_literal: true require Rails.root.join('spec/support/mockers/user_mock.rb') module ControllerHelpers def mock_user_sign_in(user = UserMock.new(traits: [:findable])) pass_app_setup_check allow(request.env['warden']).to receive(:authenticate!).and_return(user) # necessary for permissions to work allow(ApplicationController).to receive(:current_user).and_return(user) allow(Ability).to receive(:new).and_return(Ability.new(user)) allow_any_instance_of(described_class).to \ receive(:current_user).and_return(user) end def pass_app_setup_check allow(AppConfig).to receive(:first).and_return(true) unless AppConfig.first allow(User).to receive(:count).and_return(1) unless User.first end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/factory_girl.rb
spec/support/factory_girl.rb
# frozen_string_literal: true # Adds FactoryGirl methods to global context RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/feature_helpers.rb
spec/support/feature_helpers.rb
# frozen_string_literal: true module FeatureHelpers # make sure we have a working app def app_setup AppConfig.delete_all @app_config = mock_app_config(**FactoryGirl.attributes_for(:app_config)) @category = FactoryGirl.create(:category) @eq_model = FactoryGirl.create(:equipment_model, category: @category) @eq_item = FactoryGirl.create(:equipment_item, equipment_model: @eq_model) @admin = FactoryGirl.create(:admin) @superuser = FactoryGirl.create(:superuser) @checkout_person = FactoryGirl.create(:checkout_person) @user = FactoryGirl.create(:user) @banned = FactoryGirl.create(:banned) end def empty_cart visit '/' click_link 'Empty Cart' end def fill_in_registration fill_in 'Email', with: (0...8).map { (65 + rand(26)).chr }.join + '@example.com' fill_in 'user_password', with: 'passw0rd' fill_in 'user_password_confirmation', with: 'passw0rd' fill_in 'First name', with: 'John' fill_in 'Last name', with: 'Smith' fill_in 'Affiliation', with: 'Yale' end def fill_in_login(user = @user) fill_in 'Email', with: user.email fill_in 'Password', with: 'passw0rd' end def update_cart_start_date(new_date_str) # fill in both visible / datepicker and hidden field fill_in 'cart_start_date_cart', with: new_date_str find(:xpath, "//input[@id='date_start_alt']", visible: :all) .set new_date_str find('#cart_form').submit_form! end def update_cart_due_date(new_date_str) # fill in both visible / datepicker and hidden field fill_in 'cart_due_date_cart', with: new_date_str find(:xpath, "//input[@id='date_end_alt']", visible: :all).set new_date_str find('#cart_form').submit_form! end def add_item_to_cart(eq_model) # visit catalog to make sure our css selector works visit root_path within(:css, "#add_to_cart_#{eq_model.id}") do click_link 'Add to Cart' end end def change_reserver(reserver) fill_in 'Reserving For', with: reserver.id find('#cart_form').submit_form! end def sign_in_as_user(user) visit root_path click_link 'Sign In', match: :first fill_in_login(user) click_button 'Sign in' @current_user = user end def sign_out visit root_path click_link 'Log Out' if has_link?('Log Out') @current_user = nil end def current_user if @current_user @current_user else visit root_path click_link 'My Profile' email = find('.page-header h1 small').text @current_user = User.find_by(email: email) end end def admin_routes RailsAdmin::Engine.routes.url_helpers end def resource_url(obj, host = 'http://0.0.0.0:3000') return unless obj "#{host}#{send("#{obj.class.to_s.underscore}_path".to_sym, obj)}".strip end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/capybara_silence_puma.rb
spec/support/capybara_silence_puma.rb
# frozen_string_literal: true Capybara.server = :puma, { Silent: true }
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/calendarable.rb
spec/support/calendarable.rb
# frozen_string_literal: true require 'spec_helper' shared_examples_for 'calendarable' do |model| before(:each) do sign_in FactoryGirl.create(:admin) @obj = FactoryGirl.create(model.to_s.underscore.to_sym) @res = send("gen_#{model.to_s.underscore}_res".to_sym, @obj) @res2 = send("gen_#{model.to_s.underscore}_res".to_sym) end context 'GET calendar' do before { get :calendar, params: { id: @obj } } it 'stores instance variables' do expect(assigns(:resource)).to eq(@obj) expect(assigns(:src_path)).to \ eq("calendar_#{@obj.class.to_s.underscore}_path".to_sym) end it 'responds with HTML' do expect(response.media_type).to eq('text/html') end end context 'GET calendar dates' do it 'defaults to +/- 6 months' do get :calendar, params: { id: @obj } expect(assigns(:start_date)).to eq(Time.zone.today - 6.months) expect(assigns(:end_date)).to eq(Time.zone.today + 6.months) end it 'uses start and end' do start_date = Time.zone.today end_date = Time.zone.today + 1.day get :calendar, params: { id: @obj, start: start_date, end: end_date } expect(assigns(:start_date)).to eq(start_date) expect(assigns(:end_date)).to eq(end_date) end it 'uses calendar[start_date] and calendar[end_date]' do start_date = Time.zone.today end_date = Time.zone.today + 1.day get :calendar, params: { id: @obj, calendar: { start_date: start_date, end_date: end_date } } expect(assigns(:start_date)).to eq(start_date) expect(assigns(:end_date)).to eq(end_date) end end context 'GET calendar JSON' do before { get :calendar, params: { format: :json, id: @obj } } it 'stores reservations for the object correctly' do expect(assigns(:calendar_res)).to include(@res) expect(assigns(:calendar_res)).not_to include(@res2) end it 'stores other instance variables' do expect(assigns(:resource)).to eq(@obj) expect(assigns(:src_path)).to \ eq("calendar_#{@obj.class.to_s.underscore}_path".to_sym) end it 'responds with JSON' do expect(response.media_type).to eq('application/json') end end context 'GET calendar ICS' do before { get :calendar, params: { format: :ics, id: @obj } } it 'stores reservations for the object correctly' do expect(assigns(:calendar_res)).to include(@res) expect(assigns(:calendar_res)).not_to include(@res2) end it 'stores other instance variables' do expect(assigns(:resource)).to eq(@obj) expect(assigns(:src_path)).to \ eq("calendar_#{@obj.class.to_s.underscore}_path".to_sym) end it 'responds with ICS format' do expect(response.media_type).to eq('text/calendar') end end end def gen_user_res(user = nil) user ||= FactoryGirl.create(:user) gen_res(user) end def gen_category_res(cat = nil) cat ||= FactoryGirl.create(:category) gen_equipment_model_res(nil, cat) end def gen_equipment_model_res(em = nil, cat = nil) opts = cat ? { category: cat } : {} em ||= FactoryGirl.create(:equipment_model, opts) gen_equipment_item_res(nil, em) end def gen_equipment_item_res(ei = nil, em = nil) opts = em ? { equipment_model: em } : {} ei ||= FactoryGirl.create(:equipment_item, opts) gen_res(nil, ei) end def gen_res(user = nil, ei = nil) return if ei && ei.equipment_model.nil? # check for invalid ei ei ||= FactoryGirl.create(:equipment_item) user ||= FactoryGirl.create(:user) FactoryGirl.create(:valid_reservation, equipment_item: ei, reserver: user, equipment_model: ei.equipment_model) end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/env_helpers.rb
spec/support/env_helpers.rb
# frozen_string_literal: true module EnvHelpers # wrapper for modifying the environment variables for specific code # see: https://github.com/ScrappyAcademy/rock_candy def env_wrapper(envs = {}) # store original environment variables and set new ones orig_envs = ENV.select { |k, _| envs.key? k } envs.each { |k, v| ENV[k] = v } # run all the code yield ensure # ensure that we reset the environment for other code envs.each { |k, _| ENV.delete k } orig_envs.each { |k, v| ENV[k] = v } end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/warden_setup.rb
spec/support/warden_setup.rb
# frozen_string_literal: true # Warden test mode for authentication Warden.test_mode! # allows us to modify the session before the following request module InjectSession def inject_session(hash) Warden.on_next_request do |proxy| hash.each do |key, value| proxy.raw_session[key] = value end end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/mockers/user_mock.rb
spec/support/mockers/user_mock.rb
# frozen_string_literal: true require Rails.root.join('spec/support/mockers/mocker.rb') class UserMock < Mocker def initialize(role = :user, traits: [], **attrs) attrs = FactoryGirl.attributes_for(role).merge attrs traits = [:findable] if traits.empty? super(traits: traits, **attrs) end def self.klass User end def self.klass_name 'User' end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/mockers/reservation_mock.rb
spec/support/mockers/reservation_mock.rb
# frozen_string_literal: true require Rails.root.join('spec/support/mockers/mocker.rb') class ReservationMock < Mocker def self.klass Reservation end def self.klass_name 'Reservation' end private def for_user(user:) child_of_has_many(mocked_parent: user, parent_sym: :reserver, child_sym: :reservations) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/mockers/equipment_model_mock.rb
spec/support/mockers/equipment_model_mock.rb
# frozen_string_literal: true require Rails.root.join('spec/support/mockers/mocker.rb') require Rails.root.join('spec/support/mockers/category_mock.rb') require Rails.root.join('spec/support/mockers/equipment_item_mock.rb') class EquipmentModelMock < Mocker def self.klass EquipmentModel end def self.klass_name 'EquipmentModel' end private def with_item(item:) with_items(items: [item]) end def with_items(items: nil, count: 1) items ||= Array.new(count) { EquipmentItemMock.new } parent_has_many(mocked_children: items, parent_sym: :equipment_model, child_sym: :equipment_items) end def with_category(cat: nil) cat ||= CategoryMock.new child_of_has_many(mocked_parent: cat, parent_sym: :category, child_sym: :equipment_models) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/mockers/equipment_item_mock.rb
spec/support/mockers/equipment_item_mock.rb
# frozen_string_literal: true require Rails.root.join('spec/support/mockers/mocker.rb') require Rails.root.join('spec/support/mockers/equipment_model_mock.rb') class EquipmentItemMock < Mocker def self.klass EquipmentItem end def self.klass_name 'EquipmentItem' end private def with_model(model: nil) model ||= EquipmentModelMock.new child_of_has_many(mocked_parent: model, parent_sym: :equipment_model, child_sym: :equipment_items) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/mockers/category_mock.rb
spec/support/mockers/category_mock.rb
# frozen_string_literal: true require Rails.root.join('spec/support/mockers/mocker.rb') require Rails.root.join('spec/support/mockers/equipment_model_mock.rb') class CategoryMock < Mocker def self.klass Category end def self.klass_name 'Category' end private def with_equipment_models(models: nil, count: 1) models ||= Array.new(count) { EquipmentModelMock.new } parent_has_many(mocked_children: models, parent_sym: :category, child_sym: :equipment_models) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/mockers/mocker.rb
spec/support/mockers/mocker.rb
# frozen_string_literal: true require 'rspec/mocks/standalone' # This class behaves as an extension of rspec-mocks' instance_spy. # It is intended to be extended and used to make mocking models much simpler! # # To create a new subclass, the following methods must be overridden: # - self.klass must return the class that the subclass is mocking # - self.klass_name must return a string that matches the class being mocked # # Some examples using the EquipmentModelMock subclass: # A mock that can be "found" with EquipmentModel#find: # EquipmentModelMock.new(traits: [:findable]) # A mock with a set of attributes: # EquipmentModelMock.new(name: 'Camera', late_fee: 3) # A mock with attributes and method stubs: # EquipmentModelMock.new(name: 'Camera', model_restriced: false) # A findable mock with attributes: # EquipmentModelMock.new(traits: [:findable], name: 'Camera') # # A trait can be any method that exists on the mocker superclass or child class. # To create an EquipmentModel that belongs to an existing category, camera: # EquipmentModelMock.new(traits: [[:with_category, cat: camera]]) # # Use caution before adding methods -- any method defined here should be usable # by all subclasses, with the exception of the association stub methods. class Mocker < RSpec::Mocks::InstanceVerifyingDouble include RSpec::Mocks FIND_METHODS = [:find, :find_by_id].freeze def initialize(traits: [], **attrs) # from RSpec::Mocks::ExampleMethods # combination of #declare_verifying_double and #declare_double ref = ObjectReference.for(self.class.klass_name) RSpec::Mocks.configuration.verifying_double_callbacks.each do |block| block.call(ref) end attrs ||= {} super(ref, attrs) as_null_object process_traits(traits) end def process_traits(traits) traits.each { |t| send(*t) } end private def klass Object end def klass_name 'Object' end def spy self end # lets us use rspec-mock syntax in mockers def receive(method_name, &block) Matchers::Receive.new(method_name, block) end def allow(target) AllowanceTarget.new(target) end # Traits def findable id = FactoryGirl.generate(:unique_id) allow(spy).to receive(:id).and_return(id) FIND_METHODS.each do |method| allow(self.class.klass).to receive(method).with(id).and_return(spy) allow(self.class.klass).to receive(method).with(id.to_s).and_return(spy) end end # Generalized association stubs def child_of_has_many(mocked_parent:, parent_sym:, child_sym:) allow(spy).to receive(parent_sym).and_return(mocked_parent) children = if mocked_parent.send(child_sym).is_a? Array mocked_parent.send(child_sym) << spy else [spy] end allow(mocked_parent).to receive(child_sym).and_return(children) end def parent_has_many(mocked_children:, parent_sym:, child_sym:) if mocked_children.is_a? Array mocked_children.each do |child| allow(child).to receive(parent_sym).and_return(spy) end end allow(spy).to receive(child_sym).and_return(mocked_children) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/shared_examples/flag_job.rb
spec/support/shared_examples/flag_job.rb
# frozen_string_literal: true require 'spec_helper' shared_examples_for 'flag job' do |attr, scope| it 'updates the reservations status' do res = ReservationMock.new allow(Reservation).to receive(scope).and_return([res]) described_class.perform_now expect(res).to have_received(:update).with(attr) end it 'logs the update' do res = ReservationMock.new allow(Reservation).to receive(scope).and_return([res]) allow(Rails.logger).to receive(:info) described_class.perform_now expect(Rails.logger).to have_received(:info).at_least(:once) end it 'collects the appropriate reservations' do allow(Reservation).to receive(scope).and_return([]) described_class.perform_now expect(Reservation).to have_received(scope) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/shared_examples/email_job.rb
spec/support/shared_examples/email_job.rb
# frozen_string_literal: true require 'spec_helper' shared_examples_for 'email job' do |ac_setting, scope| it 'sends emails' do mock_app_config(ac_setting) res = ReservationMock.new allow(Reservation).to receive(scope).and_return([res]) expect(UserMailer).to \ receive_message_chain(:reservation_status_update, :deliver_now) described_class.perform_now end it 'gets the appropriate reservations' do mock_app_config(ac_setting) allow(Reservation).to receive(scope).and_return([]) described_class.perform_now expect(Reservation).to have_received(scope) end it 'logs emails' do mock_app_config(ac_setting) res = ReservationMock.new allow(Reservation).to receive(scope).and_return([res]) allow(Rails.logger).to receive(:info) described_class.perform_now expect(Rails.logger).to have_received(:info).at_least(:once) end it "doesn't send emails when disabled" do allow(described_class).to receive(:run) described_class.perform_now expect(described_class).not_to have_received(:run) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/shared_examples/controller_examples.rb
spec/support/shared_examples/controller_examples.rb
# frozen_string_literal: true require 'spec_helper' shared_examples_for 'successful request' do |template| it { is_expected.to respond_with(:success) } it { is_expected.to render_template(template) } it { is_expected.not_to set_flash } end shared_examples_for 'redirected request' do it { expect(response).to be_redirect } it { is_expected.to set_flash } end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/shared_examples/concerns/soft_deletable.rb
spec/support/shared_examples/concerns/soft_deletable.rb
# frozen_string_literal: true require 'spec_helper' shared_examples_for 'soft deletable' do let(:model) { described_class } describe '#deleted?' do it 'returns true if the deleted_at attribute is present' do obj = model.new(deleted_at: Time.zone.now) expect(obj).to be_deleted end it 'returns false if the deleted_at attribute is nil' do obj = model.new(deleted_at: nil) expect(obj).not_to be_deleted end end describe '#destroy' do let!(:obj) { FactoryGirl.create(model.to_s.underscore.to_sym) } it 'sets the deleted_at attribute by default' do allow(obj).to receive(:deleted?).and_return(false) allow(obj).to receive(:associated_records).and_return([]) # rounding necessary due to MySQL rounding in the database time = Time.zone.now.round(0) Timecop.freeze(time) do expect { obj.destroy }.to change { obj.reload.deleted_at } .from(nil).to(time) end end it 'actually destroys the object if :force is passed' do expect { obj.destroy(:force) }.to change { model.count }.by(-1) end it 'returns the object if it has already been deleted' do allow(obj).to receive(:deleted?).and_return(true) expect(obj.destroy).to eq(obj) end context 'with associations' do let(:associated) { instance_spy(model) } before do allow(obj).to receive(:associated_records).and_return([associated]) end it 'calls destroy on associated records' do obj.destroy expect(associated).to have_received(:destroy) end it 'passes along the force parameter' do obj.destroy(:force) expect(associated).to have_received(:destroy).with(:force) end end end describe '#revive' do let!(:obj) { FactoryGirl.create(model.to_s.underscore.to_sym) } it 'unsets the deleted_at attribute by default' do obj.update!(deleted_at: Time.zone.now) # necessary so that it changes allow(obj).to receive(:deleted?).and_return(true) allow(obj).to receive(:associated_records).and_return([]) expect { obj.revive }.to change { obj.reload.deleted_at }.to(nil) end it 'returns the object if it is not deleted' do allow(obj).to receive(:deleted?).and_return(false) expect(obj.revive).to eq(obj) end context 'with associations' do let(:associated) { instance_spy(model) } before do allow(obj).to receive(:associated_records).and_return([associated]) end it 'calls revive on associated records' do allow(obj).to receive(:deleted?).and_return(true) obj.revive expect(associated).to have_received(:revive) end end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/shared_examples/concerns/linkable.rb
spec/support/shared_examples/concerns/linkable.rb
# frozen_string_literal: true # based on http://stackoverflow.com/a/20010923/2187922 require 'spec_helper' shared_examples_for 'linkable' do let(:model) { described_class } # the class that includes the concern context 'with no parameter' do it 'generates a markdown link with name as text when object exists' do obj = FactoryGirl.build(model.to_s.underscore.to_sym) obj.save(validate: false) # test without URL so we don't need to include routing here expect(obj.md_link).to include("[#{obj.name}](") end it "simply returns the name when object doesn't exist" do obj = FactoryGirl.build(model.to_s.underscore.to_sym) expect(obj.md_link).to eq(obj.name) end end context 'when text is passed' do it 'generates a markdown link with custom text when object exists' do obj = FactoryGirl.build(model.to_s.underscore.to_sym) obj.save(validate: false) # test without URL so we don't need to include routing here expect(obj.md_link('foo')).to include('[foo](') end it "simply returns the name when object doesn't exist" do obj = FactoryGirl.build(model.to_s.underscore.to_sym) expect(obj.md_link('foo')).to eq('foo') end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/support/shared_contexts/rake.rb
spec/support/shared_contexts/rake.rb
# frozen_string_literal: true # see http://robots.thoughtbot.com/test-rake-tasks-like-a-boss require 'rake' shared_context 'rake' do let(:rake) { Rake::Application.new } let(:task_name) { self.class.top_level_description } let(:task_path) { "lib/tasks/#{task_name.split(':').first}" } subject { rake[task_name] } def loaded_files_excluding_current_rake_file $LOADED_FEATURES.reject do |file| file == Rails.root.join("#{task_path}.rake").to_s end end before do Rake.application = rake Rake.application.rake_require(task_path, [Rails.root.to_s], loaded_files_excluding_current_rake_file) Rake::Task.define_task(:environment) end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/helpers/reservations_helper_spec.rb
spec/helpers/reservations_helper_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe ReservationsHelper, type: :helper do describe '.manage_reservations_btn' do let!(:reservation) { create(:valid_reservation) } context 'when reservation is a request' do before { reservation.update!(status: 'requested') } context 'and can manage requests' do before do allow(helper).to receive(:can?) .with(:override, :reservation_errors) .and_return(true) end it 'returns a link to review request' do @reservation = reservation expect(helper.manage_reservations_btn).to \ match(/Review Request/) end it 'links to the right url' do @reservation = reservation expect(helper.manage_reservations_btn).to \ match(%r{href="/reservations/review/#{@reservation.id}}) end end context 'cannot manage requests' do before do allow(helper).to receive(:can?) .with(:override, :reservation_errors) .and_return(false) end it 'returns nil' do @reservation = reservation expect(helper.manage_reservations_btn).to be_nil end end end context 'when reservation is reserved' do it 'returns a link to check out the reservation' do @reservation = reservation expect(helper.manage_reservations_btn).to match(/Check-Out/) end it 'links to the right url' do @reservation = reservation expect(helper.manage_reservations_btn).to \ match(%r{href="/reservations/manage/#{@reservation.reserver.id}}) end end context 'when reservation is checked out' do before do item = reservation.equipment_model.equipment_items.first params = ActionController::Parameters.new reservation.checkout(item.id, reservation.reserver, params, '').save! end it 'returns a link to check in the reservation' do @reservation = reservation expect(helper.manage_reservations_btn).to match(/Check-In/) end it 'links to the right url' do @reservation = reservation expect(helper.manage_reservations_btn).to \ match(%r{href="/reservations/manage/#{@reservation.reserver.id}}) end end context 'when reservation is checked in' do it 'returns nil' do @reservation = build(:reservation, :returned) @reservation.save!(validate: false) expect(helper.manage_reservations_btn).to be_nil end end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/helpers/email_helper_spec.rb
spec/helpers/email_helper_spec.rb
# frozen_string_literal: true require 'spec_helper.rb' def expect_email(email) delivered = ActionMailer::Base.deliveries.last expected = email.deliver_now expect(delivered.multipart?).to eq(expected.multipart?) expect(delivered.headers.except('Message-Id')).to\ eq(expected.headers.except('Message-Id')) end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/helpers/announcements_helper_spec.rb
spec/helpers/announcements_helper_spec.rb
# frozen_string_literal: true require 'spec_helper' # Specs in this file have access to a helper object that includes # the AnnouncementsHelper. For example: # # describe AnnouncementsHelper do # describe "string concat" do # it "concats two strings with spaces" do # helper.concat_strings("this","that").should == "this that" # end # end # end describe AnnouncementsHelper, type: :helper do pending "add some examples to (or delete) #{__FILE__}" end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/helpers/user_mailer_helper_spec.rb
spec/helpers/user_mailer_helper_spec.rb
# frozen_string_literal: true require 'spec_helper' describe UserMailerHelper, type: :helper do before(:each) do @app_configs = double(department_name: 'dept', terms_of_service: 'tos') @reservation = double(id: 1, reserver: double(name: 'name'), equipment_model: double(name: 'em', late_fee: 100, replacement_fee: 200), start_date: Time.zone.today, due_date: Time.zone.today + 1.day) end context '.replace_variables' do it 'returns an empty string when no body is passed' do expect(replace_variables(nil)).to eq('') end it 'replaces @user@ with the reserver name' do expect(replace_variables('@user@')).to eq(@reservation.reserver.name) end it 'replaces @reservation_id@ with the reservation id' do expect(replace_variables('@reservation_id@')).to eq(@reservation.id.to_s) end it 'replaces @department_name@ with the department name' do expect(replace_variables('@department_name@')).to \ eq(@app_configs.department_name) end it 'replaces @equipment_list@ with the equipment model name' do expect(replace_variables('@equipment_list@')).to \ eq(@reservation.equipment_model.name) end it 'replaces @return_date@ with the due date' do expect(replace_variables('@return_date@')).to \ eq(@reservation.due_date.to_s(:long)) end it 'replaces @start_date@ with the start date' do expect(replace_variables('@start_date@')).to \ eq(@reservation.start_date.to_s(:long)) end it 'replaces @late_fee@ with the equipment model late fee rate' do expect(replace_variables('@late_fee@')).to \ eq(number_to_currency(@reservation.equipment_model.late_fee)) end it 'replaces @replacement_fee@ with the equipment model replacement fee' do expect(replace_variables('@replacement_fee@')).to \ eq(number_to_currency(@reservation.equipment_model.replacement_fee)) end it 'replaces @tos@ with the terms of service' do expect(replace_variables('@tos@')).to eq(@app_configs.terms_of_service) end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/helpers/equipment_model_helper_spec.rb
spec/helpers/equipment_model_helper_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe EquipmentModelsHelper do describe '.available_item_select_options' do it 'makes a string listing the available items' do model = FactoryGirl.create(:equipment_model) FactoryGirl.create(:checked_out_reservation, equipment_model: model) item = FactoryGirl.create(:equipment_item, equipment_model: model) expect(available_item_select_options(model)).to \ eq("<option value=#{item.id}>#{item.name}</option>") end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/helpers/users_helper_spec.rb
spec/helpers/users_helper_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe UsersHelper, type: :helper do describe '.tos_attestation' do let(:user1) { FactoryGirl.build_stubbed :user } let(:user2) { FactoryGirl.build_stubbed :user } it 'returns "I accept" when the user is acting on their own behalf' do result = helper.tos_attestation(current_user: user1, user: user1) expect(result).to eq('I accept') end it "returns 'User accepts' when the user is acting on another's behalf" do result = helper.tos_attestation(current_user: user1, user: user2) expect(result).to eq('User accepts') end it 'returns "I accept" when the current user is not present' do result = helper.tos_attestation(current_user: nil, user: user1) expect(result).to eq('I accept') end end describe '.user_viewing_other_user?' do let(:user1) { FactoryGirl.build_stubbed :user } let(:user2) { FactoryGirl.build_stubbed :user } it 'returns true when a user is signed in and viewing another user' do result = helper.user_viewing_other_user?(current_user: user1, user: user2) expect(result).to be_truthy end it 'returns false when a user is signed in and viewing themselves' do result = helper.user_viewing_other_user?(current_user: user1, user: user1) expect(result).to be_falsey end it 'returns false when a user is not signed in' do result = helper.user_viewing_other_user?(current_user: nil, user: user1) expect(result).to be_falsey end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
# frozen_string_literal: true require 'spec_helper' describe ApplicationHelper, type: :helper do pending 'specs for methods' end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/helpers/requirements_helper_spec.rb
spec/helpers/requirements_helper_spec.rb
# frozen_string_literal: true require 'spec_helper' RSpec.describe RequirementsHelper do describe '#list_requirement_admins' do before(:each) do @requirement = FactoryGirl.create(:requirement) @another_requirement = FactoryGirl.create(:another_requirement) @equipment_model = FactoryGirl.create(:equipment_model, requirements: [@requirement, @another_requirement]) @user_with_unmet_requirement = FactoryGirl.create(:user) @user_that_meets_some_requirements = FactoryGirl.create(:user, requirements: [@requirement]) end it 'should return a list of admins and contact info if no requirements '\ 'have been met.' do req_message = 'This model requires proper training before it can be '\ "reserved. Please contact #{@requirement.contact_name} and "\ "#{@another_requirement.contact_name} respectively at "\ "#{@requirement.contact_info} and "\ "#{@another_requirement.contact_info} about becoming certified." expect(list_requirement_admins(@user_with_unmet_requirement, @equipment_model)).to include(req_message) end it 'should return a list of met requirements, followed by unmet '\ 'requirements if they exists' do req_message = 'You have already met the requirements to check out this '\ "model set by #{@requirement.contact_name}. However, this model "\ 'requires additional training before it can be reserved. Please '\ "contact #{@another_requirement.contact_name} at "\ "#{@another_requirement.contact_info} about becoming certified." expect(list_requirement_admins(@user_that_meets_some_requirements, @equipment_model)).to include(req_message) end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/users.rb
spec/factories/users.rb
# frozen_string_literal: true # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do sequence :username do |n| "abc#{n}" end factory :user, aliases: %i[reserver checkout_handler checkin_handler] do sequence(:cas_login) { |n| "netid#{n}" } first_name 'First' last_name 'Last' affiliation 'Yale' email { "#{cas_login}@example.edu".downcase } phone '555-555-5555' terms_of_service_accepted true created_by_admin false role 'normal' view_mode 'normal' if ENV['CAS_AUTH'].present? username { cas_login } else username { email } password 'passw0rd' password_confirmation 'passw0rd' end factory :superuser do role 'superuser' view_mode 'superuser' end factory :admin do role 'admin' view_mode 'admin' end factory :checkout_person do role 'checkout' view_mode 'checkout' end factory :banned do role 'banned' view_mode 'banned' end factory :guest do role 'guest' view_mode 'guest' end factory :no_phone do phone '' end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/carts.rb
spec/factories/carts.rb
# frozen_string_literal: true FactoryGirl.define do factory :cart do reserver_id { FactoryGirl.create(:user).id } start_date { Time.zone.today } due_date { Time.zone.today + 1.day } items {} factory :cart_with_items do items do e = FactoryGirl.create(:equipment_model) FactoryGirl.create(:equipment_item, equipment_model: e) { e.id => 1 } end end factory :invalid_cart do items do e = FactoryGirl.create(:equipment_model) FactoryGirl.create(:equipment_item, equipment_model: e) { e.id => 1 } end start_date Time.zone.today due_date do Time.zone.today\ + EquipmentModel.find(items.keys.first).category.max_checkout_length\ + 2.days end end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/blackouts.rb
spec/factories/blackouts.rb
# frozen_string_literal: true # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :blackout do notice 'MyText' blackout_type 'hard' start_date Time.zone.today end_date { Time.zone.today + 7.days } end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/equipment_models.rb
spec/factories/equipment_models.rb
# frozen_string_literal: true # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do sequence(:unique_id) { |n| n } factory :equipment_model do name description 'This is a model' late_fee '37.50' replacement_fee '20' max_per_user 10 category max_renewal_times 10 max_renewal_length 10 renewal_days_before_due 10 factory :restricted_equipment_model do category { FactoryGirl.create(:category, max_per_user: 1) } end factory :equipment_model_with_item do after(:create) do |model| FactoryGirl.create(:equipment_item, equipment_model: model) end end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/app_configs.rb
spec/factories/app_configs.rb
# frozen_string_literal: true # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :app_config do upcoming_checkin_email_active true upcoming_checkout_email_active true reservation_confirmation_email_active true site_title 'Reservations Specs' admin_email 'my@email.com' department_name 'MyString' contact_link_location 'contact@email.com' home_link_text 'MyString' home_link_location 'MyString' default_per_cat_page 10 upcoming_checkin_email_body 'MyText' upcoming_checkout_email_body 'MyText' overdue_checkin_email_body 'MyText' overdue_checkin_email_active true terms_of_service 'TOS' deleted_missed_reservation_email_body 'MyText' send_notifications_for_deleted_missed_reservations true notify_admin_on_create false checkout_persons_can_edit false request_text 'tell me whyyy?' end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/checkout_procedures.rb
spec/factories/checkout_procedures.rb
# frozen_string_literal: true FactoryGirl.define do factory :checkout_procedure do equipment_model_id { FactoryGirl.create(:equipment_model).id } step 'This is a step of the check-out procedure.' created_at { Time.zone.today - 1.day } updated_at { Time.zone.today } trait :deleted do deleted_at { Time.zone.today } end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/reservations.rb
spec/factories/reservations.rb
# frozen_string_literal: true # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :reservation do start_date { Time.zone.today } due_date { Time.zone.today + 1.day } reserver equipment_model status { 'reserved' } trait :valid do after(:build) do |res| # for some reason this code is required instead of just calling it on # res.equipment_model mod = EquipmentModel.find(res.equipment_model_id) if mod.equipment_items.empty? FactoryGirl.create(:equipment_item, equipment_model: mod) end end end trait :request do start_date { Time.zone.today } due_date { Time.zone.today + 1.day } status { 'requested' } flags { 1 | Reservation::FLAGS[:request] } end trait :reserved do start_date { Time.zone.today } due_date { Time.zone.today + 1.day } status { 'reserved' } end trait :checked_out do checked_out { Time.zone.today } status { 'checked_out' } checkout_handler after(:build) do |res| mod = EquipmentModel.find(res.equipment_model_id) res.equipment_item = mod.equipment_items.first end end trait :missed do start_date { Time.zone.yesterday } due_date { Time.zone.today } status { 'missed' } end trait :returned do start_date { Time.zone.today - 1.day } due_date { Time.zone.today } checked_out { Time.zone.today - 1.day } checked_in { Time.zone.today } status { 'returned' } checkin_handler end trait :upcoming do start_date { Time.zone.today } end trait :overdue do start_date { Time.zone.today - 2.days } due_date { Time.zone.today - 1.day } checked_out { Time.zone.today - 2.days } overdue { true } after(:build) do |res| mod = EquipmentModel.find(res.equipment_model_id) res.equipment_item = mod.equipment_items.first end end trait :archived do status { 'archived' } end trait :past do before(:create) do |res| travel_to(res.start_date) res.save travel_back end end factory :valid_reservation, traits: [:valid] factory :checked_out_reservation, traits: [:valid, :checked_out, :past] factory :checked_in_reservation, traits: [:valid, :checked_out, :returned, :past] factory :overdue_reservation, traits: [:valid, :checked_out, :overdue, :past] factory :overdue_returned_reservation, traits: [:valid, :checked_out, :returned, :overdue, :past] factory :upcoming_reservation, traits: [:valid, :upcoming] factory :missed_reservation, traits: [:valid, :missed, :past] factory :archived_reservation, traits: [:valid, :archived] factory :request, traits: [:valid, :request] end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/checkin_procedures.rb
spec/factories/checkin_procedures.rb
# frozen_string_literal: true FactoryGirl.define do factory :checkin_procedure do equipment_model_id { FactoryGirl.create(:equipment_model).id } step 'This is a step of the check-in procedure.' created_at { Time.zone.today - 1.day } updated_at { Time.zone.today } trait :deleted do deleted_at { Time.zone.today } end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/equipment_items.rb
spec/factories/equipment_items.rb
# frozen_string_literal: true # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do # Sequences defined in _sequences.rb factory :equipment_item do name 'name' serial equipment_model factory: :equipment_model deactivation_reason nil notes '' factory :deactivated_item do deactivation_reason 'Because I can' deleted_at '2013-01-01 00:00:00' end end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/announcements.rb
spec/factories/announcements.rb
# frozen_string_literal: true # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :announcement do message 'MyText' starts_at Time.zone.today ends_at Time.zone.today + 1.day end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/messages.rb
spec/factories/messages.rb
# frozen_string_literal: true # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :message do name { generate(:name) } email { "#{name}@yale.edu".downcase } subject 'Message' body 'Typewriter tumblr actually, locavore tofu Etsy kitsch pug next '\ 'level ugh pickled lomo single-origin coffee fingerstache. Echo Park '\ 'Odd Future 3 wolf moon tofu, narwhal wayfarers Portland readymade '\ 'plaid. Intelligentsia occupy Pinterest Bushwick, lomo flannel '\ 'actually meh mumblecore lo-fi ugh. Retro Echo Park next level '\ 'shoreditch typewriter. Godard irony keffiyeh chambray gluten-free, '\ 'YOLO 3 wolf moon swag flannel fap cred sartorial kogi sriracha. '\ 'Tumblr ugh viral keytar, semiotics fingerstache Godard Vice Cosby '\ 'sweater. Forage yr whatever salvia tote bag.' end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false
YaleSTC/reservations
https://github.com/YaleSTC/reservations/blob/2d5f0b2511a50787d79023bb3bbd148160dc3cc2/spec/factories/categories.rb
spec/factories/categories.rb
# frozen_string_literal: true # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :category do name sort_order max_per_user 5 max_checkout_length 10 end end
ruby
MIT
2d5f0b2511a50787d79023bb3bbd148160dc3cc2
2026-01-04T17:43:15.442188Z
false