source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
diowa/icare
https://github.com/diowa/icare
app/services/itinerary_search.rb
Ruby
bsd-2-clause
249
main
2,578
# frozen_string_literal: true class ItinerarySearch SEARCH_RADIUS_METERS = 5000 GEO_WHERE_CONDITION = 'ST_DWithin(start_location, Geography(ST_MakePoint(:start_lon, :start_lat)), :search_meters) AND ST_DWithin(end_location, Geography(ST_MakePoint(:end_lon, :end_lat)), :search_meters)' def self.call(params, user...
github
diowa/icare
https://github.com/diowa/icare
app/services/authorization_service.rb
Ruby
bsd-2-clause
249
main
374
# frozen_string_literal: true module AuthorizationService extend self delegate :delete_user, to: :auth0_client private def auth0_client @auth0_client ||= Auth0Client.new( client_id: APP_CONFIG.auth0.client_id, client_secret: APP_CONFIG.auth0.client_secret, domain: APP_CONFIG...
github
diowa/icare
https://github.com/diowa/icare
app/helpers/conversations_helper.rb
Ruby
bsd-2-clause
249
main
1,037
# frozen_string_literal: true module ConversationsHelper def message_classes(alternate, message, current_user) [('alternate' if alternate), ('unread' if message.sender != current_user && message.unread?)].join(' ') end def message_timestamp(message) tag.small(title: I18n.l(message.created_at.in_time_zon...
github
diowa/icare
https://github.com/diowa/icare
app/helpers/notifications_helper.rb
Ruby
bsd-2-clause
249
main
508
# frozen_string_literal: true module NotificationsHelper def notifications_tag(type, icon) tag.li class: 'notifications', id: "notifications-#{type}" do link_to send(:"#{type}_path"), data: { notifications_type: type, bs_toggle: 'popover', unread: current_user.public_send(:"unread_#{type}_count"), remote: ...
github
diowa/icare
https://github.com/diowa/icare
app/helpers/itineraries_helper.rb
Ruby
bsd-2-clause
249
main
655
# frozen_string_literal: true module ItinerariesHelper def boolean_options_for_select @boolean_options_for_select ||= [[t('boolean.true'), true], [t('boolean.false'), false]] end def default_leave_date @default_leave_date ||= Time.current.change(min: (Time.current.min / 10) * 10) + 10.minutes end d...
github
diowa/icare
https://github.com/diowa/icare
app/helpers/application_helper.rb
Ruby
bsd-2-clause
249
main
1,296
# frozen_string_literal: true module ApplicationHelper def google_maps_api_source if APP_CONFIG.google_maps_api_key "https://maps.googleapis.com/maps/api/js?libraries=geometry&callback=initMap&key=#{APP_CONFIG.google_maps_api_key}" else 'https://maps.googleapis.com/maps/api/js?libraries=geometry&...
github
diowa/icare
https://github.com/diowa/icare
app/helpers/users_helper.rb
Ruby
bsd-2-clause
249
main
558
# frozen_string_literal: true module UsersHelper DEFAULT_USER_PROFILE_SIZE = 40 def auth0_profile_picture(user, type = :square) if user_signed_in? && user.image? "#{user.image}?type=#{type}" else asset_pack_path('static/images/user.jpg') end end def user_profile_picture(user, size: DE...
github
diowa/icare
https://github.com/diowa/icare
app/controllers/itineraries_controller.rb
Ruby
bsd-2-clause
249
main
2,348
# frozen_string_literal: true class ItinerariesController < ApplicationController skip_before_action :authenticate_user!, only: [:show] before_action :set_itinerary, only: [:show] before_action :check_female, only: [:show] before_action :check_permissions def index # @itineraries = Itinerary.includes(...
github
diowa/icare
https://github.com/diowa/icare
app/controllers/feedbacks_controller.rb
Ruby
bsd-2-clause
249
main
1,603
# frozen_string_literal: true class FeedbacksController < ApplicationController before_action :set_feedback, only: %i[show edit update destroy] before_action :check_owner_or_admin, only: %i[edit update destroy] helper_method :feedback_attributes def index @feedbacks = Feedback.includes(:user).order(updat...
github
diowa/icare
https://github.com/diowa/icare
app/controllers/users_controller.rb
Ruby
bsd-2-clause
249
main
1,136
# frozen_string_literal: true class UsersController < ApplicationController before_action :set_user_as_current_user, only: %i[update dashboard itineraries settings] def show @user = User.find(params[:id]) end def update if @user.update(user_params) redirect_to :settings, flash: { success: t('fl...
github
diowa/icare
https://github.com/diowa/icare
app/controllers/application_controller.rb
Ruby
bsd-2-clause
249
main
688
# frozen_string_literal: true class ApplicationController < ActionController::Base include RouteLocalizer protect_from_forgery with: :exception before_action :authenticate_user! before_action :check_banned, except: [:banned], if: :user_signed_in? around_action :localize_route around_action :time_zone_fr...
github
diowa/icare
https://github.com/diowa/icare
app/controllers/conversations_controller.rb
Ruby
bsd-2-clause
249
main
1,870
# frozen_string_literal: true class ConversationsController < ApplicationController after_action :mark_as_read, only: [:show] def index @conversations = current_user.conversations.order(updated_at: :desc).page params[:page] end def show @conversation = current_user.conversations.includes(messages: :s...
github
diowa/icare
https://github.com/diowa/icare
app/controllers/users/omniauth_callbacks_controller.rb
Ruby
bsd-2-clause
249
main
587
# frozen_string_literal: true module Users class OmniauthCallbacksController < ::Devise::OmniauthCallbacksController def auth0 @user = User.from_omniauth(auth_hash) if @user.persisted? @user.update_info_from_auth_hash! auth_hash sign_in_and_redirect @user, event: :authentication ...
github
diowa/icare
https://github.com/diowa/icare
app/controllers/admin/users_controller.rb
Ruby
bsd-2-clause
249
main
1,097
# frozen_string_literal: true module Admin class UsersController < BaseController before_action :set_user, only: %i[login_as ban unban] before_action :prevent_autoban, only: %i[ban unban] def index @users = User.order(:name).page params[:page] end def login_as sign_in_and_redirect :...
github
diowa/icare
https://github.com/diowa/icare
app/controllers/admin/base_controller.rb
Ruby
bsd-2-clause
249
main
280
# frozen_string_literal: true module Admin class BaseController < ::ApplicationController before_action :check_admin private def check_admin redirect_to root_path, flash: { error: t('flash.errors.not_allowed') } unless current_user.admin? end end end
github
diowa/icare
https://github.com/diowa/icare
app/controllers/concerns/route_localizer.rb
Ruby
bsd-2-clause
249
main
716
# frozen_string_literal: true module RouteLocalizer extend ActiveSupport::Concern included do private def available_locale_from(*locales) (locales.compact.map(&:to_sym) & I18n.available_locales).first end def locale_from_http_request http_accept_language.preferred_language_from(I18n....
github
diowa/icare
https://github.com/diowa/icare
app/models/user.rb
Ruby
bsd-2-clause
249
main
1,505
# frozen_string_literal: true class User < ApplicationRecord include Auth0Omniauthable # Include default devise modules. Others available are: devise :omniauthable, omniauth_providers: [:auth0] # :confirmable, :lockable, :timeoutable and :omniauthable # :database_authenticatable, :registerable, # :recover...
github
diowa/icare
https://github.com/diowa/icare
app/models/conversation.rb
Ruby
bsd-2-clause
249
main
1,113
# frozen_string_literal: true class Conversation < ApplicationRecord belongs_to :sender, class_name: 'User' belongs_to :receiver, class_name: 'User' has_many :messages, dependent: :destroy belongs_to :conversable, polymorphic: true has_and_belongs_to_many :users scope :unread, lambda { |user| joins...
github
diowa/icare
https://github.com/diowa/icare
app/models/itinerary.rb
Ruby
bsd-2-clause
249
main
1,464
# frozen_string_literal: true class Itinerary < ApplicationRecord include GeoItinerary extend FriendlyId DAYNAME = %w[Sunday Monday Tuesday Wednesday Thursday Friday Saturday].freeze MAX_DESCRIPTION_LENGTH = 1000 friendly_id :name, use: :slugged def name [start_address, end_address].join ' ' end ...
github
diowa/icare
https://github.com/diowa/icare
app/models/feedback.rb
Ruby
bsd-2-clause
249
main
547
# frozen_string_literal: true class Feedback < ApplicationRecord enum :category, { bug: 'bug', idea: 'idea' } enum :status, { normal: 'normal', fixed: 'fixed', in_progress: 'in_progress', not_applicable: 'not_applicable' } belongs_to :user delegate :name, to: ...
github
diowa/icare
https://github.com/diowa/icare
app/models/message.rb
Ruby
bsd-2-clause
249
main
282
# frozen_string_literal: true class Message < ApplicationRecord belongs_to :conversation belongs_to :sender, class_name: 'User' validates :body, presence: true, length: { maximum: 1000 } scope :unread, -> { where(read_at: nil) } def unread? read_at.nil? end end
github
diowa/icare
https://github.com/diowa/icare
app/models/itineraries/search.rb
Ruby
bsd-2-clause
249
main
429
# frozen_string_literal: true module Itineraries class Search include ::ActiveModel::Model attr_accessor :from, :to, :start_location_lat, :start_location_lng, :end_location_lat, :end_location_lng, :filter_round_trip, :filter_pink, :filter_smoking_allowed, :filter_pets_all...
github
diowa/icare
https://github.com/diowa/icare
app/models/concerns/geo_itinerary.rb
Ruby
bsd-2-clause
249
main
2,428
# frozen_string_literal: true module GeoItinerary extend ActiveSupport::Concern RGEO_FACTORY = RGeo::Geographic.simple_mercator_factory(buffer_resolution: 4) LINEAR_RING = RGEO_FACTORY.linear_ring(APP_CONFIG.itineraries.bounds.map { |p| RGeo::Geographic.spherical_factory.point(*p) }) included do attr_acc...
github
diowa/icare
https://github.com/diowa/icare
app/models/concerns/auth0_omniauthable.rb
Ruby
bsd-2-clause
249
main
691
# frozen_string_literal: true module Auth0Omniauthable extend ActiveSupport::Concern included do after_destroy :delete_from_authentication_provider!, if: -> { APP_CONFIG.demo_mode } def update_info_from_auth_hash!(auth_hash) update( email: auth_hash.info.email, ima...
github
diowa/icare
https://github.com/diowa/icare
config/routes.rb
Ruby
bsd-2-clause
249
main
1,272
# frozen_string_literal: true Rails.application.routes.draw do devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' } devise_scope :user do delete 'sign_out', to: 'devise/sessions#destroy', as: :destroy_user_session end root to: 'pages#home' resources :conversations, only: %...
github
diowa/icare
https://github.com/diowa/icare
config/environment.rb
Ruby
bsd-2-clause
249
main
221
# frozen_string_literal: true # Load the Rails application. require_relative 'application' # TODO: Replace with figaro require_relative 'configuration' # Initialize the Rails application. Rails.application.initialize!
github
diowa/icare
https://github.com/diowa/icare
config/configuration.rb
Ruby
bsd-2-clause
249
main
898
# frozen_string_literal: true SimpleConfig.for :application do # Set here your global configuration. # All settings can be overwritten later per-environment. load Rails.root.join('config/settings/application.rb'), if_exists?: true # Per Environment settings. # At startup only the file matching current envir...
github
diowa/icare
https://github.com/diowa/icare
config/application.rb
Ruby
bsd-2-clause
249
main
1,688
# frozen_string_literal: true require_relative 'boot' require 'rails' # Pick the frameworks you want: require 'active_model/railtie' require 'active_job/railtie' require 'active_record/railtie' # require "active_storage/engine" require 'action_controller/railtie' require 'action_mailer/railtie' # require "action_mail...
github
diowa/icare
https://github.com/diowa/icare
config/initializers/client_side_validations.rb
Ruby
bsd-2-clause
249
main
883
# frozen_string_literal: true # ClientSideValidations Initializer # Disabled validators # ClientSideValidations::Config.disabled_validators = [] # Uncomment to validate number format with current I18n locale # ClientSideValidations::Config.number_format_with_locale = true # Uncomment the following block if you want...
github
diowa/icare
https://github.com/diowa/icare
config/initializers/secure_headers.rb
Ruby
bsd-2-clause
249
main
748
# frozen_string_literal: true SecureHeaders::Configuration.default do |config| config.cookies = { secure: true, httponly: true, samesite: { lax: true } } config.hsts = "max-age=#{20.weeks.to_i}; includeSubdomains" config.x_frame_options = ...
github
diowa/icare
https://github.com/diowa/icare
config/initializers/filter_parameter_logging.rb
Ruby
bsd-2-clause
249
main
464
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. # Use this to limit dissemination of sensitive information. # See the ActiveSupport::ParameterFilter documentation for ...
github
diowa/icare
https://github.com/diowa/icare
config/initializers/airbrake.rb
Ruby
bsd-2-clause
249
main
3,423
# frozen_string_literal: true # Airbrake is an online tool that provides robust exception tracking in your Rails # applications. In doing so, it allows you to easily review errors, tie an error # to an individual piece of code, and trace the cause back to recent # changes. Airbrake enables for easy categorization, sea...
github
diowa/icare
https://github.com/diowa/icare
config/initializers/simple_form_bootstrap.rb
Ruby
bsd-2-clause
249
main
18,863
# frozen_string_literal: true # Please do not make direct changes to this file! # This generator is maintained by the community around simple_form-bootstrap: # https://github.com/heartcombo/simple_form-bootstrap # All future development, tests, and organization should happen there. # Background history: https://github...
github
diowa/icare
https://github.com/diowa/icare
config/initializers/permissions_policy.rb
Ruby
bsd-2-clause
249
main
465
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Define an application-wide HTTP permissions policy. For further # information see: https://developers.google.com/web/updates/2018/06/feature-policy Rails.application.config.permissions_policy do |policy| policy.camera ...
github
diowa/icare
https://github.com/diowa/icare
config/initializers/simple_form.rb
Ruby
bsd-2-clause
249
main
6,908
# frozen_string_literal: true # # Uncomment this and change the path if necessary to include your own # components. # See https://github.com/heartcombo/simple_form#custom-components to know # more about custom components. # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f } # # Use this setup block ...
github
diowa/icare
https://github.com/diowa/icare
config/initializers/devise.rb
Ruby
bsd-2-clause
249
main
15,522
# frozen_string_literal: true # Assuming you have not yet modified this file, each configuration option below # is set to its default value. Note that some are commented out while others # are not: uncommented lines are intended to protect your configuration from # breaking changes in upgrades (i.e., in the event that...
github
diowa/icare
https://github.com/diowa/icare
config/environments/production.rb
Ruby
bsd-2-clause
249
main
4,648
# frozen_string_literal: true require 'active_support/core_ext/integer/time' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.enable_reloading = false # Eager load code on boot. This eager loads...
github
diowa/icare
https://github.com/diowa/icare
config/environments/test.rb
Ruby
bsd-2-clause
249
main
2,657
# frozen_string_literal: true require 'active_support/core_ext/integer/time' # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test r...
github
diowa/icare
https://github.com/diowa/icare
config/environments/development.rb
Ruby
bsd-2-clause
249
main
2,643
# frozen_string_literal: true require 'active_support/core_ext/integer/time' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded any time # it changes. This slows down response ti...
github
diowa/icare
https://github.com/diowa/icare
config/settings/production.rb
Ruby
bsd-2-clause
249
main
1,064
# frozen_string_literal: true # DO NOT SET SENSITIVE DATA HERE! # USE ENVIRONMENT VARIABLES OR 'local.rb' INSTEAD SimpleConfig.for :application do set :base_url, ENV['APP_BASE_URL'] set :single_process_mode, false set :google_analytics_id, ENV['GOOGLE_ANALYTICS_ID'] set :google_maps_api_key, ENV['GOOGLE_MAPS...
github
diowa/icare
https://github.com/diowa/icare
config/settings/application.rb
Ruby
bsd-2-clause
249
main
1,912
# frozen_string_literal: true # DO NOT SET SENSITIVE DATA HERE! # USE ENVIRONMENT VARIABLES OR 'local.rb' INSTEAD # OVERRIDE THESE DEFAULTS IN A PROPER ENVIRONMENT CONFIGURATION FILE # SET SENSITIVE DATA ONLY IN 'local.rb' SimpleConfig.for :application do set :app_name, 'icare' set :repository_url, 'https://gith...
github
diowa/icare
https://github.com/diowa/icare
config/settings/test.rb
Ruby
bsd-2-clause
249
main
263
# frozen_string_literal: true # DO NOT SET SENSITIVE DATA HERE! # USE ENVIRONMENT VARIABLES OR 'local.rb' INSTEAD SimpleConfig.for :application do group :itineraries do set :bounds, [ [5, 4], [7, 4], [2, 7], [2, 5] ] end end
github
diowa/icare
https://github.com/diowa/icare
config/settings/development.rb
Ruby
bsd-2-clause
249
main
214
# frozen_string_literal: true # DO NOT SET SENSITIVE DATA HERE! # USE ENVIRONMENT VARIABLES OR 'local.rb' INSTEAD SimpleConfig.for :application do group :auth0 do set :cache_expiry_time, 1.minute end end
github
diowa/icare
https://github.com/diowa/icare
lib/tasks/yarn_linters.rake
Ruby
bsd-2-clause
249
main
972
# frozen_string_literal: true namespace :pnpm do # rubocop:disable Rails/RakeEnvironment task :run, %i[command] do |_, args| # Install only production deps when for not usual envs. valid_node_envs = %w[test development production] node_env = ENV.fetch('NODE_ENV') do valid_node_envs.include?(Rails...
github
diowa/icare
https://github.com/diowa/icare
spec/rails_helper.rb
Ruby
bsd-2-clause
249
main
3,532
# frozen_string_literal: true # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require_relative '../config/environment' # Prevent database truncation if the environment is production abort('The Rails environment is running in production mode!'...
github
diowa/icare
https://github.com/diowa/icare
spec/spec_helper.rb
Ruby
bsd-2-clause
249
main
4,787
# frozen_string_literal: true require 'simplecov' SimpleCov.start 'rails' do if ENV['CI'] require 'simplecov-lcov' SimpleCov::Formatter::LcovFormatter.config do |c| c.report_with_single_file = true c.single_report_path = 'coverage/lcov.info' end formatter SimpleCov::Formatter::LcovForm...
github
diowa/icare
https://github.com/diowa/icare
spec/factories/itineraries.rb
Ruby
bsd-2-clause
249
main
11,452
# frozen_string_literal: true FactoryBot.define do factory :itinerary do user start_location { [9.189981999999986, 45.4642035] } end_location { [7.686864000000014, 45.0703393] } via_waypoints { '' } overview_path { [[45.46546, 9.186520000000002], [45.465680000000006, 9.18642], [45.46855, 9.18543...
github
diowa/icare
https://github.com/diowa/icare
spec/factories/conversations.rb
Ruby
bsd-2-clause
249
main
201
# frozen_string_literal: true FactoryBot.define do factory :conversation do conversable factory: %i[itinerary] sender { FactoryBot.build(:user) } receiver { conversable.user } end end
github
diowa/icare
https://github.com/diowa/icare
spec/factories/users.rb
Ruby
bsd-2-clause
249
main
336
# frozen_string_literal: true FactoryBot.define do sequence(:uid) { |n| "100#{n}" } sequence(:email) { |n| "person#{n}@example.com" } factory :user do uid email provider { 'auth0' } name { Faker::Name.name } gender { 'male' } birthday { Faker::Date.birthday(min_age: 18, max_age: ...
github
diowa/icare
https://github.com/diowa/icare
spec/services/conversation_build_spec.rb
Ruby
bsd-2-clause
249
main
1,821
# frozen_string_literal: true require 'rails_helper' RSpec.describe ConversationBuild do let(:sender) { create(:user) } let(:receiver) { create(:user) } let(:conversable) { create(:itinerary, user: sender) } let(:params) { { message: { body: 'Test' } } } describe '#conversation' do it 'does not fail if...
github
diowa/icare
https://github.com/diowa/icare
spec/services/authorization_service_spec.rb
Ruby
bsd-2-clause
249
main
581
# frozen_string_literal: true require 'rails_helper' RSpec.describe AuthorizationService do describe '.delete_user' do subject { described_class.delete_user user_uid } let(:user_uid) { '123456' } before do stub_request(:post, "https://#{APP_CONFIG.auth0.domain}/oauth/token") .to_return(s...
github
diowa/icare
https://github.com/diowa/icare
spec/services/itinerary_search_spec.rb
Ruby
bsd-2-clause
249
main
5,597
# frozen_string_literal: true require 'rails_helper' RSpec.describe ItinerarySearch do describe '.itineraries' do let(:male_user) { create(:user, gender: 'male') } let(:female_user) { create(:user, gender: 'female') } let(:search_params) do { start_location_lat: 0, start_location_lng: 0, ...
github
diowa/icare
https://github.com/diowa/icare
spec/models/message_spec.rb
Ruby
bsd-2-clause
249
main
427
# frozen_string_literal: true require 'rails_helper' RSpec.describe Message do describe '#unread?' do subject { message.unread? } let(:message) { described_class.new } context 'when read_at is nil' do it { is_expected.to be true } end context 'when read_at is not nil' do let(:mess...
github
diowa/icare
https://github.com/diowa/icare
spec/models/user_spec.rb
Ruby
bsd-2-clause
249
main
3,269
# frozen_string_literal: true require 'rails_helper' RSpec.describe User do let(:user) { create(:user) } let(:male_user) { create(:user, gender: 'male') } let(:female_user) { create(:user, gender: 'female') } let(:jack_black) { create(:user, name: 'Jack Black') } let(:anonymous) { create(:user, name: nil) }...
github
diowa/icare
https://github.com/diowa/icare
spec/models/itinerary_spec.rb
Ruby
bsd-2-clause
249
main
6,286
# frozen_string_literal: true require 'rails_helper' RSpec.describe Itinerary do let(:male_user) { create(:user, gender: 'male') } let(:female_user) { create(:user, gender: 'female') } let(:itinerary) { create(:itinerary) } describe 'before_create' do it 'caches driver gender' do female_user = crea...
github
diowa/icare
https://github.com/diowa/icare
spec/models/conversation_spec.rb
Ruby
bsd-2-clause
249
main
3,130
# frozen_string_literal: true require 'rails_helper' RSpec.describe Conversation do subject(:conversation) { described_class.new sender: sender, receiver: receiver, conversable: itinerary } let(:receiver) { create(:user) } let(:sender) { create(:user) } let(:itinerary) { create(:itinerary, user: receiver) } ...
github
diowa/icare
https://github.com/diowa/icare
spec/system/sessions_spec.rb
Ruby
bsd-2-clause
249
main
1,791
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Sessions' do it 'allows users to sign in from Auth0' do login_via_auth0 expect(page).to have_css "a[href=\"#{destroy_user_session_path}\"]" expect(User.count).not_to be_zero end it 'allows users to logout' do login_via_auth0 ...
github
diowa/icare
https://github.com/diowa/icare
spec/system/feedbacks_spec.rb
Ruby
bsd-2-clause
249
main
3,780
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Feedbacks' do it 'allows creation from registered users' do create(:user, uid: '123456') login_via_auth0 click_on Feedback.model_name.human click_on t('helpers.links.new') fill_in 'feedback_message', with: 'This is a new feed...
github
diowa/icare
https://github.com/diowa/icare
spec/system/admin_spec.rb
Ruby
bsd-2-clause
249
main
1,540
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Admin' do let!(:admin) { create(:user, admin: true, uid: '123456') } before do login_via_auth0 end # it "sees reports" do # expect(page).to have_css('#navbar-notifications-reports') # end it 'sees users index' do vis...
github
diowa/icare
https://github.com/diowa/icare
spec/system/conversations_spec.rb
Ruby
bsd-2-clause
249
main
3,288
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Conversations' do let(:driver) { create(:user) } let(:passenger) { create(:user, uid: '123456') } let(:itinerary) { create(:itinerary, user: driver) } it 'allows to see own notifications' do receiver = create(:user, uid: '123456') s...
github
diowa/icare
https://github.com/diowa/icare
spec/system/users_spec.rb
Ruby
bsd-2-clause
249
main
2,610
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Users' do it 'does not see reports' do expect(page).to have_no_css('#navbar-notifications-reports') end it 'does not see users index' do visit admin_users_path expect(page).to have_current_path root_path end it 'allows to de...
github
diowa/icare
https://github.com/diowa/icare
spec/system/application_spec.rb
Ruby
bsd-2-clause
249
main
2,226
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Application' do it 'protects pages from guest users' do visit dashboard_path expect(page).to have_content t('devise.failure.unauthenticated') end it 'redirects banned users to the banned page' do create(:user, banned: true, uid: ...
github
diowa/icare
https://github.com/diowa/icare
spec/system/itineraries_spec.rb
Ruby
bsd-2-clause
249
main
8,470
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Itineraries' do let(:male) { create(:user, uid: '123456', gender: 'male') } let(:female) { create(:user, uid: '123456', gender: 'female') } let(:xss_alert) { "<script>alert('toasty!);</script>" } shared_examples 'feature icons' do |options...
github
diowa/icare
https://github.com/diowa/icare
spec/support/mailer_macros.rb
Ruby
bsd-2-clause
249
main
462
# frozen_string_literal: true module MailerMacros def last_email ActionMailer::Base.deliveries.last end def delivered_emails ActionMailer::Base.deliveries end def reset_email ActionMailer::Base.deliveries = [] end def devise_token_from_last_mail(token_name) last_email.body.to_s[/#{toke...
github
diowa/icare
https://github.com/diowa/icare
spec/support/capybara.rb
Ruby
bsd-2-clause
249
main
2,909
# frozen_string_literal: true Capybara.register_driver :custom_chrome do |app| opts = Selenium::WebDriver::Chrome::Options.new # See https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md # See https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer-core/src/node/Ch...
github
diowa/icare
https://github.com/diowa/icare
spec/support/selenium_browser_error_reporter.rb
Ruby
bsd-2-clause
249
main
1,010
# frozen_string_literal: true class SeleniumBrowserErrorReporter SEVERE_LOG_LEVEL = 'SEVERE' def self.call(page) new(page).report! end def self.clear_error_logs!(page) new(page).clear_error_logs! end def initialize(page) self.page = page end def report! raise error_messages if sever...
github
diowa/icare
https://github.com/diowa/icare
spec/support/omniauth.rb
Ruby
bsd-2-clause
249
main
1,087
# frozen_string_literal: true # rubocop:disable Layout/FirstHashElementIndentation, Rails/RelativeDateConstant OMNIAUTH_MOCKED_AUTHHASH = OmniAuth::AuthHash.new({ 'provider' => 'auth0', 'uid' => '123456', 'info' => { 'email' => 'test@example.com', 'name' => 'John Doe', 'image' => '...
github
diowa/icare
https://github.com/diowa/icare
spec/workers/delete_user_job_spec.rb
Ruby
bsd-2-clause
249
main
476
# frozen_string_literal: true require 'rails_helper' RSpec.describe DeleteUserJob do describe '#perform' do subject(:perform) { described_class.new.perform(user_uid) } let(:user_uid) { '123456' } before do allow(AuthorizationService).to receive(:delete_user).with(user_uid) end it 'delet...
github
diowa/icare
https://github.com/diowa/icare
db/schema.rb
Ruby
bsd-2-clause
249
main
4,678
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
diowa/icare
https://github.com/diowa/icare
db/migrate/20210206214754_rename_open_feedbacks.rb
Ruby
bsd-2-clause
249
main
330
class RenameOpenFeedbacks < ActiveRecord::Migration[6.1] def up Feedback.where(status: 'open').update_all status: 'normal' change_column_default :feedbacks, :status, 'normal' end def down Feedback.where(status: 'normal').update_all status: 'open' change_column_default :feedbacks, :status, 'open' ...
github
diowa/icare
https://github.com/diowa/icare
db/migrate/20200323205811_add_sender_unique_id_to_conversations.rb
Ruby
bsd-2-clause
249
main
287
class AddSenderUniqueIdToConversations < ActiveRecord::Migration[6.0] def change remove_index :conversations, %i[sender_id receiver_id] add_index :conversations, %i[sender_id receiver_id conversable_type conversable_id], name: 'unique_index_for_sender', unique: true end end
github
diowa/icare
https://github.com/diowa/icare
db/migrate/20190826120019_create_feedbacks.rb
Ruby
bsd-2-clause
249
main
318
class CreateFeedbacks < ActiveRecord::Migration[5.2] def change create_table :feedbacks do |t| t.string :category, default: 'bug' t.text :message t.string :url t.string :status, default: 'open' t.references :user, foreign_key: true t.timestamps null: false end end end
github
diowa/icare
https://github.com/diowa/icare
db/migrate/20190826124852_create_itineraries.rb
Ruby
bsd-2-clause
249
main
1,287
class CreateItineraries < ActiveRecord::Migration[5.2] def change create_table :itineraries do |t| t.string :slug # Details t.string :description t.integer :num_people t.integer :fuel_cost, default: 0 t.integer :tolls, default: 0 t.boolean :daily, default: fal...
github
diowa/icare
https://github.com/diowa/icare
db/migrate/20200102175509_create_conversations.rb
Ruby
bsd-2-clause
249
main
541
class CreateConversations < ActiveRecord::Migration[6.0] def change create_table :conversations do |t| t.references :conversable, polymorphic: true, index: true t.belongs_to :sender t.belongs_to :receiver t.timestamps null: false t.index %i[sender_id receiver_id], unique: true ...
github
diowa/icare
https://github.com/diowa/icare
db/migrate/20210131193118_remove_facebook_columns_from_users.rb
Ruby
bsd-2-clause
249
main
418
class RemoveFacebookColumnsFromUsers < ActiveRecord::Migration[6.1] def change remove_column :users, :facebook_data_cached_at, :datetime, default: "2012-09-06 00:00:00" remove_column :users, :facebook_favorites, :jsonb, default: [], array: true remove_column :users, :facebook_permissions, :jsonb, default:...
github
diowa/icare
https://github.com/diowa/icare
db/migrate/20190826111313_create_users.rb
Ruby
bsd-2-clause
249
main
2,655
# frozen_string_literal: true class CreateUsers < ActiveRecord::Migration[5.2] def self.up create_table :users do |t| ## Database authenticatable t.string :email, null: false, default: "" # t.string :encrypted_password, null: false, default: "" ## Recoverable # t.strin...
github
therubymug/hitch
https://github.com/therubymug/hitch
Rakefile
Ruby
mit
249
master
3,150
############################################################################# # # Helper functions # ############################################################################# def name @name ||= Dir['*.gemspec'].first.split('.').first end def version line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/] ...
github
therubymug/hitch
https://github.com/therubymug/hitch
hitch.gemspec
Ruby
mit
249
master
1,969
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.specification_version = 2 if s.respond_to? :specification_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.rubygems_version = '1.3.5' s.license = "MIT" s.name = %q{hitch} s.version = ...
github
therubymug/hitch
https://github.com/therubymug/hitch
lib/hitch.rb
Ruby
mit
249
master
3,042
require 'highline' require 'yaml' require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib hitch author])) require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib hitch ui])) module Hitch VERSION = '1.1.0' def self.print_info if Hitch.pairing? && STDOUT.tty? Hitch::UI.highline...
github
therubymug/hitch
https://github.com/therubymug/hitch
lib/hitch/author.rb
Ruby
mit
249
master
808
module Hitch class Author def self.add(author_github, author_email) unless find(author_github) available_pairs[author_github] = author_email end end def self.find(author_github) available_pairs[author_github] end def self.write_file File.open(hitch_pairs, File::C...
github
therubymug/hitch
https://github.com/therubymug/hitch
lib/hitch/ui.rb
Ruby
mit
249
master
911
HighLine.track_eof = false module Hitch class UI def self.prompt_for_group_email Hitch.group_email = highline.ask("What is the group email? e.g. dev@hashrocket.com will become dev+therubymug+leshill@hashrocket.com") do |q| q.case = :down q.validate = /\A[a-zA-Z0-9_\.\-\+]+@[a-zA-Z1-9\-]+\....
github
therubymug/hitch
https://github.com/therubymug/hitch
spec/hitch_spec.rb
Ruby
mit
249
master
6,854
require 'spec_helper' describe Hitch do let(:hitch_pairs) do { "conan" => "Conan O'Brien", "fry" => "Philip J. Fry", "leela" => "Turanga Leela", "zoidberg" => "John A. Zoidberg" } end let(:hitch_config) do { :group_email => 'dev@hashrocket.com', :current_pai...
github
therubymug/hitch
https://github.com/therubymug/hitch
spec/spec_helper.rb
Ruby
mit
249
master
487
require 'rspec' require 'fileutils' require 'tempfile' require File.join(File.dirname(__FILE__), '..', 'lib', 'hitch') RSpec.configure do |config| config.color_enabled = true config.formatter = 'progress' config.before(:each) do Hitch.stub(:hitchrc).and_return(Tempfile.new('hitchrc').path) Hitch.stub(:h...
github
therubymug/hitch
https://github.com/therubymug/hitch
spec/acceptance/hitch_spec.rb
Ruby
mit
249
master
592
require 'spec_helper' require 'stringio' describe Hitch do describe 'configuration file' do let(:hitchrc){ Tempfile.new('hitchrc') } before do described_class.stub(:hitchrc => hitchrc.path) end def with_custom_input_io(io) old_stdin = $stdin $stdin = io yield ensure ...
github
therubymug/hitch
https://github.com/therubymug/hitch
spec/hitch/ui_spec.rb
Ruby
mit
249
master
3,407
require 'spec_helper' describe Hitch::UI do describe '.prompt_for_group_email' do let(:question_message) { "What is the group email? e.g. dev@hashrocket.com will become dev+therubymug+leshill@hashrocket.com" } it 'prompts for group email' do Hitch::UI.highline.should_receive(:ask).with(question_mess...
github
therubymug/hitch
https://github.com/therubymug/hitch
spec/hitch/author_spec.rb
Ruby
mit
249
master
1,325
require 'spec_helper' describe Hitch::Author do let(:base_pairs) do { 'bender' => 'Bender Bending Rodriguez', 'fry' => 'Phillip J. Fry', 'leela' => 'Turanga Leela' } end before { Hitch::Author.stub(:available_pairs).and_return(base_pairs) } describe ".write_file" do it "writes ...
github
socketry/localhost
https://github.com/socketry/localhost
localhost.gemspec
Ruby
mit
248
main
951
# frozen_string_literal: true require_relative "lib/localhost/version" Gem::Specification.new do |spec| spec.name = "localhost" spec.version = Localhost::VERSION spec.summary = "Manage a local certificate authority for self-signed localhost development servers." spec.authors = ["Samuel Williams", "Olle Jonsson"...
github
socketry/localhost
https://github.com/socketry/localhost
gems.rb
Ruby
mit
248
main
517
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2018-2026, by Samuel Williams. source "https://rubygems.org" gemspec group :maintenance, optional: true do gem "bake-gem" gem "bake-modernize" gem "bake-releases" gem "utopia-project" end group :test do gem "sus" gem "covered" ge...
github
socketry/localhost
https://github.com/socketry/localhost
guides/example-server/https.rb
Ruby
mit
248
main
1,460
#!/usr/bin/env ruby # frozen_string_literal: true # Released under the MIT License. # Copyright, 2018-2025, by Samuel Williams. # Copyright, 2021, by Ye Lin Aung. # Require the required libraries: require "async" require "async/io/host_endpoint" require "async/io/ssl_endpoint" require "async/http/server" require "asy...
github
socketry/localhost
https://github.com/socketry/localhost
lib/localhost.rb
Ruby
mit
248
main
257
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2018-2025, by Samuel Williams. require_relative "localhost/version" require_relative "localhost/authority" require_relative "localhost/system" # @namespace module Localhost end
github
socketry/localhost
https://github.com/socketry/localhost
lib/localhost/issuer.rb
Ruby
mit
248
main
4,370
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2025, by Samuel Williams. require "openssl" require "fileutils" require_relative "state" module Localhost # Represents a local Root Certificate Authority used to sign development certificates. class Issuer # The default number of bits ...
github
socketry/localhost
https://github.com/socketry/localhost
lib/localhost/state.rb
Ruby
mit
248
main
1,081
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2025, by Samuel Williams. require "fileutils" module Localhost # Represents a single public/private key pair for a given hostname. module State # Where to store the key pair on the filesystem. This is a subdirectory # of $XDG_STATE_HO...
github
socketry/localhost
https://github.com/socketry/localhost
lib/localhost/authority.rb
Ruby
mit
248
main
7,509
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2018-2026, by Samuel Williams. # Copyright, 2019, by Richard S. Leung. # Copyright, 2021, by Akshay Birajdar. # Copyright, 2021, by Ye Lin Aung. # Copyright, 2023, by Antonio Terceiro. # Copyright, 2023, by Yuuji Yaginuma. # Copyright, 2024, ...
github
socketry/localhost
https://github.com/socketry/localhost
lib/localhost/system.rb
Ruby
mit
248
main
492
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2025, by Samuel Williams. module Localhost # @namespace module System # @return [Class] The best system class for the current platform. def self.current case RUBY_PLATFORM when /darwin/ require "localhost/system/darwin" ...
github
socketry/localhost
https://github.com/socketry/localhost
lib/localhost/system/darwin.rb
Ruby
mit
248
main
784
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2025, by Samuel Williams. module Localhost module System # Darwin specific system operations. module Darwin # Install a certificate into the system trust store. # # @parameter certificate [String] The path to the certificate fi...
github
socketry/localhost
https://github.com/socketry/localhost
lib/localhost/system/linux.rb
Ruby
mit
248
main
1,954
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2025-2026, by Samuel Williams. module Localhost module System # Linux specific system operations. module Linux # This appears to be the standard path for the system trust store on many Linux distributions. ANCHORS_PATH = "/etc/ca-...
github
socketry/localhost
https://github.com/socketry/localhost
test/localhost.rb
Ruby
mit
248
main
246
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2023-2025, by Samuel Williams. require "localhost" describe Localhost do it "has a version number" do expect(Localhost::VERSION).to be =~ /\d+\.\d+\.\d+/ end end
github
socketry/localhost
https://github.com/socketry/localhost
test/localhost/protocol.rb
Ruby
mit
248
main
1,928
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2018-2025, by Samuel Williams. require "localhost/authority" require "sus/fixtures/async/http/server_context" require "io/endpoint/ssl_endpoint" require "fileutils" AValidProtocol = Sus::Shared("valid protocol") do |protocol, openssl_optio...
github
socketry/localhost
https://github.com/socketry/localhost
test/localhost/state.rb
Ruby
mit
248
main
490
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2025, by Samuel Williams. require "localhost/authority" require "sus/fixtures/async/reactor_context" require "io/endpoint/ssl_endpoint" require "fileutils" require "tempfile" describe Localhost::State do with ".path" do it "uses XDG_ST...
github
socketry/localhost
https://github.com/socketry/localhost
test/localhost/authority.rb
Ruby
mit
248
main
3,356
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2018-2025, by Samuel Williams. # Copyright, 2021, by Ye Lin Aung. # Copyright, 2024, by Colin Shea. # Copyright, 2024, by Aurel Branzeanu. require "localhost/authority" require "sus/fixtures/async/reactor_context" require "io/endpoint/ssl_e...